Skip to contentSkip to conversation

libxl: create xenstore nodes for control/feature-XXX flags

PATCH In review Paul Durrant 2 participants 3 messages Aug 1, 2016 – Aug 2, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: create xenstore nodes for control/feature-XXX flags

The xenstore-paths documentation specifies various control/feature-XXX flags to allow a guest to tell a toolstack about its abilities to respond to values written to control/shutdown. However, because the parent control xenstore key is created read-only to the guest, unless empty nodes for the feature flags are also created reat/write by the toolstack, the guest will not be able to set any flags.

This patch adds code to create all specified feature flag nodes at domain creation time.

---
 tools/libxl/libxl_create.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
tools/libxl/libxl_create.c +17 -0
index 828f254..03b6339 100644
@@ -646,6 +646,23 @@ retry_transaction:
                     GCSPRINTF("%s/control/shutdown", dom_path),
                     rwperm, ARRAY_SIZE(rwperm));
     libxl__xs_mknod(gc, t,
+                    GCSPRINTF("%s/control/feature-poweroff", dom_path),
+                    rwperm, ARRAY_SIZE(rwperm));
+    libxl__xs_mknod(gc, t,
+                    GCSPRINTF("%s/control/feature-reboot", dom_path),
+                    rwperm, ARRAY_SIZE(rwperm));
+    libxl__xs_mknod(gc, t,
+                    GCSPRINTF("%s/control/feature-suspend", dom_path),
+                    rwperm, ARRAY_SIZE(rwperm));
+    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+        libxl__xs_mknod(gc, t,
+                        GCSPRINTF("%s/control/feature-s3", dom_path),
+                        rwperm, ARRAY_SIZE(rwperm));
+        libxl__xs_mknod(gc, t,
+                        GCSPRINTF("%s/control/feature-s4", dom_path),
+                        rwperm, ARRAY_SIZE(rwperm));
+    }
+    libxl__xs_mknod(gc, t,
                     GCSPRINTF("%s/device/suspend/event-channel", dom_path),
                     rwperm, ARRAY_SIZE(rwperm));
     libxl__xs_mknod(gc, t,
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Paul Durrant

The xenstore-paths documentation specifies various control/feature-XXX flags to allow a guest to tell a toolstack about its abilities to respond to values written to control/shutdown. However, because the parent control xenstore key is created read-only to the guest, unless empty nodes for the feature flags are also created reat/write by the toolstack, the guest will not be able to set any flags.

Quoted 6 lines

This patch adds code to create all specified feature flag nodes at domain creation time.

This is in accordance with docs/mis/xenstore-paths.markdown.

Quoted 35 lines
---
 tools/libxl/libxl_create.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
tools/libxl/libxl_create.c +17 -0
index 828f254..03b6339 100644
@@ -646,6 +646,23 @@ retry_transaction:
                     GCSPRINTF("%s/control/shutdown", dom_path),
                     rwperm, ARRAY_SIZE(rwperm));
     libxl__xs_mknod(gc, t,
+                    GCSPRINTF("%s/control/feature-poweroff", dom_path),
+                    rwperm, ARRAY_SIZE(rwperm));
+    libxl__xs_mknod(gc, t,
+                    GCSPRINTF("%s/control/feature-reboot", dom_path),
+                    rwperm, ARRAY_SIZE(rwperm));
+    libxl__xs_mknod(gc, t,
+                    GCSPRINTF("%s/control/feature-suspend", dom_path),
+                    rwperm, ARRAY_SIZE(rwperm));
+    if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
+        libxl__xs_mknod(gc, t,
+                        GCSPRINTF("%s/control/feature-s3", dom_path),
+                        rwperm, ARRAY_SIZE(rwperm));
+        libxl__xs_mknod(gc, t,
+                        GCSPRINTF("%s/control/feature-s4", dom_path),
+                        rwperm, ARRAY_SIZE(rwperm));
+    }
+    libxl__xs_mknod(gc, t,
                     GCSPRINTF("%s/device/suspend/event-channel", dom_path),
                     rwperm, ARRAY_SIZE(rwperm));
     libxl__xs_mknod(gc, t,
Signature · 1 line
2.1.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 11 lines · Wei Liu
Quoted 10 lines · Paul Durrant

The xenstore-paths documentation specifies various control/feature-XXX flags to allow a guest to tell a toolstack about its abilities to respond to values written to control/shutdown. However, because the parent control xenstore key is created read-only to the guest, unless empty nodes for the feature flags are also created reat/write by the toolstack, the guest will not be able to set any flags.

This patch adds code to create all specified feature flag nodes at domain creation time.

Quoted 7 lines
Quoted 3 lines

This is in accordance with docs/mis/xenstore-paths.markdown.

Pushed.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel