[libvirt] [PATCH 16/18] conf: use disk source accessors in xen/

Eric Blake eblake at redhat.com
Wed Mar 19 17:20:48 UTC 2014


Part of a series of cleanups to use new accessor methods.

* src/xen/xend_internal.c (virDomainXMLDevID): Use accessors.

Signed-off-by: Eric Blake <eblake at redhat.com>
---
 src/xen/xend_internal.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 4b10f42..55604bc 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -1,7 +1,7 @@
 /*
  * xend_internal.c: access to Xen though the Xen Daemon interface
  *
- * Copyright (C) 2010-2013 Red Hat, Inc.
+ * Copyright (C) 2010-2014 Red Hat, Inc.
  * Copyright (C) 2005 Anthony Liguori <aliguori at us.ibm.com>
  *
  * This library is free software; you can redistribute it and/or
@@ -3338,14 +3338,11 @@ virDomainXMLDevID(virConnectPtr conn,
     xenUnifiedPrivatePtr priv = conn->privateData;
     char *xref;
     char *tmp;
+    const char *driver = virDomainDiskGetDriver(dev->data.disk);

     if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
-        if (dev->data.disk->driverName &&
-            STREQ(dev->data.disk->driverName, "tap"))
-            strcpy(class, "tap");
-        else if (dev->data.disk->driverName &&
-            STREQ(dev->data.disk->driverName, "tap2"))
-            strcpy(class, "tap2");
+        if (STREQ_NULLABLE(driver, "tap") || STREQ_NULLABLE(driver, "tap2"))
+            strcpy(class, driver);
         else
             strcpy(class, "vbd");

-- 
1.8.5.3




More information about the libvir-list mailing list