Virt: change instance_type to flavor

The commit Ieebfcbc2478ba8d7036c1af30efbbf640aa7df73 made
use of instance_type. This should have been flavor.

This is related to blueprint flavor-instance-type-dedup.

Change-Id: Ib7cb7a0926050e3d0873328f84e8554884a48468
This commit is contained in:
Gary Kotton 2014-11-18 06:28:50 -08:00
parent 5ef07cc04d
commit 34c5c64913
11 changed files with 30 additions and 30 deletions

View File

@ -1454,14 +1454,14 @@ class ComputeManager(manager.Manager):
not instance.access_ip_v4 and
not instance.access_ip_v6)
instance_type = None
flavor = None
if filter_properties is not None:
instance_type = filter_properties.get('instance_type')
flavor = filter_properties.get('instance_type')
instance = self._spawn(context, instance, image_meta,
network_info, block_device_info,
injected_files, admin_password,
set_access_ip=set_access_ip,
instance_type=instance_type)
flavor=flavor)
except (exception.InstanceNotFound,
exception.UnexpectedDeletingTaskStateError):
# the instance got deleted during the spawn
@ -1870,7 +1870,7 @@ class ComputeManager(manager.Manager):
@object_compat
def _spawn(self, context, instance, image_meta, network_info,
block_device_info, injected_files, admin_password,
set_access_ip=False, instance_type=None):
set_access_ip=False, flavor=None):
"""Spawn an instance with error logging and update its power state."""
instance.vm_state = vm_states.BUILDING
instance.task_state = task_states.SPAWNING
@ -1880,7 +1880,7 @@ class ComputeManager(manager.Manager):
injected_files, admin_password,
network_info,
block_device_info,
instance_type=instance_type)
flavor=flavor)
except Exception:
with excutils.save_and_reraise_exception():
LOG.exception(_LE('Instance failed to spawn'),
@ -2135,14 +2135,14 @@ class ComputeManager(manager.Manager):
task_states.BLOCK_DEVICE_MAPPING)
block_device_info = resources['block_device_info']
network_info = resources['network_info']
instance_type = None
flavor = None
if filter_properties is not None:
instance_type = filter_properties.get('instance_type')
flavor = filter_properties.get('instance_type')
self.driver.spawn(context, instance, image,
injected_files, admin_password,
network_info=network_info,
block_device_info=block_device_info,
instance_type=instance_type)
flavor=flavor)
except (exception.InstanceNotFound,
exception.UnexpectedDeletingTaskStateError) as e:
with excutils.save_and_reraise_exception():
@ -4284,14 +4284,14 @@ class ComputeManager(manager.Manager):
network_info = self._get_instance_nw_info(context, instance)
try:
with rt.instance_claim(context, instance, limits):
instance_type = None
flavor = None
if filter_properties is not None:
instance_type = filter_properties.get('instance_type')
flavor = filter_properties.get('instance_type')
self.driver.spawn(context, instance, image, injected_files=[],
admin_password=None,
network_info=network_info,
block_device_info=block_device_info,
instance_type=instance_type)
flavor=flavor)
except Exception:
with excutils.save_and_reraise_exception():
LOG.exception(_LE('Instance failed to spawn'),

View File

@ -10867,7 +10867,7 @@ class ComputeRescheduleOrErrorTestCase(BaseTestCase):
self.compute._spawn(mox.IgnoreArg(), self.instance, mox.IgnoreArg(),
mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg(),
mox.IgnoreArg(), set_access_ip=False,
instance_type=None).AndRaise(exc)
flavor=None).AndRaise(exc)
self.mox.ReplayAll()
# test succeeds if mocked method '_reschedule_or_error' is not
@ -10886,7 +10886,7 @@ class ComputeRescheduleOrErrorTestCase(BaseTestCase):
self.compute._spawn(mox.IgnoreArg(), self.instance, mox.IgnoreArg(),
mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg(),
mox.IgnoreArg(), set_access_ip=False,
instance_type=None).AndRaise(exc)
flavor=None).AndRaise(exc)
self.mox.ReplayAll()
self.assertRaises(exception.UnexpectedTaskStateError,
@ -11254,7 +11254,7 @@ class ComputeInjectedFilesTestCase(BaseTestCase):
def _spawn(self, context, instance, image_meta, injected_files,
admin_password, nw_info, block_device_info, db_api=None,
instance_type=None):
flavor=None):
self.assertEqual(self.expected, injected_files)
def _test(self, injected_files, decoded_files):

View File

@ -2341,7 +2341,7 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase):
self.injected_files, self.admin_pass,
network_info=self.network_info,
block_device_info=self.block_device_info,
instance_type=None).AndRaise(exc)
flavor=None).AndRaise(exc)
self._notify_about_instance_usage('create.error',
fault=exc, stub=False)
conductor_rpcapi.ConductorAPI.instance_update(
@ -2541,7 +2541,7 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase):
self.injected_files, self.admin_pass,
network_info=self.network_info,
block_device_info=self.block_device_info,
instance_type=None).AndRaise(exc)
flavor=None).AndRaise(exc)
self._notify_about_instance_usage('create.end',
fault=exc, stub=False)
conductor_rpcapi.ConductorAPI.instance_update(
@ -2575,7 +2575,7 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase):
self.injected_files, self.admin_pass,
network_info=self.network_info,
block_device_info=self.block_device_info,
instance_type=None).AndRaise(exc)
flavor=None).AndRaise(exc)
conductor_rpcapi.ConductorAPI.instance_update(
self.context, self.instance.uuid, mox.IgnoreArg(), 'conductor')
self._notify_about_instance_usage('create.error',
@ -2660,7 +2660,7 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase):
self.image, self.injected_files, self.admin_pass,
network_info=self.network_info,
block_device_info=self.block_device_info,
instance_type=None))
flavor=None))
instance_update.assert_has_calls(mock.call(self.context,
self.instance.uuid, mock.ANY, 'conductor'))
@ -2675,7 +2675,7 @@ class ComputeManagerBuildInstanceTestCase(test.NoDBTestCase):
network_info = mock.MagicMock()
with mock.patch.object(self.compute, 'driver'):
self.compute._spawn(self.context, inst, {}, network_info, None,
None, None, instance_type=None)
None, None, flavor=None)
network_info.wait.assert_called_once_with(do_raise=True)
self.assertEqual(network_info, inst.info_cache.network_info)
inst.save.assert_called_with(expected_task_state=task_states.SPAWNING)

View File

@ -244,7 +244,7 @@ class ShelveComputeManagerTestCase(test_compute.BaseTestCase):
injected_files=[], admin_password=None,
network_info=[],
block_device_info='fake_bdm',
instance_type=None)
flavor=None)
self.compute._get_power_state(self.context, instance).AndReturn(123)
db.instance_update_and_get_original(self.context, instance['uuid'],
{'power_state': 123,
@ -316,7 +316,7 @@ class ShelveComputeManagerTestCase(test_compute.BaseTestCase):
injected_files=[], admin_password=None,
network_info=[],
block_device_info='fake_bdm',
instance_type=None)
flavor=None)
self.compute._get_power_state(self.context, instance).AndReturn(123)
db.instance_update_and_get_original(self.context, instance['uuid'],
{'power_state': 123,

View File

@ -269,7 +269,7 @@ class ComputeDriver(object):
def spawn(self, context, instance, image_meta, injected_files,
admin_password, network_info=None, block_device_info=None,
instance_type=None):
flavor=None):
"""Create a new instance/VM/domain on the virtualization platform.
Once this successfully completes, the instance should be
@ -291,7 +291,7 @@ class ComputeDriver(object):
:py:meth:`~nova.network.manager.NetworkManager.get_instance_nw_info`
:param block_device_info: Information about block devices to be
attached to the instance.
:param instance_type: The instance_type for the instance to be spawned.
:param flavor: The flavor for the instance to be spawned.
"""
raise NotImplementedError()

View File

@ -144,7 +144,7 @@ class FakeDriver(driver.ComputeDriver):
def spawn(self, context, instance, image_meta, injected_files,
admin_password, network_info=None, block_device_info=None,
instance_type=None):
flavor=None):
name = instance['name']
state = power_state.RUNNING
fake_instance = FakeInstance(name, state, instance['uuid'])

View File

@ -56,7 +56,7 @@ class HyperVDriver(driver.ComputeDriver):
def spawn(self, context, instance, image_meta, injected_files,
admin_password, network_info=None, block_device_info=None,
instance_type=None):
flavor=None):
self._vmops.spawn(context, instance, image_meta, injected_files,
admin_password, network_info, block_device_info)

View File

@ -574,7 +574,7 @@ class IronicDriver(virt_driver.ComputeDriver):
def spawn(self, context, instance, image_meta, injected_files,
admin_password, network_info=None, block_device_info=None,
instance_type=None):
flavor=None):
"""Deploy an instance.
:param context: The security context.
@ -588,7 +588,7 @@ class IronicDriver(virt_driver.ComputeDriver):
:param network_info: Instance network information.
:param block_device_info: Instance block device
information. Ignored by this driver.
:param instance_type: The instance_type for the instance to be spawned.
:param flavor: The flavor for the instance to be spawned.
"""
# The compute manager is meant to know the node uuid, so missing uuid
# is a significant issue. It may mean we've been passed the wrong data.

View File

@ -2305,7 +2305,7 @@ class LibvirtDriver(driver.ComputeDriver):
# for xenapi(tr3buchet)
def spawn(self, context, instance, image_meta, injected_files,
admin_password, network_info=None, block_device_info=None,
instance_type=None):
flavor=None):
disk_info = blockinfo.get_disk_info(CONF.libvirt.virt_type,
instance,
block_device_info,

View File

@ -481,7 +481,7 @@ class VMwareVCDriver(driver.ComputeDriver):
def spawn(self, context, instance, image_meta, injected_files,
admin_password, network_info=None, block_device_info=None,
instance_type=None):
flavor=None):
"""Create VM instance."""
_vmops = self._get_vmops_for_compute_node(instance['node'])
_vmops.spawn(context, instance, image_meta, injected_files,

View File

@ -187,7 +187,7 @@ class XenAPIDriver(driver.ComputeDriver):
def spawn(self, context, instance, image_meta, injected_files,
admin_password, network_info=None, block_device_info=None,
instance_type=None):
flavor=None):
"""Create VM instance."""
self._vmops.spawn(context, instance, image_meta, injected_files,
admin_password, network_info, block_device_info)