Skip to contentSkip to conversation

libxl: add support for FreeBSD block hotplug scripts

PATCH In review Roger Pau Monne 4 participants 17 messages Mar 31, 2016 – Apr 6, 2016

lore
Share & tools
lore
#0 lore raw

v3 cover libxl: add support for FreeBSD block hotplug scripts

This series enables using hotplug scripts with the FreeBSD blkback implementation. Since FreeBSD blkback can use both block devices and regular RAW files as disks, the physical-device-path xenstore backend node is used in order to store the absolute path to the virtual disk image (either a block or a regular file). This series is based on top of George Dunlap's HVM support for hotplug scripts (v3).

The current blkback implementation in FreeBSD HEAD doesn't yet know about hotplug scripts, I plan to commit the FreeBSD side once this series is reviewed.

This series can be found in my git repo at:

git://xenbits.xen.org/people/royger/xen.git freebsd_hotplug_v3

And the FreeBSD side is at:

git://xenbits.xen.org/people/royger/freebsd.git hotplug_scripts

Thanks, Roger.

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

#1 lore raw

PATCH v3 1/8 blkif: document how FreeBSD uses the physical-device backend node

FreeBSD blkback uses the physical-device-path xenstore node in order to fetch the path to the underlying backing storage (either a block device or raw image). This node is set by the hotplug scripts. Also clarify the usage of the physical-device node.

---
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Tim Deegan <[email protected]>
---
Changes since v2:
- Use physical-device-path instead of physical-device in order to store the absolute path to the backing disk image.

---
 xen/include/public/io/blkif.h | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
xen/include/public/io/blkif.h +11 -2
index 99f0326..ce0dbfe 100644
@@ -89,15 +89,23 @@
  *      Values:         string
  *
  *      A free formatted string providing sufficient information for the
- *      backend driver to open the backing device.  (e.g. the path to the
- *      file or block device representing the backing store.)
+ *      hotplug script to attach the device and provide a suitable
+ *      handler (ie: a block device) for blkback to use.
  *
  * physical-device
  *      Values:         "MAJOR:MINOR"
+ *      Notes: 11
  *
  *      MAJOR and MINOR are the major number and minor number of the
  *      backing device respectively.
  *
+ * physical-device-path
+ *      Values:         path string
+ *
+ *      A string that contains the absolute path to the disk image. On
+ *      NetBSD and Linux this is always a block device, while on FreeBSD
+ *      it can be either a block device or a regular file.
+ *
  * type
  *      Values:         "file", "phy", "tap"
  *
@@ -391,6 +399,7 @@
  *     than RING_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST.
  *(10) The discard-secure property may be present and will be set to 1 if the
  *     backing device supports secure discard.
+ *(11) Only used by Linux and NetBSD.
  */
 
 /*
Signature · 7 lines
2.6.4 (Apple Git-63)


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

Re: [PATCH v3 1/8] blkif: document how FreeBSD uses the physical-device backend node

Quoted 6 lines · Roger Pau Monne

FreeBSD blkback uses the physical-device-path xenstore node in order to fetch the path to the underlying backing storage (either a block device or raw image). This node is set by the hotplug scripts. Also clarify the usage of the physical-device node.

Looks good to me:

Quoted 54 lines

---
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Tim Deegan <[email protected]>
---
Changes since v2:
- Use physical-device-path instead of physical-device in order to store the absolute path to the backing disk image.

---
 xen/include/public/io/blkif.h | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
xen/include/public/io/blkif.h +11 -3
index 99f0326..ce0dbfe 100644
@@ -89,15 +89,23 @@
  *      Values:         string
  *
  *      A free formatted string providing sufficient information for the
- *      backend driver to open the backing device.  (e.g. the path to the
- *      file or block device representing the backing store.)
+ *      hotplug script to attach the device and provide a suitable
+ *      handler (ie: a block device) for blkback to use.
  *
  * physical-device
  *      Values:         "MAJOR:MINOR"
+ *      Notes: 11
  *
  *      MAJOR and MINOR are the major number and minor number of the
  *      backing device respectively.
  *
+ * physical-device-path
+ *      Values:         path string
+ *
+ *      A string that contains the absolute path to the disk image. On
+ *      NetBSD and Linux this is always a block device, while on FreeBSD
+ *      it can be either a block device or a regular file.
+ *
  * type
  *      Values:         "file", "phy", "tap"
  *
@@ -391,6 +399,7 @@
  *     than RING_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST.
  *(10) The discard-secure property may be present and will be set to 1 if the
  *     backing device supports secure discard.
+ *(11) Only used by Linux and NetBSD.
  */
 
 /*
--

2.6.4 (Apple Git-63)

Quoted 4 lines

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

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

Acked-by on v3 1/8
#3 lore raw

Re: [PATCH v3 1/8] blkif: document how FreeBSD uses the physical-device backend node

In reply to Roger Pau Monne

Roger Pau Monne writes ("[PATCH v3 1/8] blkif: document how FreeBSD uses the physical-device backend node"):

Quoted 4 lines

FreeBSD blkback uses the physical-device-path xenstore node in order to fetch the path to the underlying backing storage (either a block device or raw image). This node is set by the hotplug scripts. Also clarify the usage of the physical-device node.

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

#4 lore raw

PATCH v3 2/8 hotplug/FreeBSD: add block hotplug script

In reply to Roger Pau Monne

This is the default hotplug script for block devices. Its only job is to copy the "params" blkback xenstore node to "physical-device".

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/hotplug/FreeBSD/Makefile |  2 +-
 tools/hotplug/FreeBSD/block    | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 tools/hotplug/FreeBSD/block
tools/hotplug/FreeBSD/Makefile +1 -1
index 10fce4f..bd7a86f 100644
@@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Xen script dir and scripts to go there.
-XEN_SCRIPTS = vif-bridge
+XEN_SCRIPTS = vif-bridge block
 
 XEN_SCRIPT_DATA =
 
tools/hotplug/FreeBSD/block new file +25 -0
new file mode 100644
index 0000000..a31cca4
@@ -0,0 +1,25 @@
+#!/bin/sh -e
+#
+# FreeBSD hotplug script for attaching disks
+#
+# Parameters:
+#	$1: xenstore backend path of the vbd
+#	$2: action, either "add" or "remove"
+#
+# Environment variables:
+#	None
+#
+
+path=$1
+action=$2
+params=$(xenstore-read "$path/params")
+
+case $action in
+add)
+	xenstore-write $path/physical-device-path $params
+	exit 0
+	;;
+*)
+	exit 0
+	;;
+esac
Signature · 7 lines
2.6.4 (Apple Git-63)


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

PATCH v3 3/8 libxl: refactor the FreeBSD hotplug script code

In reply to Roger Pau Monne

This factors out the nic hotplug specific code from the common code path in order to make it easier to add support for disk hotplug scripts. It shouldn't include any functional change.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
---
Changes since v2:
- Split the refactoring code out of the hotplug disk addition change.

---
 tools/libxl/libxl_freebsd.c | 76 +++++++++++++++++++++++++++------------------
 1 file changed, 45 insertions(+), 31 deletions(-)
tools/libxl/libxl_freebsd.c +45 -31
index 47c3391..54db3d5 100644
@@ -59,14 +59,36 @@ static int libxl__hotplug_env_nic(libxl__gc *gc, libxl__device *dev, char ***env
     return 0;
 }
 
-static int libxl__hotplug_nic(libxl__gc *gc, libxl__device *dev, char ***args,
-                              libxl__device_action action)
+static int libxl__hotplug_nic(libxl__gc *gc, libxl__device *dev,
+                              char ***args, char ***env,
+                              libxl__device_action action,
+                              int num_exec)
 {
+    libxl_nic_type nictype;
     char *be_path = libxl__device_backend_path(gc, dev);
     char *script;
-    int nr = 0, rc = 0, arraysize = 4;
+    int nr = 0, rc;
 
-    assert(dev->backend_kind == LIBXL__DEVICE_KIND_VIF);
+    rc = libxl__nic_type(gc, dev, &nictype);
+    if (rc) {
+        LOG(ERROR, "error when fetching nic type");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    /*
+     * For PV domains only one pass is needed (because there's no emulated
+     * interface). For HVM domains two passes are needed in order to add
+     * both the PV and the tap interfaces to the bridge.
+     */
+    if (nictype == LIBXL_NIC_TYPE_VIF && num_exec != 0) {
+        rc = 0;
+        goto out;
+    }
+
+    rc = libxl__hotplug_env_nic(gc, dev, env, num_exec);
+    if (rc)
+        goto out;
 
     script = libxl__xs_read(gc, XBT_NULL,
                             GCSPRINTF("%s/%s", be_path, "script"));
@@ -76,13 +98,14 @@ static int libxl__hotplug_nic(libxl__gc *gc, libxl__device *dev, char ***args,
         goto out;
     }
 
+    const int arraysize = 4;
     GCNEW_ARRAY(*args, arraysize);
     (*args)[nr++] = script;
     (*args)[nr++] = be_path;
-    (*args)[nr++] = GCSPRINTF("%s", action == LIBXL__DEVICE_ACTION_ADD ?
-                                    "add" : "remove");
+    (*args)[nr++] = (char *) libxl__device_action_to_string(action);
     (*args)[nr++] = NULL;
     assert(nr == arraysize);
+    rc = 1;
 
 out:
     return rc;
@@ -93,36 +116,27 @@ int libxl__get_hotplug_script_info(libxl__gc *gc, libxl__device *dev,
                                    libxl__device_action action,
                                    int num_exec)
 {
-    libxl_nic_type nictype;
     int rc;
 
-    if (dev->backend_kind != LIBXL__DEVICE_KIND_VIF || num_exec == 2)
-        return 0;
-
-    rc = libxl__nic_type(gc, dev, &nictype);
-    if (rc) {
-        LOG(ERROR, "error when fetching nic type");
-        rc = ERROR_FAIL;
-        goto out;
-    }
-
-    /*
-     * For PV domains only one pass is needed (because there's no emulated
-     * interface). For HVM domains two passes are needed in order to add
-     * both the PV and the tap interfaces to the bridge.
-     */
-    if (nictype == LIBXL_NIC_TYPE_VIF && num_exec != 0) {
+    switch (dev->backend_kind) {
+    case LIBXL__DEVICE_KIND_VIF:
+        /*
+         * If domain has a stubdom we don't have to execute hotplug scripts
+         * for emulated interfaces
+         */
+        if ((num_exec > 1) ||
+            (libxl_get_stubdom_id(CTX, dev->domid) && num_exec)) {
+            rc = 0;
+            goto out;
+        }
+        rc = libxl__hotplug_nic(gc, dev, args, env, action, num_exec);
+        break;
+    default:
+        /* No need to execute any hotplug scripts */
         rc = 0;
-        goto out;
+        break;
     }
 
-    rc = libxl__hotplug_env_nic(gc, dev, env, num_exec);
-    if (rc)
-        goto out;
-
-    rc = libxl__hotplug_nic(gc, dev, args, action);
-    if (!rc) rc = 1;
-
 out:
     return rc;
 }
Signature · 7 lines
2.6.4 (Apple Git-63)


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

Re: [PATCH v3 3/8] libxl: refactor the FreeBSD hotplug script code

Roger Pau Monne writes ("[PATCH v3 3/8] libxl: refactor the FreeBSD hotplug script code"):

Quoted 3 lines

This factors out the nic hotplug specific code from the common code path in order to make it easier to add support for disk hotplug scripts. It shouldn't include any functional change.

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

#7 lore raw

PATCH v3 4/8 libxl: add support for disk hotplug scripts on FreeBSD

In reply to Roger Pau Monne

Allow FreeBSD to execute hotplug scripts when attaching disk devices.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
---
Changes since v2:
- Split the refactoring in a separate patch.

---
 tools/libxl/libxl_freebsd.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
tools/libxl/libxl_freebsd.c +36 -0
index 54db3d5..e86e28c 100644
@@ -111,6 +111,35 @@ out:
     return rc;
 }
 
+static int libxl__hotplug_disk(libxl__gc *gc, libxl__device *dev,
+                               char ***args, char ***env,
+                               libxl__device_action action)
+{
+    char *be_path = libxl__device_backend_path(gc, dev);
+    char *script;
+    int nr = 0, rc;
+
+    script = libxl__xs_read(gc, XBT_NULL,
+                            GCSPRINTF("%s/%s", be_path, "script"));
+    if (!script) {
+        LOGEV(ERROR, errno, "unable to read script from %s", be_path);
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    const int arraysize = 4;
+    GCNEW_ARRAY(*args, arraysize);
+    (*args)[nr++] = script;
+    (*args)[nr++] = be_path;
+    (*args)[nr++] = (char *) libxl__device_action_to_string(action);
+    (*args)[nr++] = NULL;
+    assert(nr == arraysize);
+    rc = 1;
+
+out:
+    return rc;
+}
+
 int libxl__get_hotplug_script_info(libxl__gc *gc, libxl__device *dev,
                                    char ***args, char ***env,
                                    libxl__device_action action,
@@ -131,6 +160,13 @@ int libxl__get_hotplug_script_info(libxl__gc *gc, libxl__device *dev,
         }
         rc = libxl__hotplug_nic(gc, dev, args, env, action, num_exec);
         break;
+    case LIBXL__DEVICE_KIND_VBD:
+        if (num_exec != 0) {
+            rc = 0;
+            goto out;
+        }
+        rc = libxl__hotplug_disk(gc, dev, args, env, action);
+        break;
     default:
         /* No need to execute any hotplug scripts */
         rc = 0;
Signature · 7 lines
2.6.4 (Apple Git-63)


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

Re: [PATCH v3 4/8] libxl: add support for disk hotplug scripts on FreeBSD

Roger Pau Monne writes ("[PATCH v3 4/8] libxl: add support for disk hotplug scripts on FreeBSD"):

Quoted 1 line

Allow FreeBSD to execute hotplug scripts when attaching disk devices.

I am going to commit the FreeBSD-only patches without detailed review, on the basis that you're the expert.

Thanks,
Ian.

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

#9 lore raw

PATCH v3 5/8 libxl: properly use vdev vs local device

In reply to Roger Pau Monne

The current code in libxl assumed that vdev is equal to local device, but this is only true for Linux systems. In other OSes the local device can use a nomenclature completely different from the virtual device one.

Move the current libxl__devid_to_localdev Linux implementation out of the OS-specific file and rename it to libxl__devid_to_vdev, and then make sure local_device_attach_cb return the local device in the diskpath field.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/libxl.c          | 12 ++++------
 tools/libxl/libxl_device.c   | 57 ++++++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl_internal.h |  1 +
 tools/libxl/libxl_linux.c    | 49 +------------------------------------
 4 files changed, 64 insertions(+), 55 deletions(-)
tools/libxl/libxl.c +5 -7
index 944f4d1..a2767fa 100644
@@ -2989,7 +2989,7 @@ static char * libxl__alloc_vdev(libxl__gc *gc, void *get_vdev_user,
                     GCSPRINTF("%s/device/vbd/%d/backend",
                         dompath, devid)) == NULL) {
             if (errno == ENOENT)
-                return libxl__devid_to_localdev(gc, devid);
+                return libxl__devid_to_vdev(gc, devid);
             else
                 return NULL;
         }
@@ -3126,7 +3126,7 @@ static void local_device_attach_cb(libxl__egc *egc, libxl__ao_device *aodev)
 {
     STATE_AO_GC(aodev->ao);
     libxl__disk_local_state *dls = CONTAINER_OF(aodev, *dls, aodev);
-    char *dev = NULL, *be_path = NULL;
+    char *be_path = NULL;
     int rc;
     libxl__device device;
     libxl_device_disk *disk = &dls->disk;
@@ -3140,9 +3140,6 @@ static void local_device_attach_cb(libxl__egc *egc, libxl__ao_device *aodev)
         goto out;
     }
 
-    dev = GCSPRINTF("/dev/%s", disk->vdev);
-    LOG(DEBUG, "locally attaching disk %s", dev);
-
     rc = libxl__device_from_disk(gc, LIBXL_TOOLSTACK_DOMID, disk, &device);
     if (rc < 0)
         goto out;
@@ -3151,8 +3148,9 @@ static void local_device_attach_cb(libxl__egc *egc, libxl__ao_device *aodev)
     if (rc < 0)
         goto out;
 
-    if (dev != NULL)
-        dls->diskpath = libxl__strdup(gc, dev);
+    dls->diskpath = GCSPRINTF("/dev/%s",
+                              libxl__devid_to_localdev(gc, device.devid));
+    LOG(DEBUG, "locally attached disk %s", dls->diskpath);
 
     dls->callback(egc, dls, 0);
     return;
tools/libxl/libxl_device.c +57 -0

63 lines not on this page · raw message

tools/libxl/libxl_internal.h +1 -0
index 9fde212..6f80917 100644
@@ -1156,6 +1156,7 @@ _hidden int libxl__device_disk_set_backend(libxl__gc*, libxl_device_disk*);
 _hidden int libxl__device_physdisk_major_minor(const char *physpath, int *major, int *minor);
 _hidden int libxl__device_disk_dev_number(const char *virtpath,
                                           int *pdisk, int *ppartition);
+_hidden char *libxl__devid_to_vdev(libxl__gc *gc, int devid);
 
 _hidden int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
                                       libxl__device_console *console,
tools/libxl/libxl_linux.c +1 -48

57 lines not on this page · raw message

Signature · 7 lines
2.6.4 (Apple Git-63)


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

PATCH v3 6/8 libxl: add a FreeBSD implementation of libxl__devid_to_localdev

In reply to Roger Pau Monne

This code is extracted from the FreeBSD blkfront implementation.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/libxl_freebsd.c | 54 +++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 52 insertions(+), 2 deletions(-)
tools/libxl/libxl_freebsd.c +52 -2
index e86e28c..c527455 100644
@@ -27,8 +27,58 @@ int libxl__try_phy_backend(mode_t st_mode)
 
 char *libxl__devid_to_localdev(libxl__gc *gc, int devid)
 {
-    /* TODO */
-    return NULL;
+    /* This translation table has been copied from the FreeBSD blkfront code. */
+    const static struct vdev_info {
+        int major;
+        int shift;
+        int base;
+        const char *name;
+    } info[] = {
+        {3,     6,  0,      "ada"}, /* ide0 */
+        {22,    6,  2,      "ada"}, /* ide1 */
+        {33,    6,  4,      "ada"}, /* ide2 */
+        {34,    6,  6,      "ada"}, /* ide3 */
+        {56,    6,  8,      "ada"}, /* ide4 */
+        {57,    6,  10,     "ada"}, /* ide5 */
+        {88,    6,  12,     "ada"}, /* ide6 */
+        {89,    6,  14,     "ada"}, /* ide7 */
+        {90,    6,  16,     "ada"}, /* ide8 */
+        {91,    6,  18,     "ada"}, /* ide9 */
+
+        {8,     4,  0,      "da"},  /* scsi disk0 */
+        {65,    4,  16,     "da"},  /* scsi disk1 */
+        {66,    4,  32,     "da"},  /* scsi disk2 */
+        {67,    4,  48,     "da"},  /* scsi disk3 */
+        {68,    4,  64,     "da"},  /* scsi disk4 */
+        {69,    4,  80,     "da"},  /* scsi disk5 */
+        {70,    4,  96,     "da"},  /* scsi disk6 */
+        {71,    4,  112,    "da"},  /* scsi disk7 */
+        {128,   4,  128,    "da"},  /* scsi disk8 */
+        {129,   4,  144,    "da"},  /* scsi disk9 */
+        {130,   4,  160,    "da"},  /* scsi disk10 */
+        {131,   4,  176,    "da"},  /* scsi disk11 */
+        {132,   4,  192,    "da"},  /* scsi disk12 */
+        {133,   4,  208,    "da"},  /* scsi disk13 */
+        {134,   4,  224,    "da"},  /* scsi disk14 */
+        {135,   4,  240,    "da"},  /* scsi disk15 */
+
+        {202,   4,  0,      "xbd"}, /* xbd */
+
+        {0, 0,  0,  NULL},
+    };
+    int major = devid >> 8;
+    int minor = devid & 0xff;
+    int i;
+
+    if (devid & (1 << 28))
+        return GCSPRINTF("%s%d", "xbd", (devid & ((1 << 28) - 1)) >> 8);
+
+    for (i = 0; info[i].major; i++)
+        if (info[i].major == major)
+            return GCSPRINTF("%s%d", info[i].name,
+                             info[i].base + (minor >> info[i].shift));
+
+    return GCSPRINTF("%s%d", "xbd", minor >> 4);
 }
 
 /* Hotplug scripts caller functions */
Signature · 7 lines
2.6.4 (Apple Git-63)


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

PATCH v3 7/8 libxl: fix error message in local_device_attach_cb

In reply to Roger Pau Monne

The fields that are printed might not be set in the case of a failure, which generates a segmentation fault.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/libxl/libxl.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
tools/libxl/libxl.c +1 -4
index a2767fa..0d2f55c 100644
@@ -3133,10 +3133,7 @@ static void local_device_attach_cb(libxl__egc *egc, libxl__ao_device *aodev)
 
     rc = aodev->rc;
     if (rc) {
-        LOGE(ERROR, "unable to %s %s with id %u",
-                    libxl__device_action_to_string(aodev->action),
-                    libxl__device_kind_to_string(aodev->dev->kind),
-                    aodev->dev->devid);
+        LOGE(ERROR, "unable locally attach device: %s", disk->pdev_path);
         goto out;
     }
 
Signature · 7 lines
2.6.4 (Apple Git-63)


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

PATCH v3 8/8 hotplug/FreeBSD: document disk hotplug interface

In reply to Roger Pau Monne

Add the FreeBSD disk hotplug interface details to the block-scripts.txt document.

---
Cc: Ian Jackson <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Wei Liu <[email protected]>

---
 docs/misc/block-scripts.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)
docs/misc/block-scripts.txt +13 -0
index f9a001e..eabab10 100644
@@ -48,6 +48,19 @@ written into xenstore:
  $XENBUS/params    The contents of the 'target' section of the disk specification verbatim.
  $XENBUS/mode      'r' (for readonly) or 'w' (for read-write)
 
+Inputs (FreeBSD)
+--------------
+
+The scripts are always called with the same set of arguments. The first
+parameter is the xenstore backend path of the device, while the second
+argument is the action, which is always either "add" or "remove".
+
+When the script is run, the following nodes shall already have been
+written into xenstore:
+
+ $XENBUS/params    The contents of the 'target' section of the disk specification verbatim.
+ $XENBUS/mode      'r' (for readonly) or 'w' (for read-write)
+
 Inputs (NetBSD)
 ---------------
 
Signature · 7 lines
2.6.4 (Apple Git-63)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#14 lore raw
In reply to Roger Pau Monne
Quoted 7 lines · Roger Pau Monne

This series enables using hotplug scripts with the FreeBSD blkback implementation. Since FreeBSD blkback can use both block devices and regular RAW files as disks, the physical-device-path xenstore backend node is used in order to store the absolute path to the virtual disk image (either a block or a regular file). This series is based on top of George Dunlap's HVM support for hotplug scripts (v3).

Quoted 7 lines

The current blkback implementation in FreeBSD HEAD doesn't yet know about hotplug scripts, I plan to commit the FreeBSD side once this series is reviewed.

This series can be found in my git repo at:

git://xenbits.xen.org/people/royger/xen.git freebsd_hotplug_v3

Looks like you've also got a couple of other miscellaneous fixes in the tree that aren't in the series:

66294f1 Thu Mar 31 14:56:35 2016 +0200 Roger Pau Monne
tools/build: remove usage of sed -i
663275d Thu Feb 25 16:29:04 2016 +0100 Roger Pau Monne libxl:
fix POLLHUP handling

:-)

(Just pointing that out so nobody else is similarly confused)

-George

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

#15 lore raw
Quoted 19 lines · George Dunlap
Quoted 7 lines · Roger Pau Monne

This series enables using hotplug scripts with the FreeBSD blkback implementation. Since FreeBSD blkback can use both block devices and regular RAW files as disks, the physical-device-path xenstore backend node is used in order to store the absolute path to the virtual disk image (either a block or a regular file). This series is based on top of George Dunlap's HVM support for hotplug scripts (v3).

Quoted 7 lines

The current blkback implementation in FreeBSD HEAD doesn't yet know about hotplug scripts, I plan to commit the FreeBSD side once this series is reviewed.

This series can be found in my git repo at:

git://xenbits.xen.org/people/royger/xen.git freebsd_hotplug_v3

Looks like you've also got a couple of other miscellaneous fixes in the tree that aren't in the series:

Quoted 8 lines

66294f1 Thu Mar 31 14:56:35 2016 +0200 Roger Pau Monne
tools/build: remove usage of sed -i
663275d Thu Feb 25 16:29:04 2016 +0100 Roger Pau Monne libxl:
fix POLLHUP handling

:-)

(Just pointing that out so nobody else is similarly confused)

Oh yes, sorry, those are needed in order to build or test on FreeBSD. They are all already posted to xen-devel (just not as part of this series because it didn't make sense).

Roger.

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

#16 lore raw
In reply to Roger Pau Monne

Roger Pau Monne writes ("[Xen-devel] [PATCH v3 0/8] libxl: add support for FreeBSD block hotplug scripts"):

Quoted 7 lines

This series enables using hotplug scripts with the FreeBSD blkback implementation. Since FreeBSD blkback can use both block devices and regular RAW files as disks, the physical-device-path xenstore backend node is used in order to store the absolute path to the virtual disk image (either a block or a regular file). This series is based on top of George Dunlap's HVM support for hotplug scripts (v3).

Quoted 7 lines

The current blkback implementation in FreeBSD HEAD doesn't yet know about hotplug scripts, I plan to commit the FreeBSD side once this series is reviewed.

This series can be found in my git repo at:

git://xenbits.xen.org/people/royger/xen.git freebsd_hotplug_v3

I have queued this for staging.

Thanks,
Ian.

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