Remove ugly instance._rescue hack
The XenAPI driver would use _rescue to note when an instance was in the process of being rescued. The existance of this attribute would modify the 'name' property to append '-rescue' to the generated name. Among the problems with it, it wasn't saved anywhere (with resulting code to set it to False being unnecessary) and it led to "magic" code (see instance.name) that was confusing without understanding the hack. Change-Id: I1a91e4efdf69d4c1fba07658419f7bb30b733b5a
This commit is contained in:
@@ -1298,7 +1298,8 @@ class XenAPIAutoDiskConfigTestCase(stubs.XenAPITestBase):
|
||||
vdi_uuid = session.call_xenapi('VDI.get_record', vdi_ref)['uuid']
|
||||
vdis = {'root': {'uuid': vdi_uuid, 'ref': vdi_ref}}
|
||||
|
||||
self.conn._vmops._attach_disks(instance, disk_image_type, vm_ref, vdis)
|
||||
self.conn._vmops._attach_disks(instance, vm_ref, instance['name'],
|
||||
disk_image_type, vdis)
|
||||
|
||||
self.assertEqual(marker["partition_called"], called)
|
||||
|
||||
@@ -1383,7 +1384,8 @@ class XenAPIGenerateLocal(stubs.XenAPITestBase):
|
||||
vdis = {'root': {'uuid': vdi_uuid, 'ref': vdi_ref}}
|
||||
|
||||
self.called = False
|
||||
self.conn._vmops._attach_disks(instance, disk_image_type, vm_ref, vdis)
|
||||
self.conn._vmops._attach_disks(instance, vm_ref, instance['name'],
|
||||
disk_image_type, vdis)
|
||||
self.assertTrue(self.called)
|
||||
|
||||
def test_generate_swap(self):
|
||||
|
||||
@@ -39,7 +39,7 @@ def stubout_firewall_driver(stubs, conn):
|
||||
|
||||
|
||||
def stubout_instance_snapshot(stubs):
|
||||
def fake_fetch_image(context, session, instance, image, type):
|
||||
def fake_fetch_image(context, session, instance, name_label, image, type):
|
||||
return {'root': dict(uuid=_make_fake_vdi(), file=None),
|
||||
'kernel': dict(uuid=_make_fake_vdi(), file=None),
|
||||
'ramdisk': dict(uuid=_make_fake_vdi(), file=None)}
|
||||
@@ -117,8 +117,8 @@ def stubout_lookup_image(stubs):
|
||||
def stubout_fetch_disk_image(stubs, raise_failure=False):
|
||||
"""Simulates a failure in fetch image_glance_disk."""
|
||||
|
||||
def _fake_fetch_disk_image(context, session, instance, image,
|
||||
image_type):
|
||||
def _fake_fetch_disk_image(context, session, instance, name_label, image,
|
||||
image_type):
|
||||
if raise_failure:
|
||||
raise fake.Failure("Test Exception raised by "
|
||||
"fake fetch_image_glance_disk")
|
||||
|
||||
Reference in New Issue
Block a user