Make exposed methods clearer in xenapi.vmops

VMOps is only used by connection.py, but it's not always obvious
which methods are intended to be public and which are used
internally for implementation reasons. Prefix any internal methods
with _ to make that clearer.

Change-Id: I50244c18233d6d7463057cf5df42d5a5a3a6fab9
This commit is contained in:
Johannes Erdfelt
2012-04-12 18:06:35 +00:00
parent 1c80289e59
commit 525ed820be
2 changed files with 6 additions and 5 deletions

View File

@@ -664,7 +664,7 @@ class XenAPIVMTestCase(test.TestCase):
def dummy(*args, **kwargs):
pass
self.stubs.Set(vmops.VMOps, 'create_vifs', dummy)
self.stubs.Set(vmops.VMOps, '_create_vifs', dummy)
# Reset network table
xenapi_fake.reset_table('network')
# Instance id = 2 will use vlan network (see db/fakes.py)
@@ -703,6 +703,11 @@ class XenAPIVMTestCase(test.TestCase):
session = xenapi_conn.XenAPISession('test_url', 'root', 'test_pass')
vm = vm_utils.VMHelper.lookup(session, instance.name)
vbd = xenapi_fake.create_vbd(vm, None)
def fake_spawn(self, context, inst, network_info, image_meta):
inst._rescue = False
self.stubs.Set(vmops.VMOps, 'spawn', fake_spawn)
conn = xenapi_conn.get_connection(False)
conn.rescue(self.context, instance, [], None)

View File

@@ -311,9 +311,6 @@ def stub_out_vm_methods(stubs):
def fake_release_bootlock(self, vm):
pass
def fake_spawn_rescue(self, context, inst, network_info, image_meta):
inst._rescue = False
@classmethod
def fake_generate_ephemeral(cls, *args):
pass
@@ -321,7 +318,6 @@ def stub_out_vm_methods(stubs):
stubs.Set(vmops.VMOps, "_shutdown", fake_shutdown)
stubs.Set(vmops.VMOps, "_acquire_bootlock", fake_acquire_bootlock)
stubs.Set(vmops.VMOps, "_release_bootlock", fake_release_bootlock)
stubs.Set(vmops.VMOps, "spawn_rescue", fake_spawn_rescue)
stubs.Set(vm_utils.VMHelper, 'generate_ephemeral', fake_generate_ephemeral)