Skip to content

Commit

Permalink
Fixes PowerVM spawn failed as missing attr supported_instances
Browse files Browse the repository at this point in the history
During test in a cross-hypervisor environment (KVM+PowerVM), user will run
into an issue during deploying an instance for Power host by PowerVM driver,
though the property "hypervisor_type" for the PowerVM image have been
configured. Since the _update_host_stats of PowerVM driver missing the
attribute "supported_instances".

Fixes bug: 1155498

Change-Id: I81259d153a7b5ae35747e57c53b14e0075d28d78
  • Loading branch information
Fei Long Wang committed Mar 18, 2013
1 parent 31f954b commit ecab528
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
23 changes: 23 additions & 0 deletions nova/tests/test_powervm.py
Expand Up @@ -393,3 +393,26 @@ def test_get_long_resize_name(self):
expected_name = 'rsz__really_long_instance_name_00000001'
result = self.powervm_connection._get_resize_name(inst_name)
self.assertEqual(expected_name, result)

def test_get_host_stats(self):
host_stats = self.powervm_connection.get_host_stats(True)
self.assertIsNotNone(host_stats)
self.assertEquals(host_stats['vcpus'], 8.0)
self.assertEquals(round(host_stats['vcpus_used'], 1), 1.7)
self.assertEquals(host_stats['host_memory_total'], 65536)
self.assertEquals(host_stats['host_memory_free'], 46336)
self.assertEquals(host_stats['disk_total'], 10168)
self.assertEquals(host_stats['disk_used'], 0)
self.assertEquals(host_stats['disk_available'], 10168)
self.assertEquals(host_stats['disk_total'],
host_stats['disk_used'] +
host_stats['disk_available'])

self.assertEquals(host_stats['cpu_info'], ('ppc64', 'powervm', '3940'))
self.assertEquals(host_stats['hypervisor_type'], 'powervm')
self.assertEquals(host_stats['hypervisor_version'], '7.1')

self.assertEquals(host_stats['hypervisor_hostname'], "fake-powervm")
self.assertEquals(host_stats['supported_instances'][0][0], "ppc64")
self.assertEquals(host_stats['supported_instances'][0][1], "powervm")
self.assertEquals(host_stats['supported_instances'][0][2], "hvm")
1 change: 1 addition & 0 deletions nova/virt/powervm/constants.py
Expand Up @@ -30,6 +30,7 @@
POWERVM_CPU_INFO = ('ppc64', 'powervm', '3940')
POWERVM_HYPERVISOR_TYPE = 'powervm'
POWERVM_HYPERVISOR_VERSION = '7.1'
POWERVM_SUPPORTED_INSTANCES = [('ppc64', 'powervm', 'hvm')]

POWERVM_MIN_ROOT_GB = 10

Expand Down
1 change: 1 addition & 0 deletions nova/virt/powervm/operator.py
Expand Up @@ -165,6 +165,7 @@ def _update_host_stats(self):
data['hypervisor_type'] = constants.POWERVM_HYPERVISOR_TYPE
data['hypervisor_version'] = constants.POWERVM_HYPERVISOR_VERSION
data['hypervisor_hostname'] = self._operator.get_hostname()
data['supported_instances'] = constants.POWERVM_SUPPORTED_INSTANCES
data['extres'] = ''

self._host_stats = data
Expand Down

0 comments on commit ecab528

Please sign in to comment.