Skip to contentSkip to conversation

libxl: create /local/domain/<domid>/error and make guest-writable

PATCH In review David Scott 2 participants 2 messages Oct 7, 2014 – Oct 8, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: create /local/domain/<domid>/error and make guest-writable

Frontends write error information to these paths which is currently blocked with an EACCES. Typical errors from a Linux 3.x look like:

$ sudo xenstore-ls /local/domain/11/error -p
device = ""  . . . . . . . . . . . . . . . . . . . . . . . .  (n11)
 vbd = ""  . . . . . . . . . . . . . . . . . . . . . . . . .  (n11)
  5632 = ""  . . . . . . . . . . . . . . . . . . . . . . . .  (n11)
   error = "19 xenbus_dev_probe on device/vbd/5632"  . . . .  (n11)
---
 docs/misc/xenstore-paths.markdown |   20 ++++++++++++++++++++
 tools/libxl/libxl_create.c        |    3 +++
 2 files changed, 23 insertions(+)
docs/misc/xenstore-paths.markdown +20 -0
index ea67536..bef5a0c 100644
@@ -217,21 +217,37 @@ for the first PV console.
 A virtual block device frontend. Described by
 [xen/include/public/io/blkif.h][BLKIF]
 
+#### ~/error/device/vbd/$DEVID/error = STRING []
+
+An error message reported by the virtual block device frontend driver.
+
 #### ~/device/vfb/$DEVID/* []
 
 A virtual framebuffer frontend. Described by
 [xen/include/public/io/fbif.h][FBIF]
 
+#### ~/error/device/vfb/$DEVID/error = STRING []
+
+An error message reported by the virtual framebuffer frontend driver.
+
 #### ~/device/vkbd/$DEVID/* []
 
 A virtual keyboard device frontend. Described by
 [xen/include/public/io/kbdif.h][KBDIF]
 
+#### ~/error/device/vkbd/$DEVID/error = STRING []
+
+An error message reported by the virtual keyboard frontend driver.
+
 #### ~/device/vif/$DEVID/* []
 
 A virtual network device frontend. Described by
 [xen/include/public/io/netif.h][NETIF]
 
+#### ~/error/device/vif/$DEVID/error = STRING []
+
+An error message reported by the virtual network device frontend driver.
+
 #### ~/console/* []
 
 The primary PV console device. Described in [console.txt](console.txt)
@@ -240,6 +256,10 @@ The primary PV console device. Described in [console.txt](console.txt)
 
 A secondary PV console device. Described in [console.txt](console.txt)
 
+#### ~/error/device/console/$DEVID/error = STRING []
+
+An error message reported by the secondary console device frontend driver.
+
 #### ~/device/serial/$DEVID/* [HVM]
 
 An emulated serial device. Described in [console.txt](console.txt)
tools/libxl/libxl_create.c +3 -0
index 8b82584..af56896 100644
@@ -600,6 +600,9 @@ retry_transaction:
     libxl__xs_mkdir(gc, t,
                     libxl__sprintf(gc, "%s/data", dom_path),
                     rwperm, ARRAY_SIZE(rwperm));
+    libxl__xs_mkdir(gc, t,
+                    libxl__sprintf(gc, "%s/error", dom_path),
+                    rwperm, ARRAY_SIZE(rwperm));
 
     if (libxl_defbool_val(info->driver_domain)) {
         /*
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 8 lines · David Scott

Frontends write error information to these paths which is currently blocked with an EACCES. Typical errors from a Linux 3.x look like:

$ sudo xenstore-ls /local/domain/11/error -p
device = ""  . . . . . . . . . . . . . . . . . . . . . . . .  (n11)
 vbd = ""  . . . . . . . . . . . . . . . . . . . . . . . . .  (n11)
  5632 = ""  . . . . . . . . . . . . . . . . . . . . . . . .  (n11)
   error = "19 xenbus_dev_probe on device/vbd/5632"  . . . .  (n11)

I had no idea this existed!

Quoted 3 lines
---
 docs/misc/xenstore-paths.markdown |   20 ++++++++++++++++++++

What do you think of a single more generic entry e.g.

#### ~/error/device/$DEVTYPE/$DEVID/error

An error message reported by the virtual device driver associated with ~/device/$DEVTYPE/$DEVID/* (see above)

tools/libxl/libxl_create.c retry_transaction: · line 605

Quoted 11 lines
tools/libxl/libxl_create.c +3 -0
index 8b82584..af56896 100644
@@ -600,6 +600,9 @@ retry_transaction:
     libxl__xs_mkdir(gc, t,
                     libxl__sprintf(gc, "%s/data", dom_path),
                     rwperm, ARRAY_SIZE(rwperm));
+    libxl__xs_mkdir(gc, t,
+                    libxl__sprintf(gc, "%s/error", dom_path),
+                    rwperm, ARRAY_SIZE(rwperm));

Looks to be trivially correct to me.

It's a shame to be opening up yet another area where the guest is free to do whatever, but I expect the patch to create each of the specific device paths as we add the device would be somewhat larger.

Ian.