Commit Graph

21 Commits

Author SHA1 Message Date
yuhong.tao@intel.com 7ee0e2e2a4 tools: acrnctl: Fix path error when run "acrnctl add" cmd
There is a bug to run 'acrnctl add /[path]/script.sh', when the
launch script has an absolute path. Acrnctl will generate wrong path
for temp files and fail to add VM.

And message '/opt/acrn/conf: No such file or directory' always comes
out, until user once successfully run 'acrnctl add' cmd. That is reported
by _scan_added_vm(), because 'opt/acrn' is missing, only 'acrnctl add'
can create it, we should also check it in _scan_added_vm().

Tracked-On: #2013
Acked-by: Yan, Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-12-10 09:26:08 +08:00
yuhong.tao@intel.com 2f33d1bcf2 tools: acrn-manager: Fix acrnctl mistake displaying suspended to paused
When UOS is sleeping, 'acrnctl list' command show it is 'paused', not
'suspended'. That is not correct. Because pausing an UOS means to block
its VCPUs immediately, otherwise suspending an UOS means to put it to
sleep.

Tracked-On: #1910
Acked-by: Yan, Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-11-28 13:42:27 +08:00
Tianhua Sun 313941e853 tools: acrn-manager: remove unsafe api sscanf
function sscanf is banned according to the security
requirements. So remove sscanf api.

Tracked-On: #1254
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Tao, Yuhong <yuhong.tao@intel.com>
2018-11-05 09:50:04 +08:00
Tianhua Sun af760f8dce tools: acrn-manager: refine the usage of api 'snprintf'
Return value check for snprintf function

Tracked-On: #1254
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Kaige Fu <kaige.fu@intel.com>
2018-11-01 11:22:26 +08:00
Kaige Fu 193da97103 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>
2018-10-19 22:30:17 +08:00
Yan, Like f582757dd4 tools: acrn-manager: fix fd leaking
close dir to avoid fd leaking.

Tracked-On: #1477
Signed-off-by: Tao, Yuhong <yuhong.tao@intel.com>
Signed-off-by: Yan, Like <like.yan@intel.com>
2018-10-16 11:31:57 +08:00
Yan, Like 398ac203ca Update acrn_vm_ops.c 2018-09-27 16:55:50 +08:00
Yan, Like e6c3ea3b3b tools: acrn-manager: init vmmngr_head with LIST_HEAD_INITIALIZER
To fix the issue that vmmngr_head may be used uninitialized.

Tracked-On: #1157
Signed-off-by: Yan, Like <like.yan@intel.com>
2018-09-27 16:55:50 +08:00
Yan, Like 4ae88bb676 tools: acrn-manager: fix acrnctl reset issue
Wait for targeting VM stopping before starting it again

Tracked-On: projectacrn/acrn-hypervisor#926
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2018-09-11 08:41:47 +08:00
Yan, Like da4c95ba57 tools: acrn-manager: fix several warnings
This commit eliminates several compiler warnings via:
 - added 'const' quilifier to the 1st argument of send_msg();
 - added 'const' quilifier to vm ops functions.

Signed-off-by: Yan, Like <like.yan@intel.com>
2018-08-27 09:51:02 +08:00
yuhong.tao@intel.com 2d802d0afe tools: vm_resume() requires wakeup reason
DM need to know wakeup reason when resume the VM, so
vm_resume(char *name) is updated to vm_resume(char *name, unsigned reason),
in acrn_vm_ops.c

Acked-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-08-15 11:16:54 +08:00
Yuan Liu 7b34ae84fa tools: fix resuming vm issue in acrnd
This patch resolves vm state mismatch between vm and acrnd
which causes vm resuming failure

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Yuhong Tao <yuhong.tao@intel.com>
Reviewed-by: Like Yan <like.yan@intel.com>
2018-08-06 12:29:20 +08:00
Yuan Liu 331300d8b9 tools: fix an invalid parameter of send_msg in query_state
The issue is "acrnctl list" command always returns error with "no vmname
provided" information.

The rootcause is that vmname is an invalid parameter, which does not contain
any vm information.

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Yuhong Tao <yuhong.tao@intel.com>
Reviewed-by: Like Yan <like.yan@intel.com>
2018-08-06 12:29:20 +08:00
yuhong.tao@intel.com 9695d3bd15 tools: replace payload[0] of struct mngr_msg with an union
acrn-manager message structure has a flexible member
payload[0], that risks to out-of-boundary memory access,
and usage of uninitialized variable.
And the req/ack message pairs has various types, which
extend mngr_msg. mngr_send_msg() requires programmer cast
the type of input messages to struct mngr_msg, that is
inconvenient.
We replace payload[0] with an union, which contains all
payload data. So that type cast for mngr_send_msg() is no
longer needed. And we can avoid potential out-of-boundary
memory accessing and using of uninitialized variable

Acked-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-07-19 11:08:18 +08:00
yuhong.tao@intel.com c4f9a2fd70 tools: rework on vm ops
There are some problems to use VM operations in a deamon process,
such as Acrnd.  the list_vm() does not return VM informations, it
just print VM information to stdio, so we have get_vm_list()
to get VM list head vmngr_head; get_vm_list() always creates a
new fresh vm list every time, and must use put_vm_list() to delete
old list. So Acrnd need to create and destroy vm list frequently.
In fact we just need the vmngr_head to be an extern variable. And
to make it refreshable.We can insert new VMs, remove dead ones,
and update their state.

Reviewed-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-07-16 16:04:34 +08:00
Kaige Fu 7a0e8ddeec tools: acrnctl: Add support for resuming vm
Add command resume to resume vm from suspend state.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-07 14:36:18 +08:00
Kaige Fu d6eb39daf4 tools: acrnctl: Add support for suspending vm
Add command suspend to switch vm to suspend state.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-07 14:36:18 +08:00
Kaige Fu 665c2ee93f tools: acrnctl: Add support for continuing vm
Add command continue to start vm from pause state.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-07 14:36:18 +08:00
Kaige Fu 1933d60c29 tools: acrnctl: Add support for pausing vm
Add command pasue to pause vm.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-07 14:36:18 +08:00
Kaige Fu 3000edc6ad tools: acrnctl: Free vmmngr list after vm ops done
vmmngr_struct entry is allocated in get_vm_list. we should free it after vm ops done.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-07 14:36:18 +08:00
Kaige Fu 2da5e7c16a tools: acrnctl: Use new IPC lib to connect acrn-dm
this patch aim at
    1. Use new IPC lib to connect acrn-dm.
    2. Export list_vm, start_vm and stop_vm and acrnd will use them later.
    3. Rename vmm releated struct and function

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-07 14:36:18 +08:00