diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-03-06 01:04:08 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-03-06 01:04:08 +0000 |
commit | 33fb5f861b4fb07b912f43b54203a7f2ed659ef2 (patch) | |
tree | 51712e760dc963e4eb6dbf2a0e228c56019ed115 | |
parent | 63e9a7edd9e4b488d4fe74cf922c405e0b8094ab (diff) | |
parent | eed3bce42531b10ec94c518de29fee7092f48f15 (diff) | |
download | nova-33fb5f861b4fb07b912f43b54203a7f2ed659ef2.tar.gz nova-33fb5f861b4fb07b912f43b54203a7f2ed659ef2.tar.xz nova-33fb5f861b4fb07b912f43b54203a7f2ed659ef2.zip |
Merge "Moves Hyper-V options to the hyperv section"
-rw-r--r-- | nova/tests/test_hypervapi.py | 18 | ||||
-rw-r--r-- | nova/virt/hyperv/pathutils.py | 6 | ||||
-rw-r--r-- | nova/virt/hyperv/vif.py | 7 | ||||
-rw-r--r-- | nova/virt/hyperv/vmops.py | 22 | ||||
-rw-r--r-- | nova/virt/hyperv/volumeops.py | 24 | ||||
-rw-r--r-- | nova/virt/hyperv/volumeutils.py | 6 | ||||
-rw-r--r-- | nova/virt/hyperv/volumeutilsv2.py | 6 |
7 files changed, 52 insertions, 37 deletions
diff --git a/nova/tests/test_hypervapi.py b/nova/tests/test_hypervapi.py index 5dc77b911..c6d75aea1 100644 --- a/nova/tests/test_hypervapi.py +++ b/nova/tests/test_hypervapi.py @@ -56,7 +56,7 @@ from nova.virt.hyperv import volumeutilsv2 from nova.virt import images CONF = cfg.CONF -CONF.import_opt('vswitch_name', 'nova.virt.hyperv.vif') +CONF.import_opt('vswitch_name', 'nova.virt.hyperv.vif', 'hyperv') class HyperVAPITestCase(test.TestCase): @@ -86,9 +86,11 @@ class HyperVAPITestCase(test.TestCase): self._setup_stubs() self.flags(instances_path=r'C:\Hyper-V\test\instances', - vswitch_name='external', - network_api_class='nova.network.quantumv2.api.API', - force_volumeutils_v1=True) + network_api_class='nova.network.quantumv2.api.API') + + self.flags(vswitch_name='external', + force_volumeutils_v1=True, + group='hyperv') self._conn = driver_hyperv.HyperVDriver(None) @@ -333,7 +335,7 @@ class HyperVAPITestCase(test.TestCase): cdb.__exit__(None, None, None).AndReturn(None) if not use_cdrom: - utils.execute(CONF.qemu_img_cmd, + utils.execute(CONF.hyperv.qemu_img_cmd, 'convert', '-f', 'raw', @@ -353,7 +355,7 @@ class HyperVAPITestCase(test.TestCase): def _test_spawn_config_drive(self, use_cdrom): self.flags(force_config_drive=True) - self.flags(config_drive_cdrom=use_cdrom) + self.flags(config_drive_cdrom=use_cdrom, group='hyperv') self.flags(mkisofs_cmd='mkisofs.exe') self._setup_spawn_config_drive_mocks(use_cdrom) @@ -393,7 +395,7 @@ class HyperVAPITestCase(test.TestCase): fake_vswitch_port = 'fake port' m = networkutils.NetworkUtils.get_external_vswitch( - CONF.vswitch_name) + CONF.hyperv.vswitch_name) m.AndReturn(fake_vswitch_path) m = networkutils.NetworkUtils.create_vswitch_port( @@ -412,7 +414,7 @@ class HyperVAPITestCase(test.TestCase): def setup_vif_mocks(): m = networkutils.NetworkUtils.get_external_vswitch( - CONF.vswitch_name) + CONF.hyperv.vswitch_name) m.AndRaise(vmutils.HyperVException(_('fake vswitch not found'))) self.assertRaises(vmutils.HyperVException, self._test_spawn_instance, diff --git a/nova/virt/hyperv/pathutils.py b/nova/virt/hyperv/pathutils.py index 7ee4d06ea..6c57b8f82 100644 --- a/nova/virt/hyperv/pathutils.py +++ b/nova/virt/hyperv/pathutils.py @@ -35,7 +35,7 @@ hyperv_opts = [ ] CONF = cfg.CONF -CONF.register_opts(hyperv_opts, 'HYPERV') +CONF.register_opts(hyperv_opts, 'hyperv') CONF.import_opt('instances_path', 'nova.compute.manager') @@ -77,8 +77,8 @@ class PathUtils(object): local_instance_path = os.path.normpath(CONF.instances_path) if remote_server: - if CONF.HYPERV.instances_path_share: - path = CONF.HYPERV.instances_path_share + if CONF.hyperv.instances_path_share: + path = CONF.hyperv.instances_path_share else: # Use an administrative share path = local_instance_path.replace(':', '$') diff --git a/nova/virt/hyperv/vif.py b/nova/virt/hyperv/vif.py index d49441cee..8cf401908 100644 --- a/nova/virt/hyperv/vif.py +++ b/nova/virt/hyperv/vif.py @@ -29,11 +29,12 @@ hyperv_opts = [ default=None, help='External virtual switch Name, ' 'if not provided, the first external virtual ' - 'switch is used'), + 'switch is used', + deprecated_group='DEFAULT'), ] CONF = cfg.CONF -CONF.register_opts(hyperv_opts) +CONF.register_opts(hyperv_opts, 'hyperv') LOG = logging.getLogger(__name__) @@ -69,7 +70,7 @@ class HyperVNovaNetworkVIFDriver(HyperVBaseVIFDriver): def plug(self, instance, vif): vswitch_path = self._netutils.get_external_vswitch( - CONF.vswitch_name) + CONF.hyperv.vswitch_name) vm_name = instance['name'] LOG.debug(_('Creating vswitch port for instance: %s') % vm_name) diff --git a/nova/virt/hyperv/vmops.py b/nova/virt/hyperv/vmops.py index 48edae7fd..230c5ea40 100644 --- a/nova/virt/hyperv/vmops.py +++ b/nova/virt/hyperv/vmops.py @@ -44,22 +44,26 @@ hyperv_opts = [ cfg.BoolOpt('limit_cpu_features', default=False, help='Required for live migration among ' - 'hosts with different CPU features'), + 'hosts with different CPU features', + deprecated_group='DEFAULT'), cfg.BoolOpt('config_drive_inject_password', default=False, - help='Sets the admin password in the config drive image'), + help='Sets the admin password in the config drive image', + deprecated_group='DEFAULT'), cfg.StrOpt('qemu_img_cmd', default="qemu-img.exe", help='qemu-img is used to convert between ' - 'different image types'), + 'different image types', + deprecated_group='DEFAULT'), cfg.BoolOpt('config_drive_cdrom', default=False, help='Attaches the Config Drive image as a cdrom drive ' - 'instead of a disk drive') + 'instead of a disk drive', + deprecated_group='DEFAULT') ] CONF = cfg.CONF -CONF.register_opts(hyperv_opts) +CONF.register_opts(hyperv_opts, 'hyperv') CONF.import_opt('use_cow_images', 'nova.virt.driver') CONF.import_opt('network_api_class', 'nova.network') @@ -180,7 +184,7 @@ class VMOps(object): self._vmutils.create_vm(instance_name, instance['memory_mb'], instance['vcpus'], - CONF.limit_cpu_features) + CONF.hyperv.limit_cpu_features) if root_vhd_path: self._vmutils.attach_ide_drive(instance_name, @@ -210,7 +214,7 @@ class VMOps(object): LOG.info(_('Using config drive for instance: %s'), instance=instance) extra_md = {} - if admin_password and CONF.config_drive_inject_password: + if admin_password and CONF.hyperv.config_drive_inject_password: extra_md['admin_pass'] = admin_password inst_md = instance_metadata.InstanceMetadata(instance, @@ -231,11 +235,11 @@ class VMOps(object): LOG.error(_('Creating config drive failed with error: %s'), e, instance=instance) - if not CONF.config_drive_cdrom: + if not CONF.hyperv.config_drive_cdrom: drive_type = constants.IDE_DISK configdrive_path = os.path.join(instance_path, 'configdrive.vhd') - utils.execute(CONF.qemu_img_cmd, + utils.execute(CONF.hyperv.qemu_img_cmd, 'convert', '-f', 'raw', diff --git a/nova/virt/hyperv/volumeops.py b/nova/virt/hyperv/volumeops.py index 0d12b93a2..3542a6194 100644 --- a/nova/virt/hyperv/volumeops.py +++ b/nova/virt/hyperv/volumeops.py @@ -33,20 +33,24 @@ from nova.virt.hyperv import volumeutilsv2 LOG = logging.getLogger(__name__) hyper_volumeops_opts = [ - cfg.IntOpt('hyperv_attaching_volume_retry_count', + cfg.IntOpt('volume_attach_retry_count', default=10, - help='The number of times we retry on attaching volume '), - cfg.IntOpt('hyperv_wait_between_attach_retry', + help='The number of times to retry to attach a volume', + deprecated_name='hyperv_attaching_volume_retry_count', + deprecated_group='DEFAULT'), + cfg.IntOpt('volume_attach_retry_interval', default=5, - help='The seconds to wait between an volume ' - 'attachment attempt'), + help='Interval between volume attachment attempts, in seconds', + deprecated_name='hyperv_wait_between_attach_retry', + deprecated_group='DEFAULT'), cfg.BoolOpt('force_volumeutils_v1', default=False, - help='Force volumeutils v1'), + help='Force volumeutils v1', + deprecated_group='DEFAULT'), ] CONF = cfg.CONF -CONF.register_opts(hyper_volumeops_opts) +CONF.register_opts(hyper_volumeops_opts, 'hyperv') CONF.import_opt('my_ip', 'nova.netconf') @@ -63,7 +67,7 @@ class VolumeOps(object): self._default_root_device = 'vda' def _get_volume_utils(self): - if(not CONF.force_volumeutils_v1 and + if(not CONF.hyperv.force_volumeutils_v1 and self._hostutils.get_windows_version() >= 6.2): return volumeutilsv2.VolumeUtilsV2() else: @@ -171,12 +175,12 @@ class VolumeOps(object): LOG.debug(_('Device number: %(device_number)s, ' 'target lun: %(target_lun)s') % locals()) #Finding Mounted disk drive - for i in range(1, CONF.hyperv_attaching_volume_retry_count): + for i in range(1, CONF.hyperv.volume_attach_retry_count): mounted_disk_path = self._vmutils.get_mounted_disk_by_drive_number( device_number) if mounted_disk_path: break - time.sleep(CONF.hyperv_wait_between_attach_retry) + time.sleep(CONF.hyperv.volume_attach_retry_interval) if not mounted_disk_path: raise vmutils.HyperVException(_('Unable to find a mounted disk ' diff --git a/nova/virt/hyperv/volumeutils.py b/nova/virt/hyperv/volumeutils.py index 6d623fca7..e77b463fe 100644 --- a/nova/virt/hyperv/volumeutils.py +++ b/nova/virt/hyperv/volumeutils.py @@ -66,8 +66,10 @@ class VolumeUtils(basevolumeutils.BaseVolumeUtils): self.execute('iscsicli.exe ' + 'LisTargets') #Sending login self.execute('iscsicli.exe ' + 'qlogintarget ' + target_iqn) - #Waiting the disk to be mounted. Research this to avoid sleep - time.sleep(CONF.hyperv_wait_between_attach_retry) + #Waiting the disk to be mounted. + #TODO(pnavarro): Check for the operation to end instead of + #relying on a timeout + time.sleep(CONF.hyperv.volume_attach_retry_interval) def logout_storage_target(self, target_iqn): """Logs out storage target through its session id.""" diff --git a/nova/virt/hyperv/volumeutilsv2.py b/nova/virt/hyperv/volumeutilsv2.py index 2dc86c2e0..79d2d1876 100644 --- a/nova/virt/hyperv/volumeutilsv2.py +++ b/nova/virt/hyperv/volumeutilsv2.py @@ -56,8 +56,10 @@ class VolumeUtilsV2(basevolumeutils.BaseVolumeUtils): target = self._conn_storage.MSFT_iSCSITarget target.Connect(NodeAddress=target_iqn, IsPersistent=True) - #Waiting the disk to be mounted. Research this - time.sleep(CONF.hyperv_wait_between_attach_retry) + #Waiting the disk to be mounted. + #TODO(pnavarro): Check for the operation to end instead of + #relying on a timeout + time.sleep(CONF.hyperv.volume_attach_retry_interval) def logout_storage_target(self, target_iqn): """Logs out storage target through its session id.""" |