~curtin-dev/curtin/trunk

« back to all changes in this revision

Viewing changes to curtin/commands/curthooks.py

  • Committer: Scott Moser
  • Author(s): Nish Aravamudan
  • Date: 2017-02-22 20:36:06 UTC
  • mfrom: (450.3.45 curtin)
  • Revision ID: smoser@ubuntu.com-20170222203606-71yzbu6a5m27b7of
Add iSCSI disk support.

iSCSI disks are specified following RFC4173
(https://tools.ietf.org/html/rfc4173) as:

  path: iscsi:[user:pass[:iuser:ipass]@]host:proto:port:lun:targetname

Unittests for iSCSI target parsing have been added as well as a vmtests
for testing iSCSI targets via tgt with all possible authentication
combinations.

For standalone testing, tools/find-tgt has been added to spawn a tgt
server as a regular user for serving iSCSI disks.

tools/jenkins-runner has been updated to use tools/find-tgt for the
automated vmtests.

Additionally, we add two new subcommands for working with iscsi volumes:
 block-attach-iscsi
 block-detach-iscsi

Show diffs side-by-side

added added

removed removed

Lines of Context:
395
395
    shutil.copy(crypttab, os.path.sep.join([target, 'etc/crypttab']))
396
396
 
397
397
 
 
398
def copy_iscsi_conf(nodes_dir, target):
 
399
    if not nodes_dir:
 
400
        LOG.warn("nodes directory must be specified, not copying")
 
401
        return
 
402
 
 
403
    LOG.info("copying iscsi nodes database into target")
 
404
    shutil.copytree(nodes_dir, os.path.sep.join([target,
 
405
                    'etc/iscsi/nodes']))
 
406
 
 
407
 
398
408
def copy_mdadm_conf(mdadm_conf, target):
399
409
    if not mdadm_conf:
400
410
        LOG.warn("mdadm config must be specified, not copying")
694
704
    # packages may be needed prior to installing kernel
695
705
    install_missing_packages(cfg, target)
696
706
 
 
707
    # If a /etc/iscsi/nodes/... file was created by block_meta then it
 
708
    # needs to be copied onto the target system
 
709
    nodes_location = os.path.join(os.path.split(state['fstab'])[0],
 
710
                                  "nodes")
 
711
    if os.path.exists(nodes_location):
 
712
        copy_iscsi_conf(nodes_location, target)
 
713
        # do we need to reconfigure open-iscsi?
 
714
 
697
715
    # If a mdadm.conf file was created by block_meta than it needs to be copied
698
716
    # onto the target system
699
717
    mdadm_location = os.path.join(os.path.split(state['fstab'])[0],