libvirt/detach-disk.patch

61 lines
2.5 KiB
Diff

Index: libvirt-0.5.1/src/xend_internal.c
===================================================================
--- libvirt-0.5.1.orig/src/xend_internal.c
+++ libvirt-0.5.1/src/xend_internal.c
@@ -5465,11 +5465,16 @@ virDomainXMLDevID(virDomainPtr domain,
char *xref;
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
- strcpy(class, "vbd");
if (dev->data.disk->dst == NULL)
return -1;
+
+ if (dev->data.disk->driverName &&
+ (strcasecmp(dev->data.disk->driverName, "tap") == 0))
+ strcpy(class, "tap");
+ else
+ strcpy(class, "vbd");
xref = xenStoreDomainGetDiskID(domain->conn, domain->id,
- dev->data.disk->dst);
+ dev->data.disk->dst, class);
if (xref == NULL)
return -1;
Index: libvirt-0.5.1/src/xs_internal.c
===================================================================
--- libvirt-0.5.1.orig/src/xs_internal.c
+++ libvirt-0.5.1/src/xs_internal.c
@@ -917,7 +917,8 @@ xenStoreDomainGetNetworkID(virConnectPtr
* freed by the caller.
*/
char *
-xenStoreDomainGetDiskID(virConnectPtr conn, int id, const char *dev) {
+xenStoreDomainGetDiskID(virConnectPtr conn, int id,
+ const char *dev, const char *class) {
char dir[80], path[128], **list = NULL, *val = NULL;
unsigned int devlen, len, i, num;
char *ret = NULL;
@@ -935,7 +936,7 @@ xenStoreDomainGetDiskID(virConnectPtr co
if (devlen <= 0)
return (NULL);
- snprintf(dir, sizeof(dir), "/local/domain/0/backend/vbd/%d", id);
+ snprintf(dir, sizeof(dir), "/local/domain/0/backend/%s/%d", class, id);
list = xs_directory(priv->xshandle, 0, dir, &num);
if (list != NULL) {
for (i = 0; i < num; i++) {
Index: libvirt-0.5.1/src/xs_internal.h
===================================================================
--- libvirt-0.5.1.orig/src/xs_internal.h
+++ libvirt-0.5.1/src/xs_internal.h
@@ -48,7 +48,8 @@ char * xenStoreDomainGetNetworkID(virCo
const char *mac);
char * xenStoreDomainGetDiskID(virConnectPtr conn,
int id,
- const char *dev);
+ const char *dev,
+ const char *class);
char * xenStoreDomainGetName(virConnectPtr conn,
int id);
int xenStoreDomainGetUUID(virConnectPtr conn,