mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 17:58:30 +00:00
hv:add pre-condition for vm APIs
check the vm state in hypercall api, add pre-condition for vm api. Tracked-On: #4320 Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -203,7 +203,7 @@ int32_t hcall_destroy_vm(uint16_t vmid)
|
||||
int32_t ret = -1;
|
||||
struct acrn_vm *target_vm = get_vm_from_vmid(vmid);
|
||||
|
||||
if (!is_poweroff_vm(target_vm) && is_postlaunched_vm(target_vm)) {
|
||||
if (is_paused_vm(target_vm) && is_postlaunched_vm(target_vm)) {
|
||||
/* TODO: check target_vm guest_flags */
|
||||
ret = shutdown_vm(target_vm);
|
||||
}
|
||||
@@ -278,7 +278,7 @@ int32_t hcall_reset_vm(uint16_t vmid)
|
||||
struct acrn_vm *target_vm = get_vm_from_vmid(vmid);
|
||||
int32_t ret = -1;
|
||||
|
||||
if (!is_poweroff_vm(target_vm) && is_postlaunched_vm(target_vm)) {
|
||||
if (is_paused_vm(target_vm) && is_postlaunched_vm(target_vm)) {
|
||||
/* TODO: check target_vm guest_flags */
|
||||
ret = reset_vm(target_vm);
|
||||
}
|
||||
|
Reference in New Issue
Block a user