summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorArata Notsu <notsu@virtualtech.jp>2012-12-20 21:29:13 +0900
committerArata Notsu <notsu@virtualtech.jp>2013-01-08 18:29:05 +0900
commite6cae13dd21f03948a28088d45be678f6a0e5c4e (patch)
tree7cde1c331abe4788d5e8b2d3f64942cadbffcfa3 /nova/tests
parent7cd22aaca7e62db77753cfaa1c5af4a0344fea0d (diff)
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
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_hypervapi.py4
-rw-r--r--nova/tests/test_libvirt.py4
-rw-r--r--nova/tests/test_virt_drivers.py8
-rw-r--r--nova/tests/test_xenapi.py4
4 files changed, 10 insertions, 10 deletions
diff --git a/nova/tests/test_hypervapi.py b/nova/tests/test_hypervapi.py
index cab877da9..f5713c457 100644
--- a/nova/tests/test_hypervapi.py
+++ b/nova/tests/test_hypervapi.py
@@ -508,7 +508,7 @@ class HyperVAPITestCase(basetestcase.BaseTestCase):
self._volume_target_portal, self._volume_id)
self._conn.attach_volume(connection_info,
- self._instance_data["name"], '/dev/sdc')
+ self._instance_data, '/dev/sdc')
def test_attach_volume(self):
self._attach_volume()
@@ -527,7 +527,7 @@ class HyperVAPITestCase(basetestcase.BaseTestCase):
self._volume_target_portal, self._volume_id)
self._conn.detach_volume(connection_info,
- self._instance_data["name"], '/dev/sdc')
+ self._instance_data, '/dev/sdc')
(_, volumes_paths, _) = self._hypervutils.get_vm_disks(
self._instance_data["name"])
diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py
index 6bc18251f..7464b9728 100644
--- a/nova/tests/test_libvirt.py
+++ b/nova/tests/test_libvirt.py
@@ -1707,8 +1707,8 @@ class LibvirtConnTestCase(test.TestCase):
self.assertRaises(exception.VolumeDriverNotFound,
conn.attach_volume,
{"driver_volume_type": "badtype"},
- "fake",
- "/dev/fake")
+ {"name": "fake-instance"},
+ "/dev/fake")
def test_multi_nic(self):
instance_data = dict(self.test_instance)
diff --git a/nova/tests/test_virt_drivers.py b/nova/tests/test_virt_drivers.py
index 9d9ebcad9..9e9309dfe 100644
--- a/nova/tests/test_virt_drivers.py
+++ b/nova/tests/test_virt_drivers.py
@@ -379,10 +379,10 @@ class _VirtDriverTestCase(_FakeDriverBackendTestCase):
def test_attach_detach_volume(self):
instance_ref, network_info = self._get_running_instance()
self.connection.attach_volume({'driver_volume_type': 'fake'},
- instance_ref['name'],
+ instance_ref,
'/mnt/nova/something')
self.connection.detach_volume({'driver_volume_type': 'fake'},
- instance_ref['name'],
+ instance_ref,
'/mnt/nova/something')
@catch_notimplementederror
@@ -390,11 +390,11 @@ class _VirtDriverTestCase(_FakeDriverBackendTestCase):
instance_ref, network_info = self._get_running_instance()
self.connection.power_off(instance_ref)
self.connection.attach_volume({'driver_volume_type': 'fake'},
- instance_ref['name'],
+ instance_ref,
'/mnt/nova/something')
self.connection.power_on(instance_ref)
self.connection.detach_volume({'driver_volume_type': 'fake'},
- instance_ref['name'],
+ instance_ref,
'/mnt/nova/something')
@catch_notimplementederror
diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py
index 8b57dfef4..02d688a3b 100644
--- a/nova/tests/test_xenapi.py
+++ b/nova/tests/test_xenapi.py
@@ -271,7 +271,7 @@ class XenAPIVolumeTestCase(stubs.XenAPITestBase):
instance = db.instance_create(self.context, self.instance_values)
vm = xenapi_fake.create_vm(instance['name'], 'Running')
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
# Get XenAPI record for VBD
@@ -290,7 +290,7 @@ class XenAPIVolumeTestCase(stubs.XenAPITestBase):
self.assertRaises(exception.VolumeDriverNotFound,
conn.attach_volume,
{'driver_volume_type': 'nonexist'},
- instance['name'],
+ instance,
'/dev/sdc')