Esempio n. 1
0
def test_check_snapshot_with_memory(api_v4):
    engine = api_v4.system_service()
    vm_service = test_utils.get_vm_service(engine, VM0_NAME)
    testlib.assert_true_within_long(
        lambda: test_utils.get_snapshot(engine, VM0_NAME, SNAPSHOT_DESC_MEM).
        snapshot_status == types.SnapshotStatus.IN_PREVIEW)
    vm_service.start()
    _verify_vm_state(engine, VM0_NAME, types.VmStatus.UP)
def check_snapshot_with_memory(api):
    engine = api.system_service()
    vm_service = test_utils.get_vm_service(engine, VM0_NAME)
    testlib.assert_true_within_long(
        lambda: test_utils.get_snapshot(engine, VM0_NAME,
                                        SNAPSHOT_DESC_MEM).snapshot_status ==
        types.SnapshotStatus.IN_PREVIEW
    )
    vm_service.start()
    _verify_vm_state(engine, VM0_NAME, types.VmStatus.UP)
Esempio n. 3
0
def test_preview_snapshot_with_memory(api_v4):
    engine = api_v4.system_service()
    events = engine.events_service()
    testlib.assert_true_within_long(
        # wait for event 68 == USER_CREATE_SNAPSHOT_FINISHED_SUCCESS
        lambda: any(e.code == 68 for e in events.list(max=6)))
    vm_service = test_utils.get_vm_service(engine, VM0_NAME)
    vm_service.stop()
    _verify_vm_state(engine, VM0_NAME, types.VmStatus.DOWN)
    snapshot = test_utils.get_snapshot(engine, VM0_NAME, SNAPSHOT_DESC_MEM)
    vm_service.preview_snapshot(snapshot=snapshot,
                                async=False,
                                restore_memory=True)
def preview_snapshot_with_memory(api):
    engine = api.system_service()
    events = engine.events_service()
    testlib.assert_true_within_long(
        # wait for event 68 == USER_CREATE_SNAPSHOT_FINISHED_SUCCESS
        lambda: any(e.code == 68 for e in events.list(max=6))
    )
    vm_service = test_utils.get_vm_service(engine, VM0_NAME)
    vm_service.stop()
    _verify_vm_state(engine, VM0_NAME, types.VmStatus.DOWN)
    snapshot = test_utils.get_snapshot(engine, VM0_NAME, SNAPSHOT_DESC_MEM)
    vm_service.preview_snapshot(snapshot=snapshot, async=False,
                                restore_memory=True)
def preview_snapshot_with_memory(api):
    engine = api.system_service()
    vm_service = test_utils.get_vm_service(engine, VM0_NAME)

    def snapshot_created():
        snapshot = test_utils.get_snapshot(engine, VM0_NAME, SNAPSHOT_DESC_MEM)
        return (snapshot is not None
                and snapshot.snapshot_status == types.SnapshotStatus.OK)

    testlib.assert_true_within_long(snapshot_created)
    vm_service.stop()
    testlib.assert_true_within_short(
        lambda: vm_service.get().status == types.VmStatus.DOWN)
    snapshot = test_utils.get_snapshot(engine, VM0_NAME, SNAPSHOT_DESC_MEM)
    vm_service.preview_snapshot(snapshot=snapshot,
                                async=False,
                                restore_memory=True)
 def snapshot_created():
     snapshot = test_utils.get_snapshot(engine, VM0_NAME, SNAPSHOT_DESC_MEM)
     return (snapshot is not None
             and snapshot.snapshot_status == types.SnapshotStatus.OK)