Skip to content

Commit 193da97

Browse files
KaigeFuNanlinXie
authored andcommitted
tools: acrnd: Refine log msg to avoid confusing.
When guest enter S5, its monitor socket will be closed. If we try to use it to query the vm state, an error msg will be print out. Acctually, we should not take it as an error. So, this patch refine the log msg to show more details when guest trying to enter S3/S5. Tracked-On: #1506 Signed-off-by: Kaige Fu <kaige.fu@intel.com> Acked-by: Yan, Like <like.yan@intel.com>
1 parent 1c7d2f6 commit 193da97

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

tools/acrn-manager/acrn_vm_ops.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,13 @@ static int send_msg(const char *vmname, struct mngr_msg *req,
281281

282282
fd = mngr_open_un(vmname, MNGR_CLIENT);
283283
if (fd < 0) {
284-
printf("%s: Unable to open %s. line %d\n", __FUNCTION__,
285-
vmname, __LINE__);
284+
printf("Unable to open vm %s socket. It may have been shutdown\n", vmname);
286285
return -1;
287286
}
288287

289288
ret = mngr_send_msg(fd, req, ack, 1);
290289
if (ret < 0) {
291-
printf("%s: Unable to send msg\n", __FUNCTION__);
290+
printf("Unable to send msg to vm %s socket. It may have been shutdown\n", vmname);
292291
mngr_close(fd);
293292
return ret;
294293
}

tools/acrn-manager/acrnd.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,17 @@ static int wait_for_stop(unsigned int timeout)
423423

424424
/* list and update the vm status */
425425
do {
426-
if (check_vms_status(VM_CREATED) == 0)
426+
printf("Waiting %lu seconds for all vms enter S3/S5 state\n", t);
427+
428+
if (check_vms_status(VM_CREATED) == 0) {
429+
printf("All vms have entered S5 state successfully\n");
427430
return SHUTDOWN;
431+
}
428432

429-
if (check_vms_status(VM_PAUSED) == 0)
433+
if (check_vms_status(VM_PAUSED) == 0) {
434+
printf("All vms have entered S3 state successfully\n");
430435
return SUSPEND;
436+
}
431437

432438
sleep(1);
433439
}
@@ -446,7 +452,7 @@ static void* notify_stop_state(void *arg)
446452

447453
rc = wait_for_stop(acrnd_stop_timeout);
448454
if (rc < 0) {
449-
fprintf(stderr, "cannot get VMs stop state\n");
455+
fprintf(stderr, "Timeout(%u sec) to wait all vms enter S3/S5\n", acrnd_stop_timeout);
450456
req.msgid = SUSPEND;
451457
req.data.err = -1;
452458
} else {

0 commit comments

Comments
 (0)