Merge "Fix concurrency of XenAPI sessions"
This commit is contained in:
		@@ -1072,8 +1072,11 @@ class FakeSession(object):
 | 
			
		||||
              'free-computed': 40}
 | 
			
		||||
        return json.dumps({'host_memory': vm})
 | 
			
		||||
 | 
			
		||||
    def get_xenapi(self):
 | 
			
		||||
        return FakeXenApi()
 | 
			
		||||
    def call_xenapi(self, method, *args):
 | 
			
		||||
        f = FakeXenApi()
 | 
			
		||||
        for m in method.split('.'):
 | 
			
		||||
            f = getattr(f, m)
 | 
			
		||||
        return f(*args)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class HostStateTestCase(test.TestCase):
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,7 @@ def stubout_instance_snapshot(stubs):
 | 
			
		||||
        sr_ref = "fakesr"
 | 
			
		||||
        vdi_ref = create_vdi(name_label=name_label, read_only=False,
 | 
			
		||||
                             sr_ref=sr_ref, sharable=False)
 | 
			
		||||
        vdi_rec = session.get_xenapi().VDI.get_record(vdi_ref)
 | 
			
		||||
        vdi_rec = session.call_xenapi("VDI.get_record", vdi_ref)
 | 
			
		||||
        vdi_uuid = vdi_rec['uuid']
 | 
			
		||||
        return [dict(vdi_type='os', vdi_uuid=vdi_uuid)]
 | 
			
		||||
 | 
			
		||||
@@ -307,7 +307,7 @@ def stub_out_migration_methods(stubs):
 | 
			
		||||
    def fake_get_vdi(cls, session, vm_ref):
 | 
			
		||||
        vdi_ref = fake.create_vdi(name_label='derp', read_only=False,
 | 
			
		||||
                             sr_ref='herp', sharable=False)
 | 
			
		||||
        vdi_rec = session.get_xenapi().VDI.get_record(vdi_ref)
 | 
			
		||||
        vdi_rec = session.call_xenapi("VDI.get_record", vdi_ref)
 | 
			
		||||
        return vdi_ref, {'uuid': vdi_rec['uuid'], }
 | 
			
		||||
 | 
			
		||||
    def fake_shutdown(self, inst, vm, hard=True):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user