Beispiel #1
0
 def test_pause_flags(self):
     vm_id = "042f6258-3446-4437-8034-0c93e3bcda1b"
     with namedTemporaryDir() as tmpDir:
         flags_path = os.path.join(tmpDir, "%s")
         with MonkeyPatchScope([(hooks, "_LAUNCH_FLAGS_PATH", flags_path)]):
             flags_file = hooks._LAUNCH_FLAGS_PATH % vm_id
             for flag in [libvirt.VIR_DOMAIN_NONE, libvirt.VIR_DOMAIN_START_PAUSED]:
                 self.assertFalse(os.path.exists(flags_file))
                 hooks.dump_vm_launch_flags_to_file(vm_id, flag)
                 read_flag = hooks.load_vm_launch_flags_from_file(vm_id)
                 self.assertEqual(flag, read_flag)
                 self.assertTrue(os.path.exists(flags_file))
                 hooks.remove_vm_launch_flags_file(vm_id)
                 self.assertFalse(os.path.exists(flags_file))
Beispiel #2
0
 def test_pause_flags(self):
     vm_id = '042f6258-3446-4437-8034-0c93e3bcda1b'
     with namedTemporaryDir() as tmpDir:
         flags_path = os.path.join(tmpDir, '%s')
         with MonkeyPatchScope([(hooks, '_LAUNCH_FLAGS_PATH', flags_path)]):
             flags_file = hooks._LAUNCH_FLAGS_PATH % vm_id
             for flag in [
                     libvirt.VIR_DOMAIN_NONE,
                     libvirt.VIR_DOMAIN_START_PAUSED
             ]:
                 self.assertFalse(os.path.exists(flags_file))
                 hooks.dump_vm_launch_flags_to_file(vm_id, flag)
                 read_flag = hooks.load_vm_launch_flags_from_file(vm_id)
                 self.assertEqual(flag, read_flag)
                 self.assertTrue(os.path.exists(flags_file))
                 hooks.remove_vm_launch_flags_file(vm_id)
                 self.assertFalse(os.path.exists(flags_file))
Beispiel #3
0
def load_vm_launch_flags_from_file(vm_id):
    return hooks.load_vm_launch_flags_from_file(vm_id)
Beispiel #4
0
def load_vm_launch_flags_from_file(vm_id):
    return hooks.load_vm_launch_flags_from_file(vm_id)