Skip to contentSkip to conversation

libxenlight resend: disc and nic destroy calls

PATCH In review Andres Lagar-Cavilla 2 participants 3 messages Dec 2, 2009 – Dec 3, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 2/7 libxenlight resend: disc and nic destroy calls

Expose disk and nic device destroy calls, to allow hot unplugging of devices from domains.

# HG changeset patch
# User Andres Lagar-Cavilla <[email protected]> # Date 1259038343 18000
# Node ID 70f6966c89bf7f2c1db78a814452e1de79044962 # Parent 68b17d151db6c9a31ca55c359742f0d3515a0a5a Expose disk and nic device destroy calls, to allow hot unplugging of devices from domains.

libxl.c +32 -0
diff -r 68b17d151db6 -r 70f6966c89bf libxl.c
@@ -1111,6 +1111,23 @@ int libxl_device_disk_add(struct libxl_c
     return 0;
 }
 
+int libxl_device_disk_del(struct libxl_ctx *ctx, 
+                          libxl_device_disk *disk, int wait)
+{
+    libxl_device device;
+    int devid;
+
+    devid = device_disk_dev_number(disk->virtpath);
+    device.backend_domid    = disk->backend_domid;
+    device.backend_devid    = devid;
+    device.backend_kind     = 
+        (disk->phystype == PHYSTYPE_PHY) ? DEVICE_VBD : DEVICE_TAP;
+    device.domid            = disk->domid;
+    device.devid            = devid;
+    device.kind             = DEVICE_VBD;
+    return libxl_device_del(ctx, &device, wait);
+}
+
 int libxl_device_disk_clean_shutdown(struct libxl_ctx *ctx, uint32_t domid)
 {
     return ERROR_NI;
@@ -1184,6 +1201,21 @@ int libxl_device_nic_add(struct libxl_ct
     return 0;
 }
 
+int libxl_device_nic_del(struct libxl_ctx *ctx, 
+                         libxl_device_nic *nic, int wait)
+{
+    libxl_device device;
+
+    device.backend_devid    = nic->devid;
+    device.backend_domid    = nic->backend_domid;
+    device.backend_kind     = DEVICE_VIF;
+    device.devid            = nic->devid;
+    device.domid            = nic->domid;
+    device.kind             = DEVICE_VIF;
+
+    return libxl_device_del(ctx, &device, wait);
+}
+
 int libxl_device_nic_clean_shutdown(struct libxl_ctx *ctx, uint32_t domid)
 {
     return ERROR_NI;
libxl.h +2 -0
diff -r 68b17d151db6 -r 70f6966c89bf libxl.h
@@ -295,10 +295,12 @@ int libxl_detach_device_model(struct lib
   /* DM is detached even if error is returned */
 
 int libxl_device_disk_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk);
+int libxl_device_disk_del(struct libxl_ctx *ctx, libxl_device_disk *disk, int wait);
 int libxl_device_disk_clean_shutdown(struct libxl_ctx *ctx, uint32_t domid);
 int libxl_device_disk_hard_shutdown(struct libxl_ctx *ctx, uint32_t domid);
 
 int libxl_device_nic_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic);
+int libxl_device_nic_del(struct libxl_ctx *ctx, libxl_device_nic *nic, int wait);
 int libxl_device_nic_clean_shutdown(struct libxl_ctx *ctx, uint32_t domid);
 int libxl_device_nic_hard_shutdown(struct libxl_ctx *ctx, uint32_t domid);
 

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

Acked-by on v1 2/7
#1 lore raw
Quoted 6 lines · Andres Lagar-Cavilla

Expose disk and nic device destroy calls, to allow hot unplugging of devices from domains.

The patch is fine, I think at this point you could remove the libxl_device_nic_clean_shutdown, libxl_device_nic_hard_shutdown and co, or modify them instead of creating a new function.

In any case I ack this patch even as it is.