make PowerVM capabilities explicit
Upcoming PowerVM driver changes will introduce support for some capabilities. In preparation for those changes, this makes capabilities explicit in the driver rather than inheriting defaults from the parent class. This is consistent with other drivers. Change-Id: Id42eed5e555c0dbedb220dcfcfd977b02a546156
This commit is contained in:
parent
ef4000a0d3
commit
1f44fde35e
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2016, 2017 IBM Corp.
|
||||
# Copyright 2016, 2018 IBM Corp.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
|
@ -26,6 +26,7 @@ from pypowervm.wrappers import virtual_io_server as pvm_vios
|
|||
from nova import exception
|
||||
from nova import test
|
||||
from nova.tests.unit.virt import powervm
|
||||
from nova.virt.driver import ComputeDriver
|
||||
from nova.virt import hardware
|
||||
from nova.virt.powervm.disk import ssp
|
||||
from nova.virt.powervm import driver
|
||||
|
@ -50,6 +51,25 @@ class TestPowerVMDriver(test.NoDBTestCase):
|
|||
# Create an instance to test with
|
||||
self.inst = powervm.TEST_INSTANCE
|
||||
|
||||
def test_driver_capabilities(self):
|
||||
"""Test the driver capabilities."""
|
||||
# check that the driver reports all capabilities
|
||||
self.assertEqual(set(ComputeDriver.capabilities),
|
||||
set(self.drv.capabilities))
|
||||
# check the values for each capability
|
||||
self.assertFalse(self.drv.capabilities['has_imagecache'])
|
||||
self.assertFalse(self.drv.capabilities['supports_recreate'])
|
||||
self.assertFalse(
|
||||
self.drv.capabilities['supports_migrate_to_same_host'])
|
||||
self.assertFalse(self.drv.capabilities['supports_attach_interface'])
|
||||
self.assertFalse(self.drv.capabilities['supports_device_tagging'])
|
||||
self.assertFalse(
|
||||
self.drv.capabilities['supports_tagged_attach_interface'])
|
||||
self.assertFalse(
|
||||
self.drv.capabilities['supports_tagged_attach_volume'])
|
||||
self.assertFalse(self.drv.capabilities['supports_extend_volume'])
|
||||
self.assertFalse(self.drv.capabilities['supports_multiattach'])
|
||||
|
||||
@mock.patch('nova.image.API')
|
||||
@mock.patch('pypowervm.tasks.storage.ComprehensiveScrub', autospec=True)
|
||||
@mock.patch('nova.virt.powervm.disk.ssp.SSPDiskAdapter')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2014, 2017 IBM Corp.
|
||||
# Copyright 2014, 2018 IBM Corp.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
|
@ -52,6 +52,19 @@ class PowerVMDriver(driver.ComputeDriver):
|
|||
"""
|
||||
|
||||
def __init__(self, virtapi):
|
||||
# NOTE(edmondsw) some of these will be dynamic in future, so putting
|
||||
# capabilities on the instance rather than on the class.
|
||||
self.capabilities = {
|
||||
'has_imagecache': False,
|
||||
'supports_recreate': False,
|
||||
'supports_migrate_to_same_host': False,
|
||||
'supports_attach_interface': False,
|
||||
'supports_device_tagging': False,
|
||||
'supports_tagged_attach_interface': False,
|
||||
'supports_tagged_attach_volume': False,
|
||||
'supports_extend_volume': False,
|
||||
'supports_multiattach': False,
|
||||
}
|
||||
super(PowerVMDriver, self).__init__(virtapi)
|
||||
|
||||
def init_host(self, host):
|
||||
|
|
Loading…
Reference in New Issue