]> xenbits.xen.org Git - xenclient/toolstack.git/commitdiff
Xenvm was producing 'suspended' status too early - before qemu finished writing memor...
authorTomasz Wroblewski <tomasz.wroblewski@citrix.com>
Mon, 7 Dec 2009 16:22:31 +0000 (16:22 +0000)
committerTomasz Wroblewski <tomasz.wroblewski@citrix.com>
Mon, 7 Dec 2009 16:36:18 +0000 (16:36 +0000)
xenvm/vmact.ml
xenvm/xenvm.ml

index 113eaa5e5743a2097c9b76fa7150bc19164f09c0..a0e581f4755948b019c217ce60a3943040a07f24 100644 (file)
@@ -400,7 +400,8 @@ let shutdown_vm xc xs xal state force reason =
                        warn "vm didn't acked shutdown request %s" reason_str;
                        raise (Vm_not_listening_shutdown_request reason);
                );
-               change_vmstate state VmShutdowning;
+               if reason <> Domain.Suspend then change_vmstate state VmShutdowning;
+
                info "vm acknowledged shutdown request. waiting release";
 
                (* wait domain release with xal *)
@@ -429,11 +430,10 @@ let shutdown_vm xc xs xal state force reason =
                );
                let newstatus =
                        match reason with
-                       | Domain.Suspend -> VmSuspended
                        | Domain.Reboot  -> VmRebooting
                        | _              -> VmShutdown
                        in
-               change_vmstate state newstatus;
+               if reason <> Domain.Suspend then change_vmstate state newstatus;
                info "vm has shutdowned";
        ) (fun () -> state.vm_expect_shutdown <- false)
 
index cb5146efdade346e2b08754308f8c06524512c5a..85febd67c95b2f1185b7c2c86e947005256eb3f1 100644 (file)
@@ -440,6 +440,7 @@ let do_task state (task, args) =
                        Vmact.suspend xc xs state (if live then [ Domain.Live ] else [])
                                                  (with_datadir state.vm_cfg file);
                        Vmact.stop_vm xc xs state;
+                       Vmact.change_vmstate state VmSuspended;
                );
                Xenvmlib.Ok
        | Tasks.Restore ->
@@ -463,7 +464,10 @@ let do_task state (task, args) =
        | Tasks.Checkpoint ->
                let file = Tasks.args_get_string args "file" in
                state.vm_on_suspend_action <- ActionResume;
-               with_xcs (fun xc xs -> Vmact.suspend xc xs state [] (with_datadir state.vm_cfg file));
+               with_xcs (fun xc xs ->
+                 Vmact.suspend xc xs state [] (with_datadir state.vm_cfg file);
+                 Vmact.change_vmstate state VmSuspended;
+               );
                Xenvmlib.Ok
        | Tasks.GetDomid -> Xenvmlib.Msg (string_of_int state.vm_domid)
        | Tasks.GetStatus -> Xenvmlib.Msg (string_of_vmlifestate state.vm_lifestate)