attach/detach_volume() take instance as a parameter
Previously the methods take instance['name'] as a parameter. With this change, ComputeDriver can lookup informations about the instance from hypervisor (in bare-metal driver, it is a local DB) by any other attributes of the instance. blueprint general-bare-metal-provisioning-framework Change-Id: Ibd0567f34ed5053909ce1a408f9cbf87516ba597
This commit is contained in:
@@ -508,7 +508,7 @@ class HyperVAPITestCase(basetestcase.BaseTestCase):
|
|||||||
self._volume_target_portal, self._volume_id)
|
self._volume_target_portal, self._volume_id)
|
||||||
|
|
||||||
self._conn.attach_volume(connection_info,
|
self._conn.attach_volume(connection_info,
|
||||||
self._instance_data["name"], '/dev/sdc')
|
self._instance_data, '/dev/sdc')
|
||||||
|
|
||||||
def test_attach_volume(self):
|
def test_attach_volume(self):
|
||||||
self._attach_volume()
|
self._attach_volume()
|
||||||
@@ -527,7 +527,7 @@ class HyperVAPITestCase(basetestcase.BaseTestCase):
|
|||||||
self._volume_target_portal, self._volume_id)
|
self._volume_target_portal, self._volume_id)
|
||||||
|
|
||||||
self._conn.detach_volume(connection_info,
|
self._conn.detach_volume(connection_info,
|
||||||
self._instance_data["name"], '/dev/sdc')
|
self._instance_data, '/dev/sdc')
|
||||||
|
|
||||||
(_, volumes_paths, _) = self._hypervutils.get_vm_disks(
|
(_, volumes_paths, _) = self._hypervutils.get_vm_disks(
|
||||||
self._instance_data["name"])
|
self._instance_data["name"])
|
||||||
|
@@ -1707,8 +1707,8 @@ class LibvirtConnTestCase(test.TestCase):
|
|||||||
self.assertRaises(exception.VolumeDriverNotFound,
|
self.assertRaises(exception.VolumeDriverNotFound,
|
||||||
conn.attach_volume,
|
conn.attach_volume,
|
||||||
{"driver_volume_type": "badtype"},
|
{"driver_volume_type": "badtype"},
|
||||||
"fake",
|
{"name": "fake-instance"},
|
||||||
"/dev/fake")
|
"/dev/fake")
|
||||||
|
|
||||||
def test_multi_nic(self):
|
def test_multi_nic(self):
|
||||||
instance_data = dict(self.test_instance)
|
instance_data = dict(self.test_instance)
|
||||||
|
@@ -379,10 +379,10 @@ class _VirtDriverTestCase(_FakeDriverBackendTestCase):
|
|||||||
def test_attach_detach_volume(self):
|
def test_attach_detach_volume(self):
|
||||||
instance_ref, network_info = self._get_running_instance()
|
instance_ref, network_info = self._get_running_instance()
|
||||||
self.connection.attach_volume({'driver_volume_type': 'fake'},
|
self.connection.attach_volume({'driver_volume_type': 'fake'},
|
||||||
instance_ref['name'],
|
instance_ref,
|
||||||
'/mnt/nova/something')
|
'/mnt/nova/something')
|
||||||
self.connection.detach_volume({'driver_volume_type': 'fake'},
|
self.connection.detach_volume({'driver_volume_type': 'fake'},
|
||||||
instance_ref['name'],
|
instance_ref,
|
||||||
'/mnt/nova/something')
|
'/mnt/nova/something')
|
||||||
|
|
||||||
@catch_notimplementederror
|
@catch_notimplementederror
|
||||||
@@ -390,11 +390,11 @@ class _VirtDriverTestCase(_FakeDriverBackendTestCase):
|
|||||||
instance_ref, network_info = self._get_running_instance()
|
instance_ref, network_info = self._get_running_instance()
|
||||||
self.connection.power_off(instance_ref)
|
self.connection.power_off(instance_ref)
|
||||||
self.connection.attach_volume({'driver_volume_type': 'fake'},
|
self.connection.attach_volume({'driver_volume_type': 'fake'},
|
||||||
instance_ref['name'],
|
instance_ref,
|
||||||
'/mnt/nova/something')
|
'/mnt/nova/something')
|
||||||
self.connection.power_on(instance_ref)
|
self.connection.power_on(instance_ref)
|
||||||
self.connection.detach_volume({'driver_volume_type': 'fake'},
|
self.connection.detach_volume({'driver_volume_type': 'fake'},
|
||||||
instance_ref['name'],
|
instance_ref,
|
||||||
'/mnt/nova/something')
|
'/mnt/nova/something')
|
||||||
|
|
||||||
@catch_notimplementederror
|
@catch_notimplementederror
|
||||||
|
@@ -271,7 +271,7 @@ class XenAPIVolumeTestCase(stubs.XenAPITestBase):
|
|||||||
instance = db.instance_create(self.context, self.instance_values)
|
instance = db.instance_create(self.context, self.instance_values)
|
||||||
vm = xenapi_fake.create_vm(instance['name'], 'Running')
|
vm = xenapi_fake.create_vm(instance['name'], 'Running')
|
||||||
result = conn.attach_volume(self._make_connection_info(),
|
result = conn.attach_volume(self._make_connection_info(),
|
||||||
instance['name'], '/dev/sdc')
|
instance, '/dev/sdc')
|
||||||
|
|
||||||
# check that the VM has a VBD attached to it
|
# check that the VM has a VBD attached to it
|
||||||
# Get XenAPI record for VBD
|
# Get XenAPI record for VBD
|
||||||
@@ -290,7 +290,7 @@ class XenAPIVolumeTestCase(stubs.XenAPITestBase):
|
|||||||
self.assertRaises(exception.VolumeDriverNotFound,
|
self.assertRaises(exception.VolumeDriverNotFound,
|
||||||
conn.attach_volume,
|
conn.attach_volume,
|
||||||
{'driver_volume_type': 'nonexist'},
|
{'driver_volume_type': 'nonexist'},
|
||||||
instance['name'],
|
instance,
|
||||||
'/dev/sdc')
|
'/dev/sdc')
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user