fix typos when call guest soft stop

The correct API name should be "guest_softstop" in driver.power_off
method.

Change-Id: Ide9b29b53179df8192f441d784a97ed9eaa7fecd
This commit is contained in:
Huang Rui 2017-12-27 10:54:24 +08:00
parent 73eb5e857d
commit 56ce25c969
2 changed files with 7 additions and 6 deletions

View File

@ -452,9 +452,9 @@ class TestZVMDriver(test.NoDBTestCase):
@mock.patch('nova_zvm.virt.zvm.driver.ZVMDriver._instance_power_action')
def test_power_off(self, ipa):
self.driver.power_off(self._instance)
ipa.assert_called_once_with(self._instance, 'guest_softoff')
ipa.assert_called_once_with(self._instance, 'guest_softstop')
self.driver.power_off(self._instance, 60, 10)
ipa.assert_any_call(self._instance, 'guest_softoff',
ipa.assert_any_call(self._instance, 'guest_softstop',
timeout=60, poll_interval=10)
@mock.patch('nova_zvm.virt.zvm.driver.ZVMDriver._instance_power_action')

View File

@ -373,8 +373,9 @@ class ZVMDriver(driver.ComputeDriver):
def _instance_power_action(self, instance, action, *args, **kwargs):
inst_name = instance['name']
if self._instance_exists(inst_name):
LOG.info(_("Power action %(action)s to instance %(inst_name)s"),
action=action, inst_name=inst_name, instance=instance)
LOG.info(_("Power action %(action)s to instance %(inst_name)s") %
{'action': action, 'inst_name': inst_name},
instance=instance)
self._reqh.call(action, inst_name)
else:
LOG.warning(_('Instance %s does not exist'), inst_name,
@ -383,11 +384,11 @@ class ZVMDriver(driver.ComputeDriver):
def power_off(self, instance, timeout=0, retry_interval=0):
"""Power off the specified instance."""
if timeout >= 0 and retry_interval > 0:
self._instance_power_action(instance, 'guest_softoff',
self._instance_power_action(instance, 'guest_softstop',
timeout=timeout,
poll_interval=retry_interval)
else:
self._instance_power_action(instance, 'guest_softoff')
self._instance_power_action(instance, 'guest_softstop')
def power_on(self, context, instance, network_info,
block_device_info=None):