Skip to content

Commit 9571471

Browse files
author
Longchuanzheng
committed
VEP 64: Stop vm with pmsuspend to disk
Signed-off-by: Longchuanzheng <[email protected]>
1 parent f4c3247 commit 9571471

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed
142 KB
Loading
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# VEP #NNNN: Your short, descriptive title
2+
3+
## Release Signoff Checklist
4+
5+
Items marked with (R) are required *prior to targeting to a milestone / release*.
6+
7+
- [x] (R) Enhancement issue created, which links to VEP dir in [kubevirt/enhancements] (not the initial VEP PR)
8+
- [ ] (R) Target version is explicitly mentioned and approved
9+
- [ ] (R) Graduation criteria filled
10+
11+
## Overview
12+
13+
libvirt have a pmsuspend interface [https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainPMSuspendForDuration], at least for QEMU with flag `target disk` and `duration 0` we can shutdown a domain with memory to disk. This can release resources. This proposal try to stop vm with `pmsuspend --target disk duration 0`,which can meet specific needs.
14+
15+
## Motivation
16+
17+
Some users wish to shut down running machines to free up resources, but the virtual machine state remains the same when turned on as when turned off.
18+
19+
## Goals
20+
21+
Add a new way to stop vm in kubevirt. which can make virtual machine state remains the same when turned on as when turned off.
22+
23+
## Non Goals
24+
25+
Add pmsuspend to memery to kubevirt(In my opinion, it can implement like pause)
26+
27+
## Definition of Users
28+
29+
<!--
30+
Who is this feature set intended for
31+
-->
32+
33+
## User Stories
34+
35+
A user exec `virtctl pmsuspendToDisk vm.name` commend, the vm stopped with memory state saved, exec `virtctl start vm.name` to start the stopped vm.
36+
37+
## Repos
38+
39+
api for stop vm
40+
41+
## Design
42+
43+
# Implementation Phases
44+
45+
### phase1(send request)
46+
47+
1. pmsuspendToDisk is trigger by add status.VirtualMachineStateChangeRequest.PmsuspendToDisk to vm.
48+
49+
```
50+
StopRequest StateChangeRequestAction = "PmsuspendToDisk"
51+
```
52+
53+
2. vm-controller find this status and add `pmsuspendToDisk = true` for vmi.
54+
55+
3. virt-handler send grpc request to virt-launcher and call libvirt interface.
56+
57+
### phase2(return)
58+
59+
According to my experimental results, there are three possible results.1)vm support command with domain shutdown; 2)command return failed; 3) command return successed while domain still running.
60+
61+
1. command successed domain shutdown
62+
63+
when domain shutdown, vmi failed, vm Runstrategy update to halted.
64+
65+
2. command return failed
66+
67+
If command failed. virt-handler get err grpc respond and add `domainpmsuspendTodisk` status for vmi. vm cancel request(delete status.VirtualMachineStateChangeRequest.PmsuspendToDisk in vm)
68+
69+
3. command return successed while domain still running
70+
71+
We need set a timeout duration (maybe in kubevirt cr), If timeout while domain still running. we also add `domainpmsuspendTodisk` status for vmi and cancel request(delete status.VirtualMachineStateChangeRequest.PmsuspendToDisk in vm) in vm. (If domain shutdown after we cancel vm. We do nothing, just let the previous control logic execution, restart if Runstrategy=always)
72+
73+
![](pmsuspend_to_disk_flow.png)
74+
75+
## API Examples
76+
77+
Virtctl stop vm.name -n vm.namespace --suspend-to-disk=true
78+
79+
## Alternatives
80+
81+
<!--
82+
Outline any alternative designs that have been considered)
83+
-->
84+
85+
## Scalability
86+
87+
<!--
88+
Overview of how the design scales)
89+
-->
90+
91+
## Update/Rollback Compatibility
92+
93+
<!--
94+
Does this impact update compatibility and how?)
95+
-->
96+
97+
## Functional Testing Approach
98+
99+
<!--
100+
An overview on the approaches used to functional test this design)
101+
-->
102+
103+
## Implementation Phases
104+
105+
<!--
106+
How/if this design will get broken up into multiple phases)
107+
-->
108+
109+
## Feature lifecycle Phases
110+
111+
<!--
112+
How and when will the feature progress through the Alpha, Beta and GA lifecycle phases
113+
114+
Refer to https://github.com/kubevirt/community/blob/main/design-proposals/feature-lifecycle.md#releases for more details
115+
-->
116+
117+
### Alpha
118+
119+
### Beta
120+
121+
### GA

0 commit comments

Comments
 (0)