Skip to contentSkip to conversation

libxl: allow usage of storage driver domains

PATCH Applied Roger Pau Monne 4 participants 17 messages May 3, 2013 – May 8, 2013

lore
Share & tools
lore
#0 lore raw

cover libxl: allow usage of storage driver domains

Minor fixes in order to use driver domains for block devices (phy backends). I'm CCing George in order to see if this is suitable for inclusion into 4.3. IMHO I think this should be considered as a bug-fix, that allows the storage driver domain features already present in libxl to be usable for users. I've also created a wiki page that shows how to create and use storage driver domains with xl:

http://wiki.xen.org/wiki/Storage_driver_domains

Thanks, Roger.

#1 lore raw

PATCH 1/3 libxl: correctly parse storage devices on driver domains

Don't try to check physical devices if they belong to a domain different than the one where the toolstack is running. This prevents the following error when trying to use storage driver domains:

libxl: debug: libxl_create.c:1246:do_domain_create: ao 0x1819240: create: how=(nil) callback=(nil) poller=0x1818fa0
libxl: debug: libxl_device.c:235:libxl__device_disk_set_backend: Disk vdev=xvda spec.backend=phy
libxl: debug: libxl_device.c:175:disk_try_backend: Disk vdev=xvda, backend phy unsuitable as phys path not a block device
libxl: error: libxl_device.c:278:libxl__device_disk_set_backend: no suitable backend for disk xvda

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc George Dunlap <[email protected]>
---
 tools/libxl/libxl_device.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
tools/libxl/libxl_device.c +6 -0
index a5cf446..b1fc4ef 100644
@@ -161,6 +161,12 @@ static int disk_try_backend(disk_try_backend_args *a,
             goto bad_format;
         }
 
+        if (a->disk->backend_domid != LIBXL_TOOLSTACK_DOMID) {
+            LOG(DEBUG, "Disk vdev=%s, is using a storage driver domain, "
+                       "skipping physical device check", a->disk->vdev);
+            return backend;
+        }
+
         if (a->disk->script) {
             LOG(DEBUG, "Disk vdev=%s, uses script=... assuming phy backend",
                 a->disk->vdev);
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] libxl: correctly parse storage devices on driver domains

Quoted 10 lines · Roger Pau Monne

Don't try to check physical devices if they belong to a domain different than the one where the toolstack is running. This prevents the following error when trying to use storage driver domains:

libxl: debug: libxl_create.c:1246:do_domain_create: ao 0x1819240: create: how=(nil) callback=(nil) poller=0x1818fa0
libxl: debug: libxl_device.c:235:libxl__device_disk_set_backend: Disk vdev=xvda spec.backend=phy
libxl: debug: libxl_device.c:175:disk_try_backend: Disk vdev=xvda, backend phy unsuitable as phys path not a block device
libxl: error: libxl_device.c:278:libxl__device_disk_set_backend: no suitable backend for disk xvda

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

Acked-by on v1 1/3
#3 lore raw

Re: [PATCH 1/3] libxl: correctly parse storage devices on driver domains

In reply to Roger Pau Monne
Quoted 9 lines · Roger Pau Monne

Don't try to check physical devices if they belong to a domain different than the one where the toolstack is running. This prevents the following error when trying to use storage driver domains:

libxl: debug: libxl_create.c:1246:do_domain_create: ao 0x1819240: create: how=(nil) callback=(nil) poller=0x1818fa0
libxl: debug: libxl_device.c:235:libxl__device_disk_set_backend: Disk vdev=xvda spec.backend=phy
libxl: debug: libxl_device.c:175:disk_try_backend: Disk vdev=xvda, backend phy unsuitable as phys path not a block device
libxl: error: libxl_device.c:278:libxl__device_disk_set_backend: no suitable backend for disk xvda

Quoted 4 lines
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc George Dunlap <[email protected]>

Re the feature freeze, these look like fixes to me;

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

#4 lore raw

Re: [PATCH 1/3] libxl: correctly parse storage devices on driver domains

Quoted 21 lines · George Dunlap
Quoted 14 lines · Roger Pau Monne

Don't try to check physical devices if they belong to a domain different than the one where the toolstack is running. This prevents the following error when trying to use storage driver domains:

libxl: debug: libxl_create.c:1246:do_domain_create: ao 0x1819240: create:
how=(nil) callback=(nil) poller=0x1818fa0
libxl: debug: libxl_device.c:235:libxl__device_disk_set_backend: Disk vdev=xvda spec.backend=phy
libxl: debug: libxl_device.c:175:disk_try_backend: Disk vdev=xvda, backend phy unsuitable as phys path not a block device
libxl: error: libxl_device.c:278:libxl__device_disk_set_backend: no suitable backend for disk xvda

Quoted 4 lines
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc George Dunlap <[email protected]>
Quoted 3 lines

Re the feature freeze, these look like fixes to me;

Sorry, I thought I was replying to #0 -- the whole series gets a "feature freeze exception" ACK.

But *not* a "freeze for RC0" exception I don't think -- it will have to wait until Tuesday.

-George

Acked-by on v1 1/3
#5 lore raw

Re: [PATCH 1/3] libxl: correctly parse storage devices on driver domains

In reply to Roger Pau Monne

Roger Pau Monne writes ("[PATCH 1/3] libxl: correctly parse storage devices on driver domains"):

Quoted 3 lines

Don't try to check physical devices if they belong to a domain different than the one where the toolstack is running. This prevents the following error when trying to use storage driver domains:

All three look good to me:

George, are they OK for 4.3 ?

Ian.

#6 lore raw

Re: [PATCH 1/3] libxl: correctly parse storage devices on driver domains

Quoted 9 lines · Ian Jackson

Roger Pau Monne writes ("[PATCH 1/3] libxl: correctly parse storage devices on driver domains"):

Quoted 3 lines

Don't try to check physical devices if they belong to a domain different than the one where the toolstack is running. This prevents the following error when trying to use storage driver domains:

All three look good to me:

George, are they OK for 4.3 ?

Yes, I gave the series an "OK for 4.3 but not for the RC mini-freeze" ack on Friday.

-George

Applied
#7 lore raw

Re: [PATCH 1/3] libxl: correctly parse storage devices on driver domains

Quoted 5 lines · George Dunlap
Quoted 4 lines · Ian Jackson

Roger Pau Monne writes ("[PATCH 1/3] libxl: correctly parse storage devices on driver domains"):

Quoted 3 lines

Don't try to check physical devices if they belong to a domain different than the one where the toolstack is running. This prevents the following error when trying to use storage driver domains:

Quoted 8 lines
Quoted 5 lines

All three look good to me:

George, are they OK for 4.3 ?

Yes, I gave the series an "OK for 4.3 but not for the RC mini-freeze" ack on Friday.

Applied.

#8 lore raw

PATCH 2/3 libxl: don't execute hotplug scripts if device is on a driver domain

In reply to Roger Pau Monne

Prevent hotplug script execution from libxl if device is on a different domain.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc George Dunlap <[email protected]>
---
 tools/libxl/libxl_device.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
tools/libxl/libxl_device.c +7 -0
index b1fc4ef..bc86648 100644
@@ -903,6 +903,13 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev)
     int hotplug;
     pid_t pid;
 
+    /*
+     * If device is attached from a driver domain don't try to execute
+     * hotplug scripts
+     */
+    if (aodev->dev->backend_domid != LIBXL_TOOLSTACK_DOMID)
+        goto out;
+
     /* Check if we have to execute hotplug scripts for this device
      * and return the necessary args/env vars for execution */
     hotplug = libxl__get_hotplug_script_info(gc, aodev->dev, &args, &env,
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#9 lore raw

Re: [PATCH 2/3] libxl: don't execute hotplug scripts if device is on a driver domain

Quoted 2 lines · Roger Pau Monne

Prevent hotplug script execution from libxl if device is on a different domain.

The assumption being that the user has enabled udev in the driver domain?

Is a log message going to be worthwhile?

Does this obsolete run_hotplug_scripts somewhat?

Quoted 16 lines
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc George Dunlap <[email protected]>
---
 tools/libxl/libxl_device.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
tools/libxl/libxl_device.c +0 -0
index b1fc4ef..bc86648 100644
@@ -903,6 +903,13 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev)
     int hotplug;
     pid_t pid;
 

tools/libxl/libxl_device.c static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev) · line 915

Quoted 10 lines
tools/libxl/libxl_device.c +7 -0
+    /*
+     * If device is attached from a driver domain don't try to execute
+     * hotplug scripts
+     */
+    if (aodev->dev->backend_domid != LIBXL_TOOLSTACK_DOMID)
+        goto out;
+
     /* Check if we have to execute hotplug scripts for this device
      * and return the necessary args/env vars for execution */
     hotplug = libxl__get_hotplug_script_info(gc, aodev->dev, &args, &env,

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

#10 lore raw

Re: [PATCH 2/3] libxl: don't execute hotplug scripts if device is on a driver domain

Quoted 6 lines · Ian Campbell
Quoted 2 lines · Roger Pau Monne

Prevent hotplug script execution from libxl if device is on a different domain.

The assumption being that the user has enabled udev in the driver domain?

Yes, although it doesn't have to be udev specifically, for example something similar to xenbackendd could be used in the driver domain, but I have only tested it with udev.

Quoted 2 lines

Is a log message going to be worthwhile?

There's already one log message earlier in disk_try_backend, but I guess it won't hurt to add another one here, specifically saying that hotplug scripts will not be executed by libxl for this specific device.

Quoted 1 line

Does this obsolete run_hotplug_scripts somewhat?

Not really, it just prevents libxl from calling hotplug scripts that will surely fail (because the domain where the toolstack is running doesn't have access to the device). run_hotplug_scripts tells whether hotplug scripts will be executed by udev or libxl, so this code just changes the behaviour when run_hotplug_scripts == 1 and backend_domid != TOOLSTACK_DOMID.

Quoted 17 lines
Quoted 17 lines
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc George Dunlap <[email protected]>
---
 tools/libxl/libxl_device.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
tools/libxl/libxl_device.c +0 -0
index b1fc4ef..bc86648 100644
@@ -903,6 +903,13 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev)
     int hotplug;
     pid_t pid;
 
Quoted 12 lines

tools/libxl/libxl_device.c static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev) · line 915

Quoted 10 lines
tools/libxl/libxl_device.c +7 -0
+    /*
+     * If device is attached from a driver domain don't try to execute
+     * hotplug scripts
+     */
+    if (aodev->dev->backend_domid != LIBXL_TOOLSTACK_DOMID)
+        goto out;
+
     /* Check if we have to execute hotplug scripts for this device
      * and return the necessary args/env vars for execution */
     hotplug = libxl__get_hotplug_script_info(gc, aodev->dev, &args, &env,

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

Acked-by on v1 2/3
#11 lore raw

Re: [PATCH 2/3] libxl: don't execute hotplug scripts if device is on a driver domain

In reply to Roger Pau Monne
Quoted 4 lines · Roger Pau Monne

Prevent hotplug script execution from libxl if device is on a different domain.

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

#12 lore raw

PATCH 3/3 libxl: don't write physical-device node for driver domain disks

In reply to Roger Pau Monne

This will be handled by the driver domain itself, since the toolstack does not have access to the physical device because it is in a different domain.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc George Dunlap <[email protected]>
---
 tools/libxl/libxl.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
tools/libxl/libxl.c +2 -1
index 87bda72..bc91fd5 100644
@@ -2104,7 +2104,8 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
                  * responsible for this since the block device may not
                  * exist yet.
                  */
-                if (!disk->script) {
+                if (!disk->script &&
+                    disk->backend_domid == LIBXL_TOOLSTACK_DOMID) {
                     int major, minor;
                     libxl__device_physdisk_major_minor(dev, &major, &minor);
                     flexarray_append_pair(back, "physical-device",
Signature · 7 lines
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#13 lore raw

Re: [PATCH 3/3] libxl: don't write physical-device node for driver domain disks

Quoted 1 line · Roger Pau Monne

This will be handled by the driver domain itself,

again by udev?

Quoted 17 lines

since the toolstack
does not have access to the physical device because it is in a different domain.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc George Dunlap <[email protected]>
---
 tools/libxl/libxl.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
tools/libxl/libxl.c +0 -0
index 87bda72..bc91fd5 100644

tools/libxl/libxl.c static void device_disk_add(libxl__egc *egc, uint32_t domid, · line 2111

Quoted 9 lines
tools/libxl/libxl.c +2 -1
@@ -2104,7 +2104,8 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
                  * responsible for this since the block device may not
                  * exist yet.
                  */
-                if (!disk->script) {
+                if (!disk->script &&
+                    disk->backend_domid == LIBXL_TOOLSTACK_DOMID) {
                     int major, minor;
                     libxl__device_physdisk_major_minor(dev, &major, &minor);
                     flexarray_append_pair(back, "physical-device",

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

#14 lore raw

Re: [PATCH 3/3] libxl: don't write physical-device node for driver domain disks

Quoted 4 lines · Ian Campbell
Quoted 1 line · Roger Pau Monne

This will be handled by the driver domain itself,

again by udev?

Or xenbackendd (or something similar). It doesn't have to be udev specifically.

Quoted 13 lines
Quoted 13 lines

since the toolstack
does not have access to the physical device because it is in a different domain.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc George Dunlap <[email protected]>
---
 tools/libxl/libxl.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Quoted 16 lines
Quoted 5 lines
tools/libxl/libxl.c +0 -0
index 87bda72..bc91fd5 100644

tools/libxl/libxl.c static void device_disk_add(libxl__egc *egc, uint32_t domid, · line 2111

Quoted 9 lines
tools/libxl/libxl.c +2 -1
@@ -2104,7 +2104,8 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid,
                  * responsible for this since the block device may not
                  * exist yet.
                  */
-                if (!disk->script) {
+                if (!disk->script &&
+                    disk->backend_domid == LIBXL_TOOLSTACK_DOMID) {
                     int major, minor;
                     libxl__device_physdisk_major_minor(dev, &major, &minor);
                     flexarray_append_pair(back, "physical-device",

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

Acked-by on v1 3/3
#15 lore raw

Re: [PATCH 3/3] libxl: don't write physical-device node for driver domain disks

In reply to Roger Pau Monne
Quoted 5 lines · Roger Pau Monne

This will be handled by the driver domain itself, since the toolstack does not have access to the physical device because it is in a different domain.

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

#16 lore raw
In reply to Roger Pau Monne
Quoted 8 lines · Roger Pau Monne

Minor fixes in order to use driver domains for block devices (phy backends). I'm CCing George in order to see if this is suitable for inclusion into 4.3. IMHO I think this should be considered as a bug-fix, that allows the storage driver domain features already present in libxl to be usable for users. I've also created a wiki page that shows how to create and use storage driver domains with xl:

http://wiki.xen.org/wiki/Storage_driver_domains

Since the tree is open again, could this patches be applied?

Thanks, Roger.