Skip to content

Commit 9105092

Browse files
committed
xenmgr: Re-work rebootVM as shutdown & start
Replace the use of `xl reboot` by `xl shutdown` and `xl start` to implement the vm reboot DBus command. xl shutdown needs on_reboot="destroy" in the xl.cfg file. This allows us to remove the xenmgr <-> xl signal synchronization. Xl.shutdown & RpcAgent shutdowns both wait for the VM to shutdown, except the `xl shutdown -c` hypercall version which seems to terminate right quick. The waitForState call is therefore not really implementing a timeout out. The corner case is if the VM has ACPI & no PV drivers, but is configured not to react to the power button. In that case we can't do much. If the VM then internally reboots, the xenmgr React code will reboot the VM and the waitForState will eventually timeout. writeXlConfig is removed as rebootVm -> restartVm -> _startVm startVmInternal -> bootVm calls writeXlConfig. Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
1 parent 8a80d93 commit 9105092

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

xenmgr/Vm/Actions.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,15 +1018,15 @@ applyVmBackendShift bkuuid = do
10181018

10191019

10201020
-- Reboot a VM
1021-
rebootVm :: Uuid -> Rpc ()
1021+
rebootVm :: Uuid -> XM ()
10221022
rebootVm uuid = do
10231023
info $ "rebooting VM " ++ show uuid
1024-
-- Write XL configuration file
1025-
writeXlConfig =<< getVmConfig uuid True
1026-
--Let xl take care of bringing down the domain and updating our state
1027-
--When xenmgr sees the 'Rebooted' state, it fires off a startVm call,
1028-
--which performs all the normal guest boot tasks, while xl brings up the domain.
1029-
liftIO $ Xl.reboot uuid
1024+
debug $ "reboot issuing shutdown to " ++ show uuid
1025+
liftRpc $ shutdownVm uuid
1026+
debug $ "reboot done issuing shutdown to " ++ show uuid
1027+
done <- liftIO $ Xl.waitForState uuid Shutdown (Just 60)
1028+
debug $ "reboot waitForState returned " ++ show done
1029+
when done $ restartVm uuid
10301030

10311031
shutdownVm :: Uuid -> Rpc ()
10321032
shutdownVm uuid = do

xenmgr/XenMgr/Expose/VmObject.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ implementationFor xm uuid = self where
104104
, comCitrixXenclientXenmgrVmSwitch = switchVm uuid >> return ()
105105
, comCitrixXenclientXenmgrVmStart = runXM xm (startVm uuid) >> return ()
106106
, comCitrixXenclientXenmgrVmStartInternal = runXM xm (startVmInternal uuid False) >> return ()
107-
, comCitrixXenclientXenmgrVmReboot = rebootVm uuid
107+
, comCitrixXenclientXenmgrVmReboot = runXM xm (rebootVm uuid) >> return ()
108108
, comCitrixXenclientXenmgrVmShutdown = runvm invokeShutdownVm
109109
, comCitrixXenclientXenmgrVmDestroy = runvm invokeForceShutdownVm
110110
, comCitrixXenclientXenmgrVmSleep = sleepVm uuid

xenmgr/XenMgr/PowerManagement.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ resumeS3' uuid S3Pv = do
283283
void . liftIO $ Xl.resumeFromSleep uuid
284284
info $ "PM: Successfully resumed " ++ show uuid ++ " from S3"
285285
resumeS3' uuid S3Restart = do
286-
liftRpc $ rebootVm uuid
286+
a <- rebootVm uuid
287287
info $ "PM: Restarted " ++ show uuid ++ " after S3"
288288

289289
resumeS3' uuid S3Snapshot =

0 commit comments

Comments
 (0)