-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
0617-libxl-check-control-feature-before-issuing-pvcontrol.patch
49 lines (43 loc) · 1.8 KB
/
0617-libxl-check-control-feature-before-issuing-pvcontrol.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
From 64e3c902dace81021e306de3acdad757a8e24db3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
Date: Thu, 27 Oct 2022 21:27:05 +0200
Subject: [PATCH] libxl: check control/feature-* before issuing pvcontrol
command
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Check early, instead of waiting for a timeout. This is relevant for
example for Mirage OS PVH domain, which doesn't support suspend.
Signed-off-by: Marek Marczykowski-Górecki <[email protected]>
---
tools/libs/light/libxl_domain.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/libs/light/libxl_domain.c b/tools/libs/light/libxl_domain.c
index 25cde778352d..f4bcb0b198cb 100644
--- a/tools/libs/light/libxl_domain.c
+++ b/tools/libs/light/libxl_domain.c
@@ -773,6 +773,7 @@ int libxl__domain_pvcontrol(libxl__egc *egc, libxl__xswait_state *pvcontrol,
struct xs_permissions perms[] = {
{ .id = domid, .perms = XS_PERM_NONE },
};
+ char *feature;
int rc;
rc = libxl__domain_pvcontrol_available(gc, domid);
@@ -791,6 +792,15 @@ int libxl__domain_pvcontrol(libxl__egc *egc, libxl__xswait_state *pvcontrol,
if (!t)
return ERROR_FAIL;
+ feature = libxl__xs_read(gc, t, GCSPRINTF("%s/control/feature-%s",
+ libxl__xs_get_dompath(gc, domid),
+ cmd));
+ if (!feature || strcmp(feature, "1")) {
+ LOGD(ERROR, domid, "PV control '%s' not supported by this domain", cmd);
+ xs_transaction_end(ctx->xsh, t, 1);
+ return ERROR_NOPARAVIRT;
+ }
+
rc = libxl__xs_printf(gc, t, shutdown_path, "%s", cmd);
if (rc) {
xs_transaction_end(ctx->xsh, t, 1);
--
2.44.0