[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 3/8] Remove virConnectPtr from all node device XML APIs



The virConnectPtr is no longer required for error reporting since
that is recorded in a thread local. Remove use of virConnectPtr
from all APIs in node_device_conf.{h,c} and update all callers to
match
---
 src/conf/node_device_conf.c          |  208 +++++++++++++++-------------------
 src/conf/node_device_conf.h          |   27 ++---
 src/node_device/node_device_driver.c |   57 ++++-----
 src/node_device/node_device_hal.c    |    3 +-
 src/node_device/node_device_udev.c   |    4 +-
 src/qemu/qemu_driver.c               |    2 +-
 src/test/test_driver.c               |   44 ++++----
 src/xen/xen_driver.c                 |    2 +-
 tests/nodedevxml2xmltest.c           |    4 +-
 9 files changed, 155 insertions(+), 196 deletions(-)

diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index d04505a..4b65953 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -60,8 +60,7 @@ VIR_ENUM_IMPL(virNodeDevHBACap, VIR_NODE_DEV_CAP_HBA_LAST,
 
 
 static int
-virNodeDevCapsDefParseString(virConnectPtr conn,
-                             const char *xpath,
+virNodeDevCapsDefParseString(const char *xpath,
                              xmlXPathContextPtr ctxt,
                              char **string,
                              virNodeDeviceDefPtr def,
@@ -71,7 +70,7 @@ virNodeDevCapsDefParseString(virConnectPtr conn,
 
     s = virXPathString(xpath, ctxt);
     if (s == NULL) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  missing_error_fmt,
                                  def->name);
         return -1;
@@ -174,8 +173,7 @@ void virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs)
     devs->count = 0;
 }
 
-virNodeDeviceObjPtr virNodeDeviceAssignDef(virConnectPtr conn,
-                                           virNodeDeviceObjListPtr devs,
+virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
                                            const virNodeDeviceDefPtr def)
 {
     virNodeDeviceObjPtr device;
@@ -192,7 +190,7 @@ virNodeDeviceObjPtr virNodeDeviceAssignDef(virConnectPtr conn,
     }
 
     if (virMutexInit(&device->lock) < 0) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  "%s", _("cannot initialize mutex"));
         VIR_FREE(device);
         return NULL;
@@ -241,8 +239,7 @@ void virNodeDeviceObjRemove(virNodeDeviceObjListPtr devs,
     }
 }
 
-char *virNodeDeviceDefFormat(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
-                             const virNodeDeviceDefPtr def)
+char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     virNodeDevCapsDefPtr caps;
@@ -500,8 +497,7 @@ char *virNodeDeviceDefFormat(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
 }
 
 static int
-virNodeDevCapsDefParseULong(virConnectPtr conn,
-                            const char *xpath,
+virNodeDevCapsDefParseULong(const char *xpath,
                             xmlXPathContextPtr ctxt,
                             unsigned *value,
                             virNodeDeviceDefPtr def,
@@ -513,7 +509,7 @@ virNodeDevCapsDefParseULong(virConnectPtr conn,
 
     ret = virXPathULong(xpath, ctxt, &val);
     if (ret < 0) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  ret == -1 ? missing_error_fmt : invalid_error_fmt,
                                  def->name);
         return -1;
@@ -524,8 +520,7 @@ virNodeDevCapsDefParseULong(virConnectPtr conn,
 }
 
 static int
-virNodeDevCapsDefParseULongLong(virConnectPtr conn,
-                                const char *xpath,
+virNodeDevCapsDefParseULongLong(const char *xpath,
                                 xmlXPathContextPtr ctxt,
                                 unsigned long long *value,
                                 virNodeDeviceDefPtr def,
@@ -537,7 +532,7 @@ virNodeDevCapsDefParseULongLong(virConnectPtr conn,
 
     ret = virXPathULongLong(xpath, ctxt, &val);
     if (ret < 0) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  ret == -1 ? missing_error_fmt : invalid_error_fmt,
                                  def->name);
         return -1;
@@ -548,8 +543,7 @@ virNodeDevCapsDefParseULongLong(virConnectPtr conn,
 }
 
 static int
-virNodeDevCapStorageParseXML(virConnectPtr conn,
-                             xmlXPathContextPtr ctxt,
+virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
                              virNodeDeviceDefPtr def,
                              xmlNodePtr node,
                              union _virNodeDevCapData *data)
@@ -563,7 +557,7 @@ virNodeDevCapStorageParseXML(virConnectPtr conn,
 
     data->storage.block = virXPathString("string(./block[1])", ctxt);
     if (!data->storage.block) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("no block device path supplied for '%s'"),
                                  def->name);
         goto out;
@@ -576,7 +570,7 @@ virNodeDevCapStorageParseXML(virConnectPtr conn,
     data->storage.serial     = virXPathString("string(./serial[1])", ctxt);
 
     if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("error parsing storage capabilities for '%s'"),
                                  def->name);
         goto out;
@@ -586,7 +580,7 @@ virNodeDevCapStorageParseXML(virConnectPtr conn,
         char *type = virXMLPropString(nodes[i], "type");
 
         if (!type) {
-            virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                      _("missing storage capability type for '%s'"),
                                      def->name);
             goto out;
@@ -608,7 +602,7 @@ virNodeDevCapStorageParseXML(virConnectPtr conn,
             data->storage.media_label = virXPathString("string(./media_label[1])", ctxt);
 
             val = 0;
-            if (virNodeDevCapsDefParseULongLong(conn, "number(./media_size[1])", ctxt, &val, def,
+            if (virNodeDevCapsDefParseULongLong("number(./media_size[1])", ctxt, &val, def,
                                                 _("no removable media size supplied for '%s'"),
                                                 _("invalid removable media size supplied for '%s'")) < 0) {
                 ctxt->node = orignode2;
@@ -619,7 +613,7 @@ virNodeDevCapStorageParseXML(virConnectPtr conn,
 
             ctxt->node = orignode2;
         } else {
-            virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                      _("unknown storage capability type '%s' for '%s'"),
                                      type, def->name);
             VIR_FREE(type);
@@ -631,7 +625,7 @@ virNodeDevCapStorageParseXML(virConnectPtr conn,
 
     if (!(data->storage.flags & VIR_NODE_DEV_CAP_STORAGE_REMOVABLE)) {
         val = 0;
-        if (virNodeDevCapsDefParseULongLong(conn, "number(./size[1])", ctxt, &val, def,
+        if (virNodeDevCapsDefParseULongLong("number(./size[1])", ctxt, &val, def,
                                             _("no size supplied for '%s'"),
                                             _("invalid size supplied for '%s'")) < 0)
             goto out;
@@ -646,8 +640,7 @@ out:
 }
 
 static int
-virNodeDevCapScsiParseXML(virConnectPtr conn,
-                          xmlXPathContextPtr ctxt,
+virNodeDevCapScsiParseXML(xmlXPathContextPtr ctxt,
                           virNodeDeviceDefPtr def,
                           xmlNodePtr node,
                           union _virNodeDevCapData *data)
@@ -658,25 +651,25 @@ virNodeDevCapScsiParseXML(virConnectPtr conn,
     orignode = ctxt->node;
     ctxt->node = node;
 
-    if (virNodeDevCapsDefParseULong(conn, "number(./host[1])", ctxt,
+    if (virNodeDevCapsDefParseULong("number(./host[1])", ctxt,
                                     &data->scsi.host, def,
                                     _("no SCSI host ID supplied for '%s'"),
                                     _("invalid SCSI host ID supplied for '%s'")) < 0)
         goto out;
 
-    if (virNodeDevCapsDefParseULong(conn, "number(./bus[1])", ctxt,
+    if (virNodeDevCapsDefParseULong("number(./bus[1])", ctxt,
                                     &data->scsi.bus, def,
                                     _("no SCSI bus ID supplied for '%s'"),
                                     _("invalid SCSI bus ID supplied for '%s'")) < 0)
         goto out;
 
-    if (virNodeDevCapsDefParseULong(conn, "number(./target[1])", ctxt,
+    if (virNodeDevCapsDefParseULong("number(./target[1])", ctxt,
                                     &data->scsi.target, def,
                                     _("no SCSI target ID supplied for '%s'"),
                                     _("invalid SCSI target ID supplied for '%s'")) < 0)
         goto out;
 
-    if (virNodeDevCapsDefParseULong(conn, "number(./lun[1])", ctxt,
+    if (virNodeDevCapsDefParseULong("number(./lun[1])", ctxt,
                                     &data->scsi.lun, def,
                                     _("no SCSI LUN ID supplied for '%s'"),
                                     _("invalid SCSI LUN ID supplied for '%s'")) < 0)
@@ -692,8 +685,7 @@ out:
 
 
 static int
-virNodeDevCapScsiTargetParseXML(virConnectPtr conn,
-                                xmlXPathContextPtr ctxt,
+virNodeDevCapScsiTargetParseXML(xmlXPathContextPtr ctxt,
                                 virNodeDeviceDefPtr def,
                                 xmlNodePtr node,
                                 union _virNodeDevCapData *data)
@@ -706,7 +698,7 @@ virNodeDevCapScsiTargetParseXML(virConnectPtr conn,
 
     data->scsi_target.name = virXPathString("string(./name[1])", ctxt);
     if (!data->scsi_target.name) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("no target name supplied for '%s'"),
                                  def->name);
         goto out;
@@ -721,8 +713,7 @@ out:
 
 
 static int
-virNodeDevCapScsiHostParseXML(virConnectPtr conn,
-                              xmlXPathContextPtr ctxt,
+virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt,
                               virNodeDeviceDefPtr def,
                               xmlNodePtr node,
                               union _virNodeDevCapData *data,
@@ -736,7 +727,7 @@ virNodeDevCapScsiHostParseXML(virConnectPtr conn,
     ctxt->node = node;
 
     if (create == EXISTING_DEVICE &&
-        virNodeDevCapsDefParseULong(conn, "number(./host[1])", ctxt,
+        virNodeDevCapsDefParseULong("number(./host[1])", ctxt,
                                     &data->scsi_host.host, def,
                                     _("no SCSI host ID supplied for '%s'"),
                                     _("invalid SCSI host ID supplied for '%s'")) < 0) {
@@ -744,7 +735,7 @@ virNodeDevCapScsiHostParseXML(virConnectPtr conn,
     }
 
     if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("error parsing SCSI host capabilities for '%s'"),
                                  def->name);
         goto out;
@@ -754,7 +745,7 @@ virNodeDevCapScsiHostParseXML(virConnectPtr conn,
         type = virXMLPropString(nodes[i], "type");
 
         if (!type) {
-            virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                      _("missing SCSI host capability type for '%s'"),
                                      def->name);
             goto out;
@@ -773,7 +764,7 @@ virNodeDevCapScsiHostParseXML(virConnectPtr conn,
             orignode2 = ctxt->node;
             ctxt->node = nodes[i];
 
-            if (virNodeDevCapsDefParseString(conn, "string(./wwnn[1])",
+            if (virNodeDevCapsDefParseString("string(./wwnn[1])",
                                              ctxt,
                                              &data->scsi_host.wwnn,
                                              def,
@@ -781,7 +772,7 @@ virNodeDevCapScsiHostParseXML(virConnectPtr conn,
                 goto out;
             }
 
-            if (virNodeDevCapsDefParseString(conn, "string(./wwpn[1])",
+            if (virNodeDevCapsDefParseString("string(./wwpn[1])",
                                              ctxt,
                                              &data->scsi_host.wwpn,
                                              def,
@@ -792,7 +783,7 @@ virNodeDevCapScsiHostParseXML(virConnectPtr conn,
             ctxt->node = orignode2;
 
         } else {
-            virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                      _("unknown SCSI host capability type '%s' for '%s'"),
                                      type, def->name);
             goto out;
@@ -811,8 +802,7 @@ out:
 
 
 static int
-virNodeDevCapNetParseXML(virConnectPtr conn,
-                         xmlXPathContextPtr ctxt,
+virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt,
                          virNodeDeviceDefPtr def,
                          xmlNodePtr node,
                          union _virNodeDevCapData *data)
@@ -826,7 +816,7 @@ virNodeDevCapNetParseXML(virConnectPtr conn,
 
     data->net.ifname = virXPathString("string(./interface[1])", ctxt);
     if (!data->net.ifname) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("no network interface supplied for '%s'"),
                                  def->name);
         goto out;
@@ -841,7 +831,7 @@ virNodeDevCapNetParseXML(virConnectPtr conn,
         int val = virNodeDevNetCapTypeFromString(tmp);
         VIR_FREE(tmp);
         if (val < 0) {
-            virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                      _("invalid network type supplied for '%s'"),
                                      def->name);
             goto out;
@@ -856,8 +846,7 @@ out:
 }
 
 static int
-virNodeDevCapUsbInterfaceParseXML(virConnectPtr conn,
-                                  xmlXPathContextPtr ctxt,
+virNodeDevCapUsbInterfaceParseXML(xmlXPathContextPtr ctxt,
                                   virNodeDeviceDefPtr def,
                                   xmlNodePtr node,
                                   union _virNodeDevCapData *data)
@@ -868,25 +857,25 @@ virNodeDevCapUsbInterfaceParseXML(virConnectPtr conn,
     orignode = ctxt->node;
     ctxt->node = node;
 
-    if (virNodeDevCapsDefParseULong(conn, "number(./number[1])", ctxt,
+    if (virNodeDevCapsDefParseULong("number(./number[1])", ctxt,
                                     &data->usb_if.number, def,
                                     _("no USB interface number supplied for '%s'"),
                                     _("invalid USB interface number supplied for '%s'")) < 0)
         goto out;
 
-    if (virNodeDevCapsDefParseULong(conn, "number(./class[1])", ctxt,
+    if (virNodeDevCapsDefParseULong("number(./class[1])", ctxt,
                                     &data->usb_if._class, def,
                                     _("no USB interface class supplied for '%s'"),
                                     _("invalid USB interface class supplied for '%s'")) < 0)
         goto out;
 
-    if (virNodeDevCapsDefParseULong(conn, "number(./subclass[1])", ctxt,
+    if (virNodeDevCapsDefParseULong("number(./subclass[1])", ctxt,
                                     &data->usb_if.subclass, def,
                                     _("no USB interface subclass supplied for '%s'"),
                                     _("invalid USB interface subclass supplied for '%s'")) < 0)
         goto out;
 
-    if (virNodeDevCapsDefParseULong(conn, "number(./protocol[1])", ctxt,
+    if (virNodeDevCapsDefParseULong("number(./protocol[1])", ctxt,
                                     &data->usb_if.protocol, def,
                                     _("no USB interface protocol supplied for '%s'"),
                                     _("invalid USB interface protocol supplied for '%s'")) < 0)
@@ -901,8 +890,7 @@ out:
 }
 
 static int
-virNodeDevCapsDefParseHexId(virConnectPtr conn,
-                            const char *xpath,
+virNodeDevCapsDefParseHexId(const char *xpath,
                             xmlXPathContextPtr ctxt,
                             unsigned *value,
                             virNodeDeviceDefPtr def,
@@ -914,7 +902,7 @@ virNodeDevCapsDefParseHexId(virConnectPtr conn,
 
     ret = virXPathULongHex(xpath, ctxt, &val);
     if (ret < 0) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  ret == -1 ? missing_error_fmt : invalid_error_fmt,
                                  def->name);
         return -1;
@@ -925,8 +913,7 @@ virNodeDevCapsDefParseHexId(virConnectPtr conn,
 }
 
 static int
-virNodeDevCapUsbDevParseXML(virConnectPtr conn,
-                            xmlXPathContextPtr ctxt,
+virNodeDevCapUsbDevParseXML(xmlXPathContextPtr ctxt,
                             virNodeDeviceDefPtr def,
                             xmlNodePtr node,
                             union _virNodeDevCapData *data)
@@ -937,25 +924,25 @@ virNodeDevCapUsbDevParseXML(virConnectPtr conn,
     orignode = ctxt->node;
     ctxt->node = node;
 
-    if (virNodeDevCapsDefParseULong(conn, "number(./bus[1])", ctxt,
+    if (virNodeDevCapsDefParseULong("number(./bus[1])", ctxt,
                                     &data->usb_dev.bus, def,
                                     _("no USB bus number supplied for '%s'"),
                                     _("invalid USB bus number supplied for '%s'")) < 0)
         goto out;
 
-    if (virNodeDevCapsDefParseULong(conn, "number(./device[1])", ctxt,
+    if (virNodeDevCapsDefParseULong("number(./device[1])", ctxt,
                                     &data->usb_dev.device, def,
                                     _("no USB device number supplied for '%s'"),
                                     _("invalid USB device number supplied for '%s'")) < 0)
         goto out;
 
-    if (virNodeDevCapsDefParseHexId(conn, "string(./vendor[1]/@id)", ctxt,
+    if (virNodeDevCapsDefParseHexId("string(./vendor[1]/@id)", ctxt,
                                     &data->usb_dev.vendor, def,
                                     _("no USB vendor ID supplied for '%s'"),
                                     _("invalid USB vendor ID supplied for '%s'")) < 0)
         goto out;
 
-    if (virNodeDevCapsDefParseHexId(conn, "string(./product[1]/@id)", ctxt,
+    if (virNodeDevCapsDefParseHexId("string(./product[1]/@id)", ctxt,
                                     &data->usb_dev.product, def,
                                     _("no USB product ID supplied for '%s'"),
                                     _("invalid USB product ID supplied for '%s'")) < 0)
@@ -971,8 +958,7 @@ out:
 }
 
 static int
-virNodeDevCapPciDevParseXML(virConnectPtr conn,
-                            xmlXPathContextPtr ctxt,
+virNodeDevCapPciDevParseXML(xmlXPathContextPtr ctxt,
                             virNodeDeviceDefPtr def,
                             xmlNodePtr node,
                             union _virNodeDevCapData *data)
@@ -983,37 +969,37 @@ virNodeDevCapPciDevParseXML(virConnectPtr conn,
     orignode = ctxt->node;
     ctxt->node = node;
 
-    if (virNodeDevCapsDefParseULong(conn, "number(./domain[1])", ctxt,
+    if (virNodeDevCapsDefParseULong("number(./domain[1])", ctxt,
                                     &data->pci_dev.domain, def,
                                     _("no PCI domain ID supplied for '%s'"),
                                     _("invalid PCI domain ID supplied for '%s'")) < 0)
         goto out;
 
-    if (virNodeDevCapsDefParseULong(conn, "number(./bus[1])", ctxt,
+    if (virNodeDevCapsDefParseULong("number(./bus[1])", ctxt,
                                     &data->pci_dev.bus, def,
                                     _("no PCI bus ID supplied for '%s'"),
                                     _("invalid PCI bus ID supplied for '%s'")) < 0)
         goto out;
 
-    if (virNodeDevCapsDefParseULong(conn, "number(./slot[1])", ctxt,
+    if (virNodeDevCapsDefParseULong("number(./slot[1])", ctxt,
                                     &data->pci_dev.slot, def,
                                     _("no PCI slot ID supplied for '%s'"),
                                     _("invalid PCI slot ID supplied for '%s'")) < 0)
         goto out;
 
-    if (virNodeDevCapsDefParseULong(conn, "number(./function[1])", ctxt,
+    if (virNodeDevCapsDefParseULong("number(./function[1])", ctxt,
                                     &data->pci_dev.function, def,
                                     _("no PCI function ID supplied for '%s'"),
                                     _("invalid PCI function ID supplied for '%s'")) < 0)
         goto out;
 
-    if (virNodeDevCapsDefParseHexId(conn, "string(./vendor[1]/@id)", ctxt,
+    if (virNodeDevCapsDefParseHexId("string(./vendor[1]/@id)", ctxt,
                                     &data->pci_dev.vendor, def,
                                     _("no PCI vendor ID supplied for '%s'"),
                                     _("invalid PCI vendor ID supplied for '%s'")) < 0)
         goto out;
 
-    if (virNodeDevCapsDefParseHexId(conn, "string(./product[1]/@id)", ctxt,
+    if (virNodeDevCapsDefParseHexId("string(./product[1]/@id)", ctxt,
                                     &data->pci_dev.product, def,
                                     _("no PCI product ID supplied for '%s'"),
                                     _("invalid PCI product ID supplied for '%s'")) < 0)
@@ -1029,8 +1015,7 @@ out:
 }
 
 static int
-virNodeDevCapSystemParseXML(virConnectPtr conn,
-                            xmlXPathContextPtr ctxt,
+virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt,
                             virNodeDeviceDefPtr def,
                             xmlNodePtr node,
                             union _virNodeDevCapData *data)
@@ -1050,13 +1035,13 @@ virNodeDevCapSystemParseXML(virConnectPtr conn,
 
     tmp = virXPathString("string(./hardware/uuid[1])", ctxt);
     if (!tmp) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("no system UUID supplied for '%s'"), def->name);
         goto out;
     }
 
     if (virUUIDParse(tmp, data->system.hardware.uuid) < 0) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("malformed uuid element for '%s'"), def->name);
         VIR_FREE(tmp);
         goto out;
@@ -1074,8 +1059,7 @@ out:
 }
 
 static virNodeDevCapsDefPtr
-virNodeDevCapsDefParseXML(virConnectPtr conn,
-                          xmlXPathContextPtr ctxt,
+virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
                           virNodeDeviceDefPtr def,
                           xmlNodePtr node,
                           int create)
@@ -1091,13 +1075,13 @@ virNodeDevCapsDefParseXML(virConnectPtr conn,
 
     tmp = virXMLPropString(node, "type");
     if (!tmp) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  "%s", _("missing capability type"));
         goto error;
     }
 
     if ((val = virNodeDevCapTypeFromString(tmp)) < 0) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("unknown capability type '%s'"), tmp);
         VIR_FREE(tmp);
         goto error;
@@ -1107,34 +1091,34 @@ virNodeDevCapsDefParseXML(virConnectPtr conn,
 
     switch (caps->type) {
     case VIR_NODE_DEV_CAP_SYSTEM:
-        ret = virNodeDevCapSystemParseXML(conn, ctxt, def, node, &caps->data);
+        ret = virNodeDevCapSystemParseXML(ctxt, def, node, &caps->data);
         break;
     case VIR_NODE_DEV_CAP_PCI_DEV:
-        ret = virNodeDevCapPciDevParseXML(conn, ctxt, def, node, &caps->data);
+        ret = virNodeDevCapPciDevParseXML(ctxt, def, node, &caps->data);
         break;
     case VIR_NODE_DEV_CAP_USB_DEV:
-        ret = virNodeDevCapUsbDevParseXML(conn, ctxt, def, node, &caps->data);
+        ret = virNodeDevCapUsbDevParseXML(ctxt, def, node, &caps->data);
         break;
     case VIR_NODE_DEV_CAP_USB_INTERFACE:
-        ret = virNodeDevCapUsbInterfaceParseXML(conn, ctxt, def, node, &caps->data);
+        ret = virNodeDevCapUsbInterfaceParseXML(ctxt, def, node, &caps->data);
         break;
     case VIR_NODE_DEV_CAP_NET:
-        ret = virNodeDevCapNetParseXML(conn, ctxt, def, node, &caps->data);
+        ret = virNodeDevCapNetParseXML(ctxt, def, node, &caps->data);
         break;
     case VIR_NODE_DEV_CAP_SCSI_HOST:
-        ret = virNodeDevCapScsiHostParseXML(conn, ctxt, def, node, &caps->data, create);
+        ret = virNodeDevCapScsiHostParseXML(ctxt, def, node, &caps->data, create);
         break;
     case VIR_NODE_DEV_CAP_SCSI_TARGET:
-        ret = virNodeDevCapScsiTargetParseXML(conn, ctxt, def, node, &caps->data);
+        ret = virNodeDevCapScsiTargetParseXML(ctxt, def, node, &caps->data);
         break;
     case VIR_NODE_DEV_CAP_SCSI:
-        ret = virNodeDevCapScsiParseXML(conn, ctxt, def, node, &caps->data);
+        ret = virNodeDevCapScsiParseXML(ctxt, def, node, &caps->data);
         break;
     case VIR_NODE_DEV_CAP_STORAGE:
-        ret = virNodeDevCapStorageParseXML(conn, ctxt, def, node, &caps->data);
+        ret = virNodeDevCapStorageParseXML(ctxt, def, node, &caps->data);
         break;
     default:
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("unknown capability type '%d' for '%s'"),
                                  caps->type, def->name);
         ret = -1;
@@ -1151,7 +1135,7 @@ error:
 }
 
 static virNodeDeviceDefPtr
-virNodeDeviceDefParseXML(virConnectPtr conn, xmlXPathContextPtr ctxt, int create)
+virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, int create)
 {
     virNodeDeviceDefPtr def;
     virNodeDevCapsDefPtr *next_cap;
@@ -1168,7 +1152,7 @@ virNodeDeviceDefParseXML(virConnectPtr conn, xmlXPathContextPtr ctxt, int create
         def->name = virXPathString("string(./name[1])", ctxt);
 
         if (!def->name) {
-            virNodeDeviceReportError(conn, VIR_ERR_NO_NAME, NULL);
+            virNodeDeviceReportError(VIR_ERR_NO_NAME, NULL);
             goto error;
         }
     } else {
@@ -1186,7 +1170,7 @@ virNodeDeviceDefParseXML(virConnectPtr conn, xmlXPathContextPtr ctxt, int create
     /* Parse device capabilities */
     nodes = NULL;
     if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) <= 0) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("no device capabilities for '%s'"),
                                  def->name);
         goto error;
@@ -1194,7 +1178,7 @@ virNodeDeviceDefParseXML(virConnectPtr conn, xmlXPathContextPtr ctxt, int create
 
     next_cap = &def->caps;
     for (i = 0 ; i < n ; i++) {
-        *next_cap = virNodeDevCapsDefParseXML(conn, ctxt, def, nodes[i], create);
+        *next_cap = virNodeDevCapsDefParseXML(ctxt, def, nodes[i], create);
         if (!*next_cap) {
             VIR_FREE(nodes);
             goto error;
@@ -1212,8 +1196,7 @@ virNodeDeviceDefParseXML(virConnectPtr conn, xmlXPathContextPtr ctxt, int create
 }
 
 virNodeDeviceDefPtr
-virNodeDeviceDefParseNode(virConnectPtr conn,
-                          xmlDocPtr xml,
+virNodeDeviceDefParseNode(xmlDocPtr xml,
                           xmlNodePtr root,
                           int create)
 {
@@ -1221,7 +1204,7 @@ virNodeDeviceDefParseNode(virConnectPtr conn,
     virNodeDeviceDefPtr def = NULL;
 
     if (!xmlStrEqual(root->name, BAD_CAST "device")) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  "%s", _("incorrect root element"));
         return NULL;
     }
@@ -1233,7 +1216,7 @@ virNodeDeviceDefParseNode(virConnectPtr conn,
     }
 
     ctxt->node = root;
-    def = virNodeDeviceDefParseXML(conn, ctxt, create);
+    def = virNodeDeviceDefParseXML(ctxt, create);
 
 cleanup:
     xmlXPathFreeContext(ctxt);
@@ -1247,12 +1230,10 @@ catchXMLError(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...)
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
 
     if (ctxt) {
-        virConnectPtr conn = ctxt->_private;
-
         if (virGetLastError() == NULL &&
             ctxt->lastError.level == XML_ERR_FATAL &&
             ctxt->lastError.message != NULL) {
-            virNodeDeviceReportError(conn,  VIR_ERR_XML_DETAIL,
+            virNodeDeviceReportError(VIR_ERR_XML_DETAIL,
                                      _("at line %d: %s"),
                                      ctxt->lastError.line,
                                      ctxt->lastError.message);
@@ -1263,8 +1244,7 @@ catchXMLError(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...)
 
 
 static virNodeDeviceDefPtr
-virNodeDeviceDefParse(virConnectPtr conn,
-                      const char *str,
+virNodeDeviceDefParse(const char *str,
                       const char *filename,
                       int create)
 {
@@ -1278,9 +1258,7 @@ virNodeDeviceDefParse(virConnectPtr conn,
     if (!pctxt || !pctxt->sax)
         goto cleanup;
     pctxt->sax->error = catchXMLError;
-    pctxt->_private = conn;
 
-    if (conn) virResetError (&conn->err);
     if (filename) {
         xml = xmlCtxtReadFile (pctxt, filename, NULL,
                                XML_PARSE_NOENT | XML_PARSE_NONET |
@@ -1293,19 +1271,19 @@ virNodeDeviceDefParse(virConnectPtr conn,
     }
 
     if (!xml) {
-        if (conn && conn->err.code == VIR_ERR_NONE)
-              virNodeDeviceReportError(conn, VIR_ERR_XML_ERROR,
-                                       "%s", _("failed to parse xml document"));
+        if (virGetLastError() == NULL)
+            virNodeDeviceReportError(VIR_ERR_XML_ERROR,
+                                     "%s", _("failed to parse xml document"));
         goto cleanup;
     }
 
     if ((root = xmlDocGetRootElement(xml)) == NULL) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  "%s", _("missing root element"));
         goto cleanup;
     }
 
-    def = virNodeDeviceDefParseNode(conn, xml, root, create);
+    def = virNodeDeviceDefParseNode(xml, root, create);
 
 cleanup:
     xmlFreeParserCtxt(pctxt);
@@ -1314,27 +1292,24 @@ cleanup:
 }
 
 virNodeDeviceDefPtr
-virNodeDeviceDefParseString(virConnectPtr conn,
-                            const char *str,
+virNodeDeviceDefParseString(const char *str,
                             int create)
 {
-    return virNodeDeviceDefParse(conn, str, NULL, create);
+    return virNodeDeviceDefParse(str, NULL, create);
 }
 
 virNodeDeviceDefPtr
-virNodeDeviceDefParseFile(virConnectPtr conn,
-                          const char *filename,
+virNodeDeviceDefParseFile(const char *filename,
                           int create)
 {
-    return virNodeDeviceDefParse(conn, NULL, filename, create);
+    return virNodeDeviceDefParse(NULL, filename, create);
 }
 
 /*
  * Return fc_host dev's WWNN and WWPN
  */
 int
-virNodeDeviceGetWWNs(virConnectPtr conn,
-                     virNodeDeviceDefPtr def,
+virNodeDeviceGetWWNs(virNodeDeviceDefPtr def,
                      char **wwnn,
                      char **wwpn)
 {
@@ -1354,7 +1329,7 @@ virNodeDeviceGetWWNs(virConnectPtr conn,
     }
 
     if (cap == NULL) {
-        virNodeDeviceReportError(conn, VIR_ERR_NO_SUPPORT,
+        virNodeDeviceReportError(VIR_ERR_NO_SUPPORT,
                                  "%s", _("Device is not a fibre channel HBA"));
         ret = -1;
     } else if (*wwnn == NULL || *wwpn == NULL) {
@@ -1372,8 +1347,7 @@ virNodeDeviceGetWWNs(virConnectPtr conn,
  * Return the NPIV dev's parent device name
  */
 int
-virNodeDeviceGetParentHost(virConnectPtr conn,
-                           const virNodeDeviceObjListPtr devs,
+virNodeDeviceGetParentHost(const virNodeDeviceObjListPtr devs,
                            const char *dev_name,
                            const char *parent_name,
                            int *parent_host)
@@ -1384,7 +1358,7 @@ virNodeDeviceGetParentHost(virConnectPtr conn,
 
     parent = virNodeDeviceFindByName(devs, parent_name);
     if (parent == NULL) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("Could not find parent HBA for '%s'"),
                                  dev_name);
         ret = -1;
@@ -1404,7 +1378,7 @@ virNodeDeviceGetParentHost(virConnectPtr conn,
     }
 
     if (cap == NULL) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("Parent HBA %s is not capable "
                                    "of vport operations"),
                                  parent->def->name);
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index 318fa3e..3a5432c 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -217,9 +217,9 @@ struct _virDeviceMonitorState {
     void *privateData;			/* driver-specific private data */
 };
 
-#define virNodeDeviceReportError(conn, code, fmt...)			\
-        virReportErrorHelper(conn, VIR_FROM_NODEDEV, code, __FILE__,	\
-                               __FUNCTION__, __LINE__, fmt)
+#define virNodeDeviceReportError(code, fmt...)                          \
+    virReportErrorHelper(NULL, VIR_FROM_NODEDEV, code, __FILE__,	\
+                         __FUNCTION__, __LINE__, fmt)
 
 int virNodeDeviceHasCap(const virNodeDeviceObjPtr dev, const char *cap);
 
@@ -229,34 +229,27 @@ virNodeDeviceObjPtr
 virNodeDeviceFindBySysfsPath(const virNodeDeviceObjListPtr devs,
                              const char *sysfs_path);
 
-virNodeDeviceObjPtr virNodeDeviceAssignDef(virConnectPtr conn,
-                                           virNodeDeviceObjListPtr devs,
+virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
                                            const virNodeDeviceDefPtr def);
 
 void virNodeDeviceObjRemove(virNodeDeviceObjListPtr devs,
                             const virNodeDeviceObjPtr dev);
 
-char *virNodeDeviceDefFormat(virConnectPtr conn,
-                             const virNodeDeviceDefPtr def);
+char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def);
 
-virNodeDeviceDefPtr virNodeDeviceDefParseString(virConnectPtr conn,
-                                                const char *str,
+virNodeDeviceDefPtr virNodeDeviceDefParseString(const char *str,
                                                 int create);
-virNodeDeviceDefPtr virNodeDeviceDefParseFile(virConnectPtr conn,
-                                              const char *filename,
+virNodeDeviceDefPtr virNodeDeviceDefParseFile(const char *filename,
                                               int create);
-virNodeDeviceDefPtr virNodeDeviceDefParseNode(virConnectPtr conn,
-                                              xmlDocPtr xml,
+virNodeDeviceDefPtr virNodeDeviceDefParseNode(xmlDocPtr xml,
                                               xmlNodePtr root,
                                               int create);
 
-int virNodeDeviceGetWWNs(virConnectPtr conn,
-                         virNodeDeviceDefPtr def,
+int virNodeDeviceGetWWNs(virNodeDeviceDefPtr def,
                          char **wwnn,
                          char **wwpn);
 
-int virNodeDeviceGetParentHost(virConnectPtr conn,
-                               const virNodeDeviceObjListPtr devs,
+int virNodeDeviceGetParentHost(const virNodeDeviceObjListPtr devs,
                                const char *dev_name,
                                const char *parent_name,
                                int *parent_host);
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index ad5503b..b9f6d17 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -203,7 +203,7 @@ static virNodeDevicePtr nodeDeviceLookupByName(virConnectPtr conn,
     nodeDeviceUnlock(driver);
 
     if (!obj) {
-        virNodeDeviceReportError(conn, VIR_ERR_NO_NODE_DEVICE, NULL);
+        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
         goto cleanup;
     }
 
@@ -274,8 +274,8 @@ static char *nodeDeviceDumpXML(virNodeDevicePtr dev,
     nodeDeviceUnlock(driver);
 
     if (!obj) {
-        virNodeDeviceReportError(dev->conn, VIR_ERR_NO_NODE_DEVICE,
-                                _("no node device with matching name '%s'"),
+        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
+                                 _("no node device with matching name '%s'"),
                                  dev->name);
         goto cleanup;
     }
@@ -283,7 +283,7 @@ static char *nodeDeviceDumpXML(virNodeDevicePtr dev,
     update_driver_name(obj);
     update_caps(obj);
 
-    ret = virNodeDeviceDefFormat(dev->conn, obj->def);
+    ret = virNodeDeviceDefFormat(obj->def);
 
 cleanup:
     if (obj)
@@ -303,8 +303,8 @@ static char *nodeDeviceGetParent(virNodeDevicePtr dev)
     nodeDeviceUnlock(driver);
 
     if (!obj) {
-        virNodeDeviceReportError(dev->conn, VIR_ERR_NO_NODE_DEVICE,
-                                _("no node device with matching name '%s'"),
+        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
+                                 _("no node device with matching name '%s'"),
                                  dev->name);
         goto cleanup;
     }
@@ -314,7 +314,7 @@ static char *nodeDeviceGetParent(virNodeDevicePtr dev)
         if (!ret)
             virReportOOMError();
     } else {
-        virNodeDeviceReportError(dev->conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  "%s", _("no parent for this device"));
     }
 
@@ -338,8 +338,8 @@ static int nodeDeviceNumOfCaps(virNodeDevicePtr dev)
     nodeDeviceUnlock(driver);
 
     if (!obj) {
-        virNodeDeviceReportError(dev->conn, VIR_ERR_NO_NODE_DEVICE,
-                                _("no node device with matching name '%s'"),
+        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
+                                 _("no node device with matching name '%s'"),
                                  dev->name);
         goto cleanup;
     }
@@ -369,8 +369,8 @@ nodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames)
     nodeDeviceUnlock(driver);
 
     if (!obj) {
-        virNodeDeviceReportError(dev->conn, VIR_ERR_NO_NODE_DEVICE,
-                                _("no node device with matching name '%s'"),
+        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
+                                 _("no node device with matching name '%s'"),
                                  dev->name);
         goto cleanup;
     }
@@ -397,8 +397,7 @@ cleanup:
 
 
 static int
-nodeDeviceVportCreateDelete(virConnectPtr conn,
-                            const int parent_host,
+nodeDeviceVportCreateDelete(const int parent_host,
                             const char *wwpn,
                             const char *wwnn,
                             int operation)
@@ -415,7 +414,7 @@ nodeDeviceVportCreateDelete(virConnectPtr conn,
         operation_file = LINUX_SYSFS_VPORT_DELETE_POSTFIX;
         break;
     default:
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  _("Invalid vport operation (%d)"), operation);
         retval = -1;
         goto cleanup;
@@ -462,13 +461,13 @@ cleanup:
 
 
 static int
-get_time(virConnectPtr conn, time_t *t)
+get_time(time_t *t)
 {
     int ret = 0;
 
     *t = time(NULL);
     if (*t == (time_t)-1) {
-        virNodeDeviceReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  "%s", _("Could not get current time"));
 
         *t = 0;
@@ -506,7 +505,7 @@ find_new_device(virConnectPtr conn, const char *wwnn, const char *wwpn)
      * doesn't become invalid.  */
     nodeDeviceUnlock(driver);
 
-    get_time(conn, &start);
+    get_time(&start);
 
     while ((now - start) < LINUX_NEW_DEVICE_WAIT_TIME) {
 
@@ -519,7 +518,7 @@ find_new_device(virConnectPtr conn, const char *wwnn, const char *wwpn)
         }
 
         sleep(5);
-        if (get_time(conn, &now) == -1) {
+        if (get_time(&now) == -1) {
             break;
         }
     }
@@ -542,25 +541,23 @@ nodeDeviceCreateXML(virConnectPtr conn,
 
     nodeDeviceLock(driver);
 
-    def = virNodeDeviceDefParseString(conn, xmlDesc, CREATE_DEVICE);
+    def = virNodeDeviceDefParseString(xmlDesc, CREATE_DEVICE);
     if (def == NULL) {
         goto cleanup;
     }
 
-    if (virNodeDeviceGetWWNs(conn, def, &wwnn, &wwpn) == -1) {
+    if (virNodeDeviceGetWWNs(def, &wwnn, &wwpn) == -1) {
         goto cleanup;
     }
 
-    if (virNodeDeviceGetParentHost(conn,
-                                   &driver->devs,
+    if (virNodeDeviceGetParentHost(&driver->devs,
                                    def->name,
                                    def->parent,
                                    &parent_host) == -1) {
         goto cleanup;
     }
 
-    if (nodeDeviceVportCreateDelete(conn,
-                                    parent_host,
+    if (nodeDeviceVportCreateDelete(parent_host,
                                     wwpn,
                                     wwnn,
                                     VPORT_CREATE) == -1) {
@@ -572,7 +569,7 @@ nodeDeviceCreateXML(virConnectPtr conn,
      * we're returning what we get... */
 
     if (dev == NULL) {
-        virNodeDeviceReportError(conn, VIR_ERR_NO_NODE_DEVICE, NULL);
+        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
     }
 
 cleanup:
@@ -598,11 +595,11 @@ nodeDeviceDestroy(virNodeDevicePtr dev)
     nodeDeviceUnlock(driver);
 
     if (!obj) {
-        virNodeDeviceReportError(dev->conn, VIR_ERR_NO_NODE_DEVICE, NULL);
+        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
         goto out;
     }
 
-    if (virNodeDeviceGetWWNs(dev->conn, obj->def, &wwnn, &wwpn) == -1) {
+    if (virNodeDeviceGetWWNs(obj->def, &wwnn, &wwpn) == -1) {
         goto out;
     }
 
@@ -620,16 +617,14 @@ nodeDeviceDestroy(virNodeDevicePtr dev)
         goto out;
     }
 
-    if (virNodeDeviceGetParentHost(dev->conn,
-                                   &driver->devs,
+    if (virNodeDeviceGetParentHost(&driver->devs,
                                    dev->name,
                                    parent_name,
                                    &parent_host) == -1) {
         goto out;
     }
 
-    if (nodeDeviceVportCreateDelete(dev->conn,
-                                    parent_host,
+    if (nodeDeviceVportCreateDelete(parent_host,
                                     wwpn,
                                     wwnn,
                                     VPORT_DELETE) == -1) {
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index 02fcbf6..6cc2864 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -465,8 +465,7 @@ static void dev_create(const char *udi)
     /* Some devices don't have a path in sysfs, so ignore failure */
     get_str_prop(ctx, udi, "linux.sysfs_path", &devicePath);
 
-    dev = virNodeDeviceAssignDef(NULL,
-                                 &driverState->devs,
+    dev = virNodeDeviceAssignDef(&driverState->devs,
                                  def);
 
     if (!dev) {
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 76f83bf..68509f4 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1292,7 +1292,7 @@ static int udevAddOneDevice(struct udev_device *device)
     }
 
     nodeDeviceLock(driverState);
-    dev = virNodeDeviceAssignDef(NULL, &driverState->devs, def);
+    dev = virNodeDeviceAssignDef(&driverState->devs, def);
     nodeDeviceUnlock(driverState);
 
     if (dev == NULL) {
@@ -1534,7 +1534,7 @@ static int udevSetupSystemDev(void)
 
     udev_device_unref(device);
 
-    dev = virNodeDeviceAssignDef(NULL, &driverState->devs, def);
+    dev = virNodeDeviceAssignDef(&driverState->devs, def);
     if (dev == NULL) {
         VIR_ERROR("Failed to create device for '%s'", def->name);
         virNodeDeviceDefFree(def);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4cc66be..1b3b271 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8377,7 +8377,7 @@ qemudNodeDeviceGetPciInfo (virNodeDevicePtr dev,
     if (!xml)
         goto out;
 
-    def = virNodeDeviceDefParseString(dev->conn, xml, EXISTING_DEVICE);
+    def = virNodeDeviceDefParseString(xml, EXISTING_DEVICE);
     if (!def)
         goto out;
 
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 2f3ef16..5cecb93 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -594,9 +594,9 @@ static int testOpenDefault(virConnectPtr conn) {
     virStoragePoolObjUnlock(poolobj);
 
     /* Init default node device */
-    if (!(nodedef = virNodeDeviceDefParseString(conn, defaultNodeXML, 0)))
+    if (!(nodedef = virNodeDeviceDefParseString(defaultNodeXML, 0)))
         goto error;
-    if (!(nodeobj = virNodeDeviceAssignDef(conn, &privconn->devs,
+    if (!(nodeobj = virNodeDeviceAssignDef(&privconn->devs,
                                            nodedef))) {
         virNodeDeviceDefFree(nodedef);
         goto error;
@@ -1061,15 +1061,15 @@ static int testOpenFromFile(virConnectPtr conn,
                 goto error;
             }
 
-            def = virNodeDeviceDefParseFile(conn, absFile, 0);
+            def = virNodeDeviceDefParseFile(absFile, 0);
             VIR_FREE(absFile);
             if (!def)
                 goto error;
         } else {
-            if ((def = virNodeDeviceDefParseNode(conn, xml, devs[i], 0)) == NULL)
+            if ((def = virNodeDeviceDefParseNode(xml, devs[i], 0)) == NULL)
                 goto error;
         }
-        if (!(dev = virNodeDeviceAssignDef(conn, &privconn->devs, def))) {
+        if (!(dev = virNodeDeviceAssignDef(&privconn->devs, def))) {
             virNodeDeviceDefFree(def);
             goto error;
         }
@@ -4778,7 +4778,7 @@ testNodeDeviceLookupByName(virConnectPtr conn, const char *name)
     testDriverUnlock(driver);
 
     if (!obj) {
-        virNodeDeviceReportError(conn, VIR_ERR_NO_NODE_DEVICE, NULL);
+        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
         goto cleanup;
     }
 
@@ -4803,13 +4803,13 @@ testNodeDeviceDumpXML(virNodeDevicePtr dev,
     testDriverUnlock(driver);
 
     if (!obj) {
-        virNodeDeviceReportError(dev->conn, VIR_ERR_NO_NODE_DEVICE,
-                                _("no node device with matching name '%s'"),
+        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
+                                 _("no node device with matching name '%s'"),
                                  dev->name);
         goto cleanup;
     }
 
-    ret = virNodeDeviceDefFormat(dev->conn, obj->def);
+    ret = virNodeDeviceDefFormat(obj->def);
 
 cleanup:
     if (obj)
@@ -4829,7 +4829,7 @@ testNodeDeviceGetParent(virNodeDevicePtr dev)
     testDriverUnlock(driver);
 
     if (!obj) {
-        virNodeDeviceReportError(dev->conn, VIR_ERR_NO_NODE_DEVICE,
+        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
                                 _("no node device with matching name '%s'"),
                                  dev->name);
         goto cleanup;
@@ -4840,7 +4840,7 @@ testNodeDeviceGetParent(virNodeDevicePtr dev)
         if (!ret)
             virReportOOMError();
     } else {
-        virNodeDeviceReportError(dev->conn, VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
                                  "%s", _("no parent for this device"));
     }
 
@@ -4865,8 +4865,8 @@ testNodeDeviceNumOfCaps(virNodeDevicePtr dev)
     testDriverUnlock(driver);
 
     if (!obj) {
-        virNodeDeviceReportError(dev->conn, VIR_ERR_NO_NODE_DEVICE,
-                                _("no node device with matching name '%s'"),
+        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
+                                 _("no node device with matching name '%s'"),
                                  dev->name);
         goto cleanup;
     }
@@ -4896,7 +4896,7 @@ testNodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames)
     testDriverUnlock(driver);
 
     if (!obj) {
-        virNodeDeviceReportError(dev->conn, VIR_ERR_NO_NODE_DEVICE,
+        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE,
                                 _("no node device with matching name '%s'"),
                                  dev->name);
         goto cleanup;
@@ -4935,18 +4935,17 @@ testNodeDeviceCreateXML(virConnectPtr conn,
 
     testDriverLock(driver);
 
-    def = virNodeDeviceDefParseString(conn, xmlDesc, CREATE_DEVICE);
+    def = virNodeDeviceDefParseString(xmlDesc, CREATE_DEVICE);
     if (def == NULL) {
         goto cleanup;
     }
 
     /* We run these next two simply for validation */
-    if (virNodeDeviceGetWWNs(conn, def, &wwnn, &wwpn) == -1) {
+    if (virNodeDeviceGetWWNs(def, &wwnn, &wwpn) == -1) {
         goto cleanup;
     }
 
-    if (virNodeDeviceGetParentHost(conn,
-                                   &driver->devs,
+    if (virNodeDeviceGetParentHost(&driver->devs,
                                    def->name,
                                    def->parent,
                                    &parent_host) == -1) {
@@ -4973,7 +4972,7 @@ testNodeDeviceCreateXML(virConnectPtr conn,
     }
 
 
-    if (!(obj = virNodeDeviceAssignDef(conn, &driver->devs, def))) {
+    if (!(obj = virNodeDeviceAssignDef(&driver->devs, def))) {
         goto cleanup;
     }
     virNodeDeviceObjUnlock(obj);
@@ -5003,11 +5002,11 @@ testNodeDeviceDestroy(virNodeDevicePtr dev)
     testDriverUnlock(driver);
 
     if (!obj) {
-        virNodeDeviceReportError(dev->conn, VIR_ERR_NO_NODE_DEVICE, NULL);
+        virNodeDeviceReportError(VIR_ERR_NO_NODE_DEVICE, NULL);
         goto out;
     }
 
-    if (virNodeDeviceGetWWNs(dev->conn, obj->def, &wwnn, &wwpn) == -1) {
+    if (virNodeDeviceGetWWNs(obj->def, &wwnn, &wwpn) == -1) {
         goto out;
     }
 
@@ -5024,8 +5023,7 @@ testNodeDeviceDestroy(virNodeDevicePtr dev)
     virNodeDeviceObjUnlock(obj);
 
     /* We do this just for basic validation */
-    if (virNodeDeviceGetParentHost(dev->conn,
-                                   &driver->devs,
+    if (virNodeDeviceGetParentHost(&driver->devs,
                                    dev->name,
                                    parent_name,
                                    &parent_host) == -1) {
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 6f21c6a..d5a0d00 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1722,7 +1722,7 @@ xenUnifiedNodeDeviceGetPciInfo (virNodeDevicePtr dev,
     if (!xml)
         goto out;
 
-    def = virNodeDeviceDefParseString(dev->conn, xml, EXISTING_DEVICE);
+    def = virNodeDeviceDefParseString(xml, EXISTING_DEVICE);
     if (!def)
         goto out;
 
diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c
index bf8be7e..2bc6743 100644
--- a/tests/nodedevxml2xmltest.c
+++ b/tests/nodedevxml2xmltest.c
@@ -29,10 +29,10 @@ static int testCompareXMLToXMLFiles(const char *xml) {
     if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0)
         goto fail;
 
-    if (!(dev = virNodeDeviceDefParseString(NULL, xmlData, EXISTING_DEVICE)))
+    if (!(dev = virNodeDeviceDefParseString(xmlData, EXISTING_DEVICE)))
         goto fail;
 
-    if (!(actual = virNodeDeviceDefFormat(NULL, dev)))
+    if (!(actual = virNodeDeviceDefFormat(dev)))
         goto fail;
 
     if (STRNEQ(xmlData, actual)) {
-- 
1.6.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]