SHA256
1
0
forked from pool/libvirt
libvirt/detach-disk.patch

61 lines
2.4 KiB
Diff
Raw Normal View History

Index: libvirt-0.4.6/src/xend_internal.c
===================================================================
--- libvirt-0.4.6.orig/src/xend_internal.c
+++ libvirt-0.4.6/src/xend_internal.c
@@ -5615,11 +5615,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.4.6/src/xs_internal.c
===================================================================
--- libvirt-0.4.6.orig/src/xs_internal.c
+++ libvirt-0.4.6/src/xs_internal.c
@@ -868,7 +868,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;
@@ -886,7 +887,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.4.6/src/xs_internal.h
===================================================================
--- libvirt-0.4.6.orig/src/xs_internal.h
+++ libvirt-0.4.6/src/xs_internal.h
@@ -49,7 +49,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);