Update taskflow instantiation

This updates all tasks to use the name kwarg on instantiation. It also
adds tests to validate the instantiation arguments.

Change-Id: I29d0a5d9764de4db00bdfc01e939572c88b53b62
This commit is contained in:
esberglu
2018-02-27 15:24:36 -06:00
parent cc7564549a
commit 7270fed561
10 changed files with 194 additions and 36 deletions

View File

@@ -37,6 +37,11 @@ class TestImage(test.NoDBTestCase):
expected_state='expected_state')
tf.execute()
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tsk_img.UpdateTaskState(func, 'task_state')
tf.assert_called_once_with(name='update_task_state_task_state')
@mock.patch('nova_powervm.virt.powervm.image.stream_blockdev_to_glance',
autospec=True)
@mock.patch('nova_powervm.virt.powervm.image.snapshot_metadata',
@@ -53,3 +58,10 @@ class TestImage(test.NoDBTestCase):
mock_inst)
mock_stream.assert_called_with('context', 'image_api', 'image_id',
'metadata', 'disk_path')
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tsk_img.StreamToGlance('context', 'image_api', 'image_id',
mock_inst)
tf.assert_called_once_with(name='stream_to_glance',
requires='disk_path')

View File

@@ -84,6 +84,12 @@ class TestNetwork(test.NoDBTestCase):
# code was called
self.assertEqual(3, mock_unplug.call_count)
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_net.UnplugVifs(self.apt, inst, net_info, 'host_uuid',
'slot_mgr')
tf.assert_called_once_with(name='unplug_vifs', requires=['lpar_wrap'])
def test_unplug_vifs_invalid_state(self):
"""Tests that the delete raises an exception if bad VM state."""
inst = objects.Instance(**powervm.TEST_INSTANCE)
@@ -147,6 +153,13 @@ class TestNetwork(test.NoDBTestCase):
# created.
self.assertEqual(pre_cnas + [mock_new_cna], all_cnas)
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_net.PlugVifs(mock.MagicMock(), self.apt, inst, net_info,
'host_uuid', 'slot_mgr')
tf.assert_called_once_with(name='plug_vifs', provides='vm_cnas',
requires=['lpar_wrap'])
@mock.patch('nova_powervm.virt.powervm.vif.plug', autospec=True)
@mock.patch('nova_powervm.virt.powervm.vm.get_cnas', autospec=True)
def test_plug_vifs_rmc_no_create(self, mock_vm_get, mock_plug):
@@ -377,6 +390,12 @@ class TestNetwork(test.NoDBTestCase):
self.assertEqual(0, mock_vm_get.call_count)
self.assertEqual(0, mock_plug_rmc_vif.call_count)
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_net.PlugMgmtVif(self.apt, inst, 'host_uuid', 'slot_mgr')
tf.assert_called_once_with(name='plug_mgmt_vif', provides='mgmt_cna',
requires=['vm_cnas'])
def test_get_vif_events(self):
# Set up common mocks.
inst = objects.Instance(**powervm.TEST_INSTANCE)

View File

@@ -1,4 +1,4 @@
# Copyright 2016, 2017 IBM Corp.
# Copyright 2016, 2018 IBM Corp.
#
# All Rights Reserved.
#
@@ -32,6 +32,11 @@ class TestSaveSlotStore(test.NoDBTestCase):
save.execute()
slot_mgr.save.assert_called_once_with()
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
slot.SaveSlotStore(mock.MagicMock(), slot_mgr)
tf.assert_called_once_with(name='save_slot_store')
class TestDeleteSlotStore(test.NoDBTestCase):
@@ -43,3 +48,8 @@ class TestDeleteSlotStore(test.NoDBTestCase):
delete = slot.DeleteSlotStore(mock.MagicMock(), slot_mgr)
delete.execute()
slot_mgr.delete.assert_called_once_with()
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
slot.DeleteSlotStore(mock.MagicMock(), slot_mgr)
tf.assert_called_once_with(name='delete_slot_store')

View File

@@ -80,6 +80,14 @@ class TestStorage(test.NoDBTestCase):
task.revert(lpar_w, 'mgmt_cna', 'result', 'flow_failures')
self.mock_mb.assert_not_called()
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_stg.CreateAndConnectCfgDrive(
self.adapter, self.instance, 'injected_files', 'network_info',
'admin_pass')
tf.assert_called_once_with(name='cfg_drive', requires=['lpar_wrap',
'mgmt_cna'])
@mock.patch('nova_powervm.virt.powervm.vm.get_pvm_uuid', autospec=True)
def test_delete_vopt(self, mock_pvm_uuid):
# Test with no FeedTask
@@ -101,6 +109,11 @@ class TestStorage(test.NoDBTestCase):
self.mock_mb.dlt_vopt.assert_called_once_with(
'pvm_uuid', stg_ftsk='ftsk')
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_stg.DeleteVOpt(self.adapter, self.instance)
tf.assert_called_once_with(name='vopt_delete')
def test_delete_disk(self):
stor_adpt_mappings = mock.Mock()
@@ -108,6 +121,12 @@ class TestStorage(test.NoDBTestCase):
task.execute(stor_adpt_mappings)
self.disk_dvr.delete_disks.assert_called_once_with(stor_adpt_mappings)
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_stg.DeleteDisk(self.disk_dvr, self.instance)
tf.assert_called_once_with(
name='dlt_storage', requires=['stor_adpt_mappings'])
def test_detach_disk(self):
disk_type = 'disk_type'
stg_ftsk = mock.Mock()
@@ -119,6 +138,12 @@ class TestStorage(test.NoDBTestCase):
self.disk_dvr.disconnect_disk.assert_called_once_with(
self.instance, stg_ftsk=stg_ftsk, disk_type=disk_type)
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_stg.DetachDisk(self.disk_dvr, self.instance)
tf.assert_called_once_with(
name='detach_storage', provides='stor_adpt_mappings')
def test_connect_disk(self):
stg_ftsk = mock.Mock()
disk_dev_info = mock.Mock()
@@ -132,6 +157,12 @@ class TestStorage(test.NoDBTestCase):
task.revert(disk_dev_info, 'result', 'flow failures')
self.disk_dvr.disconnect_disk.assert_called_once_with(self.instance)
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_stg.ConnectDisk(self.disk_dvr, self.instance)
tf.assert_called_once_with(
name='connect_disk', requires=['disk_dev_info'])
def test_create_disk_for_img(self):
image_meta = mock.Mock()
image_type = mock.Mock()
@@ -146,6 +177,13 @@ class TestStorage(test.NoDBTestCase):
task.revert('result', 'flow failures')
self.disk_dvr.delete_disks.assert_called_once_with(['result'])
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_stg.CreateDiskForImg(
self.disk_dvr, self.context, self.instance, image_meta)
tf.assert_called_once_with(
name='crt_disk_from_img', provides='disk_dev_info')
@mock.patch('pypowervm.tasks.scsi_mapper.find_maps', autospec=True)
@mock.patch('nova_powervm.virt.powervm.mgmt.discover_vscsi_disk',
autospec=True)
@@ -254,6 +292,13 @@ class TestStorage(test.NoDBTestCase):
self.assertEqual(0, disk_dvr.disconnect_disk_from_mgmt.call_count)
self.assertEqual(0, mock_rm.call_count)
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_stg.InstanceDiskToMgmt(disk_dvr, mock_instance)
tf.assert_called_once_with(
name='connect_and_discover_instance_disk_to_mgmt',
provides=['stg_elem', 'vios_wrap', 'disk_path'])
@mock.patch('nova_powervm.virt.powervm.mgmt.remove_block_dev',
autospec=True)
def test_remove_instance_disk_from_mgmt(self, mock_rm):
@@ -273,6 +318,13 @@ class TestStorage(test.NoDBTestCase):
'stg_name')
mock_rm.assert_called_with('/dev/disk')
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_stg.RemoveInstanceDiskFromMgmt(disk_dvr, mock_instance)
tf.assert_called_once_with(
name='remove_inst_disk_from_mgmt',
requires=['stg_elem', 'vios_wrap', 'disk_path'])
def test_finddisk(self):
disk_dvr = mock.Mock()
disk_dvr.get_disk_ref.return_value = 'disk_ref'
@@ -292,6 +344,11 @@ class TestStorage(test.NoDBTestCase):
disk_dvr.get_disk_ref.assert_called_once_with(instance, disk_type)
self.assertIsNone(ret_disk)
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_stg.FindDisk(disk_dvr, context, instance, disk_type)
tf.assert_called_once_with(name='find_disk', provides='disk_dev_info')
def test_extend_disk(self):
disk_dvr = mock.Mock()
instance = mock.Mock()
@@ -301,6 +358,11 @@ class TestStorage(test.NoDBTestCase):
task.execute()
disk_dvr.extend_disk.assert_called_once_with(instance, disk_info, 1024)
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_stg.ExtendDisk(disk_dvr, instance, disk_info, 1024)
tf.assert_called_once_with(name='extend_disk_disk_type')
def test_connect_volume(self):
vol_dvr = mock.Mock(connection_info={'data': {'volume_id': '1'}})
@@ -312,6 +374,11 @@ class TestStorage(test.NoDBTestCase):
vol_dvr.reset_stg_ftsk.assert_called_once_with()
vol_dvr.disconnect_volume.assert_called_once_with('slot map')
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_stg.ConnectVolume(vol_dvr, 'slot map')
tf.assert_called_once_with(name='connect_vol_1')
def test_disconnect_volume(self):
vol_dvr = mock.Mock(connection_info={'data': {'volume_id': '1'}})
@@ -322,3 +389,8 @@ class TestStorage(test.NoDBTestCase):
task.revert('result', 'flow failures')
vol_dvr.reset_stg_ftsk.assert_called_once_with()
vol_dvr.connect_volume.assert_called_once_with('slot map')
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_stg.DisconnectVolume(vol_dvr, 'slot map')
tf.assert_called_once_with(name='disconnect_vol_1')

View File

@@ -72,6 +72,11 @@ class TestVMTasks(test.NoDBTestCase):
rcrt.execute()
mock_ftsk.execute.assert_called_once_with()
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_vm.Create(self.apt, 'host_wrapper', self.instance)
tf.assert_called_once_with(name='crt_vm', provides='lpar_wrap')
@mock.patch('nova_powervm.virt.powervm.vm.get_pvm_uuid', autospec=True)
@mock.patch('nova_powervm.virt.powervm.tasks.vm.Create.execute',
autospec=True)
@@ -103,6 +108,11 @@ class TestVMTasks(test.NoDBTestCase):
pwron.execute()
mock_pwron.assert_called_once_with(self.apt, self.instance, opts='opt')
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_vm.PowerOn(self.apt, self.instance)
tf.assert_called_once_with(name='pwr_vm')
@mock.patch('nova_powervm.virt.powervm.vm.power_on', autospec=True)
@mock.patch('nova_powervm.virt.powervm.vm.power_off', autospec=True)
def test_power_on_revert(self, mock_pwroff, mock_pwron):
@@ -146,12 +156,22 @@ class TestVMTasks(test.NoDBTestCase):
mock_pwroff.assert_called_once_with(self.apt, self.instance,
force_immediate=True)
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_vm.PowerOff(self.apt, self.instance)
tf.assert_called_once_with(name='pwr_off_vm')
@mock.patch('nova_powervm.virt.powervm.vm.delete_lpar', autospec=True)
def test_delete(self, mock_dlt):
delete = tf_vm.Delete(self.apt, self.instance)
delete.execute()
mock_dlt.assert_called_once_with(self.apt, self.instance)
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_vm.Delete(self.apt, self.instance)
tf.assert_called_once_with(name='dlt_vm')
@mock.patch('nova_powervm.virt.powervm.vm.update', autospec=True)
def test_resize(self, mock_vm_update):
@@ -164,6 +184,11 @@ class TestVMTasks(test.NoDBTestCase):
name='new_name')
self.assertEqual('resized_entry', resized_entry)
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_vm.Resize(self.apt, 'host_wrapper', self.instance)
tf.assert_called_once_with(name='resize_vm', provides='lpar_wrap')
@mock.patch('nova_powervm.virt.powervm.vm.rename', autospec=True)
def test_rename(self, mock_vm_rename):
mock_vm_rename.return_value = 'new_entry'
@@ -173,6 +198,12 @@ class TestVMTasks(test.NoDBTestCase):
self.apt, self.instance, 'new_name')
self.assertEqual('new_entry', new_entry)
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_vm.Rename(self.apt, self.instance, 'new_name')
tf.assert_called_once_with(
name='rename_vm_new_name', provides='lpar_wrap')
def test_store_nvram(self):
nvram_mgr = mock.Mock()
store_nvram = tf_vm.StoreNvram(nvram_mgr, self.instance,
@@ -188,6 +219,11 @@ class TestVMTasks(test.NoDBTestCase):
nvram_mgr.store.assert_called_once_with(self.instance,
immediate=True)
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_vm.StoreNvram(nvram_mgr, self.instance)
tf.assert_called_once_with(name='store_nvram')
def test_delete_nvram(self):
nvram_mgr = mock.Mock()
delete_nvram = tf_vm.DeleteNvram(nvram_mgr, self.instance)
@@ -199,3 +235,8 @@ class TestVMTasks(test.NoDBTestCase):
nvram_mgr.remove.side_effect = ValueError('Not Available')
delete_nvram.execute()
nvram_mgr.remove.assert_called_once_with(self.instance)
# Validate args on taskflow.task.Task instantiation
with mock.patch('taskflow.task.Task.__init__') as tf:
tf_vm.DeleteNvram(nvram_mgr, self.instance)
tf.assert_called_once_with(name='delete_nvram')

View File

@@ -1,4 +1,4 @@
# Copyright 2015, 2017 IBM Corp.
# Copyright 2015, 2018 IBM Corp.
#
# All Rights Reserved.
#
@@ -68,7 +68,7 @@ class StreamToGlance(task.Task):
self.image_api = image_api
self.image_id = image_id
self.instance = instance
super(StreamToGlance, self).__init__('stream_to_glance',
super(StreamToGlance, self).__init__(name='stream_to_glance',
requires='disk_path')
def execute(self, disk_path):

View File

@@ -53,7 +53,8 @@ class UnplugVifs(task.Task):
self.slot_mgr = slot_mgr
self.instance = instance
super(UnplugVifs, self).__init__('unplug_vifs', requires=['lpar_wrap'])
super(UnplugVifs, self).__init__(
name='unplug_vifs', requires=['lpar_wrap'])
def execute(self, lpar_wrap):
# If the state is not in an OK state for deleting, then throw an
@@ -106,7 +107,7 @@ class PlugVifs(task.Task):
self.cnas, self.vnics = None, None
self.instance = instance
super(PlugVifs, self).__init__('plug_vifs', provides='vm_cnas',
super(PlugVifs, self).__init__(name='plug_vifs', provides='vm_cnas',
requires=['lpar_wrap'])
def _vif_exists(self, network_info):
@@ -270,8 +271,8 @@ class PlugMgmtVif(task.Task):
self.slot_mgr = slot_mgr
self.instance = instance
super(PlugMgmtVif, self).__init__('plug_mgmt_vif', provides='mgmt_cna',
requires=['vm_cnas'])
super(PlugMgmtVif, self).__init__(
name='plug_mgmt_vif', provides='mgmt_cna', requires=['vm_cnas'])
def execute(self, vm_cnas):
# If configured to not use RMC mgmt vifs, then return None. Need to

View File

@@ -1,4 +1,4 @@
# Copyright 2016, 2017 IBM Corp.
# Copyright 2016, 2018 IBM Corp.
#
# All Rights Reserved.
#
@@ -40,7 +40,7 @@ class SaveSlotStore(task.Task):
"""
self.slot_mgr = slot_mgr
self.instance = instance
super(SaveSlotStore, self).__init__('save_slot_store')
super(SaveSlotStore, self).__init__(name='save_slot_store')
def execute(self):
LOG.debug("Topology: %(topo)s", {'topo': self.slot_mgr.topology},
@@ -65,7 +65,7 @@ class DeleteSlotStore(task.Task):
"""
self.slot_mgr = slot_mgr
self.instance = instance
super(DeleteSlotStore, self).__init__('delete_slot_store')
super(DeleteSlotStore, self).__init__(name='delete_slot_store')
def execute(self):
self.slot_mgr.delete()

View File

@@ -1,4 +1,4 @@
# Copyright 2015, 2017 IBM Corp.
# Copyright 2015, 2018 IBM Corp.
#
# All Rights Reserved.
#
@@ -46,7 +46,8 @@ class ConnectVolume(task.Task):
self.vol_id = self.vol_drv.connection_info['data']['volume_id']
self.slot_mgr = slot_mgr
super(ConnectVolume, self).__init__('connect_vol_%s' % self.vol_id)
super(ConnectVolume, self).__init__(
name='connect_vol_%s' % self.vol_id)
def execute(self):
LOG.info('Connecting volume %(vol)s.', {'vol': self.vol_id},
@@ -92,7 +93,7 @@ class DisconnectVolume(task.Task):
self.slot_mgr = slot_mgr
super(DisconnectVolume, self).__init__(
'disconnect_vol_%s' % self.vol_id)
name='disconnect_vol_%s' % self.vol_id)
def execute(self):
LOG.info('Disconnecting volume %(vol)s.',
@@ -141,7 +142,7 @@ class CreateDiskForImg(task.Task):
:param image_type: The image type. See disk/driver.py
"""
super(CreateDiskForImg, self).__init__(
'crt_disk_from_img', provides='disk_dev_info')
name='crt_disk_from_img', provides='disk_dev_info')
self.disk_dvr = disk_dvr
self.context = context
self.instance = instance
@@ -183,7 +184,7 @@ class ConnectDisk(task.Task):
the FeedTask is not provided, the updates will be run
immediately when the respective method is executed.
"""
super(ConnectDisk, self).__init__('connect_disk',
super(ConnectDisk, self).__init__(name='connect_disk',
requires=['disk_dev_info'])
self.disk_dvr = disk_dvr
self.instance = instance
@@ -222,7 +223,7 @@ class InstanceDiskToMgmt(task.Task):
:param instance: The nova instance whose boot disk is to be connected.
"""
super(InstanceDiskToMgmt, self).__init__(
'connect_and_discover_instance_disk_to_mgmt',
name='connect_and_discover_instance_disk_to_mgmt',
provides=['stg_elem', 'vios_wrap', 'disk_path'])
self.disk_dvr = disk_dvr
self.instance = instance
@@ -306,7 +307,7 @@ class RemoveInstanceDiskFromMgmt(task.Task):
self.disk_dvr = disk_dvr
self.instance = instance
super(RemoveInstanceDiskFromMgmt, self).__init__(
'remove_inst_disk_from_mgmt',
name='remove_inst_disk_from_mgmt',
requires=['stg_elem', 'vios_wrap', 'disk_path'])
def execute(self, stg_elem, vios_wrap, disk_path):
@@ -360,7 +361,7 @@ class CreateAndConnectCfgDrive(task.Task):
immediately when the respective method is executed.
"""
super(CreateAndConnectCfgDrive, self).__init__(
'cfg_drive', requires=['lpar_wrap', 'mgmt_cna'])
name='cfg_drive', requires=['lpar_wrap', 'mgmt_cna'])
self.adapter = adapter
self.instance = instance
self.injected_files = injected_files
@@ -408,7 +409,7 @@ class DeleteVOpt(task.Task):
the FeedTask is not provided, the updates will be run
immediately when the respective method is executed.
"""
super(DeleteVOpt, self).__init__('vopt_delete')
super(DeleteVOpt, self).__init__(name='vopt_delete')
self.adapter = adapter
self.instance = instance
self.stg_ftsk = stg_ftsk
@@ -440,7 +441,7 @@ class DetachDisk(task.Task):
:param disk_type: List of disk types to detach. None means detach all.
"""
super(DetachDisk, self).__init__(
'detach_storage', provides='stor_adpt_mappings')
name='detach_storage', provides='stor_adpt_mappings')
self.disk_dvr = disk_dvr
self.instance = instance
self.stg_ftsk = stg_ftsk
@@ -463,8 +464,8 @@ class DeleteDisk(task.Task):
:param disk_dvr: The DiskAdapter for the VM.
:param instance: The nova instance.
"""
req = ['stor_adpt_mappings']
super(DeleteDisk, self).__init__('dlt_storage', requires=req)
super(DeleteDisk, self).__init__(
name='dlt_storage', requires=['stor_adpt_mappings'])
self.disk_dvr = disk_dvr
def execute(self, stor_adpt_mappings):
@@ -483,7 +484,7 @@ class SaveBDM(task.Task):
"""
self.bdm = bdm
self.instance = instance
super(SaveBDM, self).__init__('save_bdm_%s' % self.bdm.volume_id)
super(SaveBDM, self).__init__(name='save_bdm_%s' % self.bdm.volume_id)
def execute(self):
LOG.info('Saving block device mapping for volume id %(vol_id)s.',
@@ -506,7 +507,8 @@ class FindDisk(task.Task):
:param instance: The nova instance.
:param disk_type: One of the DiskType enum values.
"""
super(FindDisk, self).__init__('find_disk', provides='disk_dev_info')
super(FindDisk, self).__init__(
name='find_disk', provides='disk_dev_info')
self.disk_dvr = disk_dvr
self.context = context
self.instance = instance
@@ -539,7 +541,8 @@ class ExtendDisk(task.Task):
self.instance = instance
self.disk_info = disk_info
self.size = size
super(ExtendDisk, self).__init__('extend_disk_%s' % disk_info['type'])
super(ExtendDisk, self).__init__(
name='extend_disk_%s' % disk_info['type'])
def execute(self):
LOG.info('Extending %(disk_type)s disk to %(size)s GB.',

View File

@@ -1,4 +1,4 @@
# Copyright 2015, 2017 IBM Corp.
# Copyright 2015, 2018 IBM Corp.
#
# All Rights Reserved.
#
@@ -41,7 +41,7 @@ class Get(task.Task):
:param host_uuid: The host UUID
:param instance: The nova instance.
"""
super(Get, self).__init__('get_vm', provides='lpar_wrap')
super(Get, self).__init__(name='get_vm', provides='lpar_wrap')
self.adapter = adapter
self.host_uuid = host_uuid
self.instance = instance
@@ -85,7 +85,7 @@ class Create(task.Task):
:param slot_mgr: A NovaSlotManager. Used to store/retrieve the
maximum number of virtual slots for the VM.
"""
super(Create, self).__init__('crt_vm', provides='lpar_wrap')
super(Create, self).__init__(name='crt_vm', provides='lpar_wrap')
self.adapter = adapter
self.host_wrapper = host_wrapper
self.instance = instance
@@ -144,7 +144,7 @@ class Resize(task.Task):
:param name: VM name to use for the update. Used on resize when we
want to rename it but not use the instance name.
"""
super(Resize, self).__init__('resize_vm', provides='lpar_wrap')
super(Resize, self).__init__(name='resize_vm', provides='lpar_wrap')
self.adapter = adapter
self.host_wrapper = host_wrapper
self.instance = instance
@@ -168,7 +168,7 @@ class Rename(task.Task):
:param instance: The nova instance.
:param name: The new VM name.
"""
super(Rename, self).__init__('rename_vm_%s' % name,
super(Rename, self).__init__(name='rename_vm_%s' % name,
provides='lpar_wrap')
self.adapter = adapter
self.instance = instance
@@ -191,7 +191,7 @@ class PowerOn(task.Task):
:param instance: The nova instance.
:param pwr_opts: Additional parameters for the pypowervm PowerOn Job.
"""
super(PowerOn, self).__init__('pwr_vm')
super(PowerOn, self).__init__(name='pwr_vm')
self.adapter = adapter
self.instance = instance
self.pwr_opts = pwr_opts
@@ -222,7 +222,7 @@ class PowerOff(task.Task):
:param instance: The nova instance.
:param force_immediate: Boolean. Perform a VSP hard power off.
"""
super(PowerOff, self).__init__('pwr_off_vm')
super(PowerOff, self).__init__(name='pwr_off_vm')
self.adapter = adapter
self.instance = instance
self.force_immediate = force_immediate
@@ -243,7 +243,7 @@ class StoreNvram(task.Task):
:param instance: The nova instance.
:param immediate: boolean whether to update the NVRAM immediately
"""
super(StoreNvram, self).__init__('store_nvram')
super(StoreNvram, self).__init__(name='store_nvram')
self.nvram_mgr = nvram_mgr
self.instance = instance
self.immediate = immediate
@@ -268,7 +268,7 @@ class DeleteNvram(task.Task):
:param nvram_mgr: The NVRAM manager.
:param instance: The nova instance.
"""
super(DeleteNvram, self).__init__('delete_nvram')
super(DeleteNvram, self).__init__(name='delete_nvram')
self.nvram_mgr = nvram_mgr
self.instance = instance
@@ -294,7 +294,7 @@ class Delete(task.Task):
:param adapter: The adapter for the pypowervm API.
:param instance: The nova instance.
"""
super(Delete, self).__init__('dlt_vm')
super(Delete, self).__init__(name='dlt_vm')
self.adapter = adapter
self.instance = instance
@@ -313,7 +313,7 @@ class UpdateIBMiSettings(task.Task):
:param instance: The nova instance.
:param boot_type: The boot type of the instance.
"""
super(UpdateIBMiSettings, self).__init__('update_ibmi_settings')
super(UpdateIBMiSettings, self).__init__(name='update_ibmi_settings')
self.adapter = adapter
self.instance = instance
self.boot_type = boot_type