mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-25 15:02:13 +00:00
tools: acrnd: handle stop request from SOS-LCS
SOS-Life-Cycle-Service can ask acrnd to stop UOSs, by sending ACRND_STOP to Acrnd. Acrnd handles this request by: 1. Try stop all running VMs, and return the result to SOS-LCS. 2. Store pending works of restarting/resuming VMs to file Reviewed-by: Yan Like <like.yan@intel.com> Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
This commit is contained in:
parent
bcb101f4f0
commit
04ed916f26
@ -50,8 +50,50 @@ static int store_timer_list(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int check_vms_status(unsigned int status)
|
||||
{
|
||||
struct vmmngr_struct *s;
|
||||
|
||||
vmmngr_update();
|
||||
|
||||
LIST_FOREACH(s, &vmmngr_head, list)
|
||||
if (s->state != status && s->state != VM_CREATED)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _handle_acrnd_stop(unsigned int timeout)
|
||||
{
|
||||
unsigned long t = timeout;
|
||||
|
||||
/*Let ospm stopping UOSs */
|
||||
|
||||
/* list and update the vm status */
|
||||
do {
|
||||
if (check_vms_status(VM_CREATED) == 0)
|
||||
return 0;
|
||||
sleep(1);
|
||||
}
|
||||
while (t--);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void handle_acrnd_stop(struct mngr_msg *msg, int client_fd, void *param)
|
||||
{
|
||||
struct req_acrnd_stop *req = (void *)msg;
|
||||
struct ack_acrnd_stop ack;
|
||||
|
||||
ack.msg.msgid = req->msg.msgid;
|
||||
ack.msg.len = sizeof(ack);
|
||||
ack.msg.timestamp = req->msg.timestamp;
|
||||
ack.err = _handle_acrnd_stop(req->timeout);
|
||||
|
||||
store_timer_list();
|
||||
|
||||
if (client_fd > 0)
|
||||
mngr_send_msg(client_fd, (void *)&ack, NULL, 0, 0);
|
||||
}
|
||||
|
||||
void handle_acrnd_resume(struct mngr_msg *msg, int client_fd, void *param)
|
||||
|
Loading…
Reference in New Issue
Block a user