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

[libvirt] [PATCH 4/8] Remove virConnectPtr from storage APIs & driver



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 storage_conf.{h,c} and storage_encryption_conf.{h,c}
and update all callers to match
---
 src/conf/domain_conf.c                |    4 +-
 src/conf/storage_conf.c               |  257 ++++++++++++++-------------------
 src/conf/storage_conf.h               |   51 +++-----
 src/conf/storage_encryption_conf.c    |   45 +++---
 src/conf/storage_encryption_conf.h    |    7 +-
 src/storage/storage_backend.c         |   77 +++++-----
 src/storage/storage_backend.h         |   18 +--
 src/storage/storage_backend_disk.c    |   74 +++++------
 src/storage/storage_backend_fs.c      |   59 ++++----
 src/storage/storage_backend_iscsi.c   |  109 ++++++--------
 src/storage/storage_backend_logical.c |   49 +++----
 src/storage/storage_backend_mpath.c   |   30 ++---
 src/storage/storage_backend_scsi.c    |   47 +++----
 src/storage/storage_backend_scsi.h    |    3 +-
 src/storage/storage_driver.c          |  164 +++++++++++-----------
 src/test/test_driver.c                |   37 +++---
 src/vbox/vbox_tmpl.c                  |    4 +-
 tests/storagepoolxml2xmltest.c        |    4 +-
 tests/storagevolxml2xmltest.c         |    6 +-
 19 files changed, 465 insertions(+), 580 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f9d7b13..101be4e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1297,7 +1297,7 @@ virDomainDiskDefParseXML(xmlNodePtr node,
                 devaddr = virXMLPropString(cur, "devaddr");
             } else if (encryption == NULL &&
                        xmlStrEqual(cur->name, BAD_CAST "encryption")) {
-                encryption = virStorageEncryptionParseNode(NULL, node->doc,
+                encryption = virStorageEncryptionParseNode(node->doc,
                                                            cur);
                 if (encryption == NULL)
                     goto error;
@@ -4581,7 +4581,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
         virBufferEscapeString(buf, "      <serial>%s</serial>\n",
                               def->serial);
     if (def->encryption != NULL &&
-        virStorageEncryptionFormat(NULL, buf, def->encryption) < 0)
+        virStorageEncryptionFormat(buf, def->encryption) < 0)
         return -1;
 
     if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index b80fef0..eb1c9d9 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -46,9 +46,6 @@
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
-#define virStorageError(conn, code, fmt...)                             \
-            virReportErrorHelper(conn, VIR_FROM_STORAGE, code, __FILE__,\
-                                  __FUNCTION__, __LINE__, fmt)
 
 VIR_ENUM_IMPL(virStoragePool,
               VIR_STORAGE_POOL_LAST,
@@ -223,7 +220,7 @@ virStoragePoolTypeInfoLookup(int type) {
         if (poolTypeInfo[i].poolType == type)
             return &poolTypeInfo[i];
 
-    virStorageReportError(NULL, VIR_ERR_INTERNAL_ERROR,
+    virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                           _("missing backend for pool type %d"), type);
     return NULL;
 }
@@ -366,19 +363,18 @@ virStoragePoolObjRemove(virStoragePoolObjListPtr pools,
 
 
 static int
-virStoragePoolDefParseAuthChap(virConnectPtr conn,
-                               xmlXPathContextPtr ctxt,
+virStoragePoolDefParseAuthChap(xmlXPathContextPtr ctxt,
                                virStoragePoolAuthChapPtr auth) {
     auth->login = virXPathString("string(./auth/@login)", ctxt);
     if (auth->login == NULL) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                               "%s", _("missing auth host attribute"));
         return -1;
     }
 
     auth->passwd = virXPathString("string(./auth/@passwd)", ctxt);
     if (auth->passwd == NULL) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                               "%s", _("missing auth passwd attribute"));
         return -1;
     }
@@ -387,8 +383,7 @@ virStoragePoolDefParseAuthChap(virConnectPtr conn,
 }
 
 static int
-virStoragePoolDefParseSource(virConnectPtr conn,
-                             xmlXPathContextPtr ctxt,
+virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
                              virStoragePoolSourcePtr source,
                              int pool_type,
                              xmlNodePtr node) {
@@ -415,7 +410,7 @@ virStoragePoolDefParseSource(virConnectPtr conn,
             source->format = options->formatFromString(format);
 
         if (source->format < 0) {
-            virStorageReportError(conn, VIR_ERR_XML_ERROR,
+            virStorageReportError(VIR_ERR_XML_ERROR,
                                   _("unknown pool format type %s"), format);
             VIR_FREE(format);
             goto cleanup;
@@ -438,7 +433,7 @@ virStoragePoolDefParseSource(virConnectPtr conn,
             xmlChar *path = xmlGetProp(nodeset[i], BAD_CAST "path");
             if (path == NULL) {
                 VIR_FREE(nodeset);
-                virStorageReportError(conn, VIR_ERR_XML_ERROR,
+                virStorageReportError(VIR_ERR_XML_ERROR,
                         "%s", _("missing storage pool source device path"));
                 goto cleanup;
             }
@@ -457,7 +452,7 @@ virStoragePoolDefParseSource(virConnectPtr conn,
         if (STREQ(authType, "chap")) {
             source->authType = VIR_STORAGE_POOL_AUTH_CHAP;
         } else {
-            virStorageReportError(conn, VIR_ERR_XML_ERROR,
+            virStorageReportError(VIR_ERR_XML_ERROR,
                                   _("unknown auth type '%s'"),
                                   (const char *)authType);
             goto cleanup;
@@ -465,7 +460,7 @@ virStoragePoolDefParseSource(virConnectPtr conn,
     }
 
     if (source->authType == VIR_STORAGE_POOL_AUTH_CHAP) {
-        if (virStoragePoolDefParseAuthChap(conn, ctxt, &source->auth.chap) < 0)
+        if (virStoragePoolDefParseAuthChap(ctxt, &source->auth.chap) < 0)
             goto cleanup;
     }
 
@@ -479,8 +474,7 @@ cleanup:
 }
 
 virStoragePoolSourcePtr
-virStoragePoolDefParseSourceString(virConnectPtr conn,
-                                   const char *srcSpec,
+virStoragePoolDefParseSourceString(const char *srcSpec,
                                    int pool_type)
 {
     xmlDocPtr doc = NULL;
@@ -493,7 +487,7 @@ virStoragePoolDefParseSourceString(virConnectPtr conn,
                      XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
 
     if (doc == NULL) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                               "%s", _("bad <source> spec"));
         goto cleanup;
     }
@@ -511,12 +505,12 @@ virStoragePoolDefParseSourceString(virConnectPtr conn,
 
     node = virXPathNode("/source", xpath_ctxt);
     if (!node) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                               "%s", _("root element was not source"));
         goto cleanup;
     }
 
-    if (virStoragePoolDefParseSource(conn, xpath_ctxt, def, pool_type,
+    if (virStoragePoolDefParseSource(xpath_ctxt, def, pool_type,
                                      node) < 0)
         goto cleanup;
 
@@ -531,8 +525,7 @@ cleanup:
     return ret;
 }
 static int
-virStorageDefParsePerms(virConnectPtr conn,
-                        xmlXPathContextPtr ctxt,
+virStorageDefParsePerms(xmlXPathContextPtr ctxt,
                         virStoragePermsPtr perms,
                         const char *permxpath,
                         int defaultmode) {
@@ -563,7 +556,7 @@ virStorageDefParsePerms(virConnectPtr conn,
         perms->mode = strtol(mode, &end, 8);
         if (*end || perms->mode < 0 || perms->mode > 0777) {
             VIR_FREE(mode);
-            virStorageReportError(conn, VIR_ERR_XML_ERROR,
+            virStorageReportError(VIR_ERR_XML_ERROR,
                                   "%s", _("malformed octal mode"));
             goto error;
         }
@@ -574,7 +567,7 @@ virStorageDefParsePerms(virConnectPtr conn,
         perms->uid = getuid();
     } else {
         if (virXPathLong("number(./owner)", ctxt, &v) < 0) {
-            virStorageReportError(conn, VIR_ERR_XML_ERROR,
+            virStorageReportError(VIR_ERR_XML_ERROR,
                                   "%s", _("malformed owner element"));
             goto error;
         }
@@ -585,7 +578,7 @@ virStorageDefParsePerms(virConnectPtr conn,
         perms->gid = getgid();
     } else {
         if (virXPathLong("number(./group)", ctxt, &v) < 0) {
-            virStorageReportError(conn, VIR_ERR_XML_ERROR,
+            virStorageReportError(VIR_ERR_XML_ERROR,
                                   "%s", _("malformed group element"));
             goto error;
         }
@@ -602,8 +595,7 @@ error:
 }
 
 static virStoragePoolDefPtr
-virStoragePoolDefParseXML(virConnectPtr conn,
-                          xmlXPathContextPtr ctxt) {
+virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) {
     virStoragePoolOptionsPtr options;
     virStoragePoolDefPtr ret;
     xmlNodePtr source_node;
@@ -617,7 +609,7 @@ virStoragePoolDefParseXML(virConnectPtr conn,
 
     type = virXPathString("string(./@type)", ctxt);
     if ((ret->type = virStoragePoolTypeFromString((const char *)type)) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("unknown storage pool type %s"), (const char*)type);
         goto cleanup;
     }
@@ -631,7 +623,7 @@ virStoragePoolDefParseXML(virConnectPtr conn,
 
     source_node = virXPathNode("./source", ctxt);
     if (source_node) {
-        if (virStoragePoolDefParseSource(conn, ctxt, &ret->source, ret->type,
+        if (virStoragePoolDefParseSource(ctxt, &ret->source, ret->type,
                                          source_node) < 0)
             goto cleanup;
     }
@@ -641,7 +633,7 @@ virStoragePoolDefParseXML(virConnectPtr conn,
         options->flags & VIR_STORAGE_POOL_SOURCE_NAME)
         ret->name = ret->source.name;
     if (ret->name == NULL) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                               "%s", _("missing pool source name element"));
         goto cleanup;
     }
@@ -649,13 +641,13 @@ virStoragePoolDefParseXML(virConnectPtr conn,
     uuid = virXPathString("string(./uuid)", ctxt);
     if (uuid == NULL) {
         if (virUUIDGenerate(ret->uuid) < 0) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   "%s", _("unable to generate uuid"));
             goto cleanup;
         }
     } else {
         if (virUUIDParse(uuid, ret->uuid) < 0) {
-            virStorageReportError(conn, VIR_ERR_XML_ERROR,
+            virStorageReportError(VIR_ERR_XML_ERROR,
                                   "%s", _("malformed uuid element"));
             goto cleanup;
         }
@@ -664,7 +656,7 @@ virStoragePoolDefParseXML(virConnectPtr conn,
 
     if (options->flags & VIR_STORAGE_POOL_SOURCE_HOST) {
         if (!ret->source.host.name) {
-            virStorageReportError(conn, VIR_ERR_XML_ERROR,
+            virStorageReportError(VIR_ERR_XML_ERROR,
                                   "%s",
                                   _("missing storage pool source host name"));
             goto cleanup;
@@ -673,7 +665,7 @@ virStoragePoolDefParseXML(virConnectPtr conn,
 
     if (options->flags & VIR_STORAGE_POOL_SOURCE_DIR) {
         if (!ret->source.dir) {
-            virStorageReportError(conn, VIR_ERR_XML_ERROR,
+            virStorageReportError(VIR_ERR_XML_ERROR,
                                   "%s", _("missing storage pool source path"));
             goto cleanup;
         }
@@ -691,19 +683,19 @@ virStoragePoolDefParseXML(virConnectPtr conn,
 
     if (options->flags & VIR_STORAGE_POOL_SOURCE_ADAPTER) {
         if (!ret->source.adapter) {
-            virStorageReportError(conn, VIR_ERR_XML_ERROR,
+            virStorageReportError(VIR_ERR_XML_ERROR,
                                   "%s", _("missing storage pool source adapter name"));
             goto cleanup;
         }
     }
 
     if ((ret->target.path = virXPathString("string(./target/path)", ctxt)) == NULL) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                               "%s", _("missing storage pool target path"));
         goto cleanup;
     }
 
-    if (virStorageDefParsePerms(conn, ctxt, &ret->target.perms,
+    if (virStorageDefParsePerms(ctxt, &ret->target.perms,
                                 "./target/permissions", 0700) < 0)
         goto cleanup;
 
@@ -723,13 +715,10 @@ catchXMLError (void *ctx, const char *msg ATTRIBUTE_UNUSED, ...)
     xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
 
     if (ctxt) {
-        virConnectPtr conn = ctxt->_private;
-
-        if (conn &&
-            conn->err.code == VIR_ERR_NONE &&
+        if (virGetLastError() == NULL &&
             ctxt->lastError.level == XML_ERR_FATAL &&
             ctxt->lastError.message != NULL) {
-            virStorageReportError (conn, VIR_ERR_XML_DETAIL,
+            virStorageReportError (VIR_ERR_XML_DETAIL,
                                    _("at line %d: %s"),
                                    ctxt->lastError.line,
                                    ctxt->lastError.message);
@@ -738,15 +727,14 @@ catchXMLError (void *ctx, const char *msg ATTRIBUTE_UNUSED, ...)
 }
 
 virStoragePoolDefPtr
-virStoragePoolDefParseNode(virConnectPtr conn,
-                           xmlDocPtr xml,
+virStoragePoolDefParseNode(xmlDocPtr xml,
                            xmlNodePtr root) {
     xmlXPathContextPtr ctxt = NULL;
     virStoragePoolDefPtr def = NULL;
 
     if (STRNEQ((const char *)root->name, "pool")) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
-                          "%s", _("unknown root element for storage pool"));
+        virStorageReportError(VIR_ERR_XML_ERROR,
+                              "%s", _("unknown root element for storage pool"));
         goto cleanup;
     }
 
@@ -757,15 +745,14 @@ virStoragePoolDefParseNode(virConnectPtr conn,
     }
 
     ctxt->node = root;
-    def = virStoragePoolDefParseXML(conn, ctxt);
+    def = virStoragePoolDefParseXML(ctxt);
 cleanup:
     xmlXPathFreeContext(ctxt);
     return def;
 }
 
 static virStoragePoolDefPtr
-virStoragePoolDefParse(virConnectPtr conn,
-                       const char *xmlStr,
+virStoragePoolDefParse(const char *xmlStr,
                        const char *filename) {
     virStoragePoolDefPtr ret = NULL;
     xmlParserCtxtPtr pctxt;
@@ -777,9 +764,7 @@ virStoragePoolDefParse(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 |
@@ -792,20 +777,20 @@ virStoragePoolDefParse(virConnectPtr conn,
     }
 
     if (!xml) {
-        if (conn && conn->err.code == VIR_ERR_NONE)
-              virStorageReportError(conn, VIR_ERR_XML_ERROR,
-                                    "%s",_("failed to parse xml document"));
+        if (virGetLastError() == NULL)
+            virStorageReportError(VIR_ERR_XML_ERROR,
+                                  "%s",_("failed to parse xml document"));
         goto cleanup;
     }
 
     node = xmlDocGetRootElement(xml);
     if (node == NULL) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                               "%s", _("missing root element"));
         goto cleanup;
     }
 
-    ret = virStoragePoolDefParseNode(conn, xml, node);
+    ret = virStoragePoolDefParseNode(xml, node);
 
     xmlFreeParserCtxt (pctxt);
     xmlFreeDoc(xml);
@@ -819,22 +804,19 @@ virStoragePoolDefParse(virConnectPtr conn,
 }
 
 virStoragePoolDefPtr
-virStoragePoolDefParseString(virConnectPtr conn,
-                             const char *xmlStr)
+virStoragePoolDefParseString(const char *xmlStr)
 {
-    return virStoragePoolDefParse(conn, xmlStr, NULL);
+    return virStoragePoolDefParse(xmlStr, NULL);
 }
 
 virStoragePoolDefPtr
-virStoragePoolDefParseFile(virConnectPtr conn,
-                           const char *filename)
+virStoragePoolDefParseFile(const char *filename)
 {
-    return virStoragePoolDefParse(conn, NULL, filename);
+    return virStoragePoolDefParse(NULL, filename);
 }
 
 static int
-virStoragePoolSourceFormat(virConnectPtr conn,
-                           virBufferPtr buf,
+virStoragePoolSourceFormat(virBufferPtr buf,
                            virStoragePoolOptionsPtr options,
                            virStoragePoolSourcePtr src)
 {
@@ -876,7 +858,7 @@ virStoragePoolSourceFormat(virConnectPtr conn,
     if (options->formatToString) {
         const char *format = (options->formatToString)(src->format);
         if (!format) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   _("unknown pool format number %d"),
                                   src->format);
             return -1;
@@ -896,8 +878,7 @@ virStoragePoolSourceFormat(virConnectPtr conn,
 
 
 char *
-virStoragePoolDefFormat(virConnectPtr conn,
-                        virStoragePoolDefPtr def) {
+virStoragePoolDefFormat(virStoragePoolDefPtr def) {
     virStoragePoolOptionsPtr options;
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     const char *type;
@@ -909,7 +890,7 @@ virStoragePoolDefFormat(virConnectPtr conn,
 
     type = virStoragePoolTypeToString(def->type);
     if (!type) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("unexpected pool type"));
         goto cleanup;
     }
@@ -926,7 +907,7 @@ virStoragePoolDefFormat(virConnectPtr conn,
     virBufferVSprintf(&buf,"  <available>%llu</available>\n",
                       def->available);
 
-    if (virStoragePoolSourceFormat(conn, &buf, options, &def->source) < 0)
+    if (virStoragePoolSourceFormat(&buf, options, &def->source) < 0)
         goto cleanup;
 
     virBufferAddLit(&buf,"  <target>\n");
@@ -964,8 +945,7 @@ virStoragePoolDefFormat(virConnectPtr conn,
 
 
 static int
-virStorageSize(virConnectPtr conn,
-               const char *unit,
+virStorageSize(const char *unit,
                const char *val,
                unsigned long long *ret) {
     unsigned long long mult;
@@ -1007,19 +987,19 @@ virStorageSize(virConnectPtr conn,
             break;
 
         default:
-            virStorageReportError(conn, VIR_ERR_XML_ERROR,
+            virStorageReportError(VIR_ERR_XML_ERROR,
                                   _("unknown size units '%s'"), unit);
             return -1;
         }
     }
 
     if (virStrToLong_ull (val, &end, 10, ret) < 0) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                               "%s", _("malformed capacity element"));
         return -1;
     }
     if (*ret > (ULLONG_MAX / mult)) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                               "%s", _("capacity element value too large"));
             return -1;
     }
@@ -1030,8 +1010,7 @@ virStorageSize(virConnectPtr conn,
 }
 
 static virStorageVolDefPtr
-virStorageVolDefParseXML(virConnectPtr conn,
-                         virStoragePoolDefPtr pool,
+virStorageVolDefParseXML(virStoragePoolDefPtr pool,
                          xmlXPathContextPtr ctxt) {
     virStorageVolDefPtr ret;
     virStorageVolOptionsPtr options;
@@ -1051,7 +1030,7 @@ virStorageVolDefParseXML(virConnectPtr conn,
 
     ret->name = virXPathString("string(./name)", ctxt);
     if (ret->name == NULL) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                               "%s", _("missing volume name element"));
         goto cleanup;
     }
@@ -1062,11 +1041,11 @@ virStorageVolDefParseXML(virConnectPtr conn,
     capacity = virXPathString("string(./capacity)", ctxt);
     unit = virXPathString("string(./capacity/@unit)", ctxt);
     if (capacity == NULL) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                               "%s", _("missing capacity element"));
         goto cleanup;
     }
-    if (virStorageSize(conn, unit, capacity, &ret->capacity) < 0)
+    if (virStorageSize(unit, capacity, &ret->capacity) < 0)
         goto cleanup;
     VIR_FREE(capacity);
     VIR_FREE(unit);
@@ -1074,7 +1053,7 @@ virStorageVolDefParseXML(virConnectPtr conn,
     allocation = virXPathString("string(./allocation)", ctxt);
     if (allocation) {
         unit = virXPathString("string(./allocation/@unit)", ctxt);
-        if (virStorageSize(conn, unit, allocation, &ret->allocation) < 0)
+        if (virStorageSize(unit, allocation, &ret->allocation) < 0)
             goto cleanup;
         VIR_FREE(allocation);
         VIR_FREE(unit);
@@ -1091,7 +1070,7 @@ virStorageVolDefParseXML(virConnectPtr conn,
             ret->target.format = (options->formatFromString)(format);
 
         if (ret->target.format < 0) {
-            virStorageReportError(conn, VIR_ERR_XML_ERROR,
+            virStorageReportError(VIR_ERR_XML_ERROR,
                                   _("unknown volume format type %s"), format);
             VIR_FREE(format);
             goto cleanup;
@@ -1099,13 +1078,13 @@ virStorageVolDefParseXML(virConnectPtr conn,
         VIR_FREE(format);
     }
 
-    if (virStorageDefParsePerms(conn, ctxt, &ret->target.perms,
+    if (virStorageDefParsePerms(ctxt, &ret->target.perms,
                                 "./target/permissions", 0600) < 0)
         goto cleanup;
 
     node = virXPathNode("./target/encryption", ctxt);
     if (node != NULL) {
-        ret->target.encryption = virStorageEncryptionParseNode(conn, ctxt->doc,
+        ret->target.encryption = virStorageEncryptionParseNode(ctxt->doc,
                                                                node);
         if (ret->target.encryption == NULL)
             goto cleanup;
@@ -1122,7 +1101,7 @@ virStorageVolDefParseXML(virConnectPtr conn,
             ret->backingStore.format = (options->formatFromString)(format);
 
         if (ret->backingStore.format < 0) {
-            virStorageReportError(conn, VIR_ERR_XML_ERROR,
+            virStorageReportError(VIR_ERR_XML_ERROR,
                                   _("unknown volume format type %s"), format);
             VIR_FREE(format);
             goto cleanup;
@@ -1130,7 +1109,7 @@ virStorageVolDefParseXML(virConnectPtr conn,
         VIR_FREE(format);
     }
 
-    if (virStorageDefParsePerms(conn, ctxt, &ret->backingStore.perms,
+    if (virStorageDefParsePerms(ctxt, &ret->backingStore.perms,
                                 "./backingStore/permissions", 0600) < 0)
         goto cleanup;
 
@@ -1145,15 +1124,14 @@ virStorageVolDefParseXML(virConnectPtr conn,
 }
 
 virStorageVolDefPtr
-virStorageVolDefParseNode(virConnectPtr conn,
-                          virStoragePoolDefPtr pool,
+virStorageVolDefParseNode(virStoragePoolDefPtr pool,
                           xmlDocPtr xml,
                           xmlNodePtr root) {
     xmlXPathContextPtr ctxt = NULL;
     virStorageVolDefPtr def = NULL;
 
     if (STRNEQ((const char *)root->name, "volume")) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                           "%s", _("unknown root element for storage vol"));
         goto cleanup;
     }
@@ -1165,15 +1143,14 @@ virStorageVolDefParseNode(virConnectPtr conn,
     }
 
     ctxt->node = root;
-    def = virStorageVolDefParseXML(conn, pool, ctxt);
+    def = virStorageVolDefParseXML(pool, ctxt);
 cleanup:
     xmlXPathFreeContext(ctxt);
     return def;
 }
 
 static virStorageVolDefPtr
-virStorageVolDefParse(virConnectPtr conn,
-                      virStoragePoolDefPtr pool,
+virStorageVolDefParse(virStoragePoolDefPtr pool,
                       const char *xmlStr,
                       const char *filename) {
     virStorageVolDefPtr ret = NULL;
@@ -1186,9 +1163,6 @@ virStorageVolDefParse(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,
@@ -1202,20 +1176,20 @@ virStorageVolDefParse(virConnectPtr conn,
     }
 
     if (!xml) {
-        if (conn && conn->err.code == VIR_ERR_NONE)
-              virStorageReportError(conn, VIR_ERR_XML_ERROR,
-                                    "%s", _("failed to parse xml document"));
+        if (virGetLastError() == NULL)
+            virStorageReportError(VIR_ERR_XML_ERROR,
+                                  "%s", _("failed to parse xml document"));
         goto cleanup;
     }
 
     node = xmlDocGetRootElement(xml);
     if (node == NULL) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                               "%s", _("missing root element"));
         goto cleanup;
     }
 
-    ret = virStorageVolDefParseNode(conn, pool, xml, node);
+    ret = virStorageVolDefParseNode(pool, xml, node);
 
     xmlFreeParserCtxt (pctxt);
     xmlFreeDoc(xml);
@@ -1229,24 +1203,21 @@ virStorageVolDefParse(virConnectPtr conn,
 }
 
 virStorageVolDefPtr
-virStorageVolDefParseString(virConnectPtr conn,
-                            virStoragePoolDefPtr pool,
+virStorageVolDefParseString(virStoragePoolDefPtr pool,
                             const char *xmlStr)
 {
-    return virStorageVolDefParse(conn, pool, xmlStr, NULL);
+    return virStorageVolDefParse(pool, xmlStr, NULL);
 }
 
 virStorageVolDefPtr
-virStorageVolDefParseFile(virConnectPtr conn,
-                          virStoragePoolDefPtr pool,
+virStorageVolDefParseFile(virStoragePoolDefPtr pool,
                           const char *filename)
 {
-    return virStorageVolDefParse(conn, pool, NULL, filename);
+    return virStorageVolDefParse(pool, NULL, filename);
 }
 
 static int
-virStorageVolTargetDefFormat(virConnectPtr conn,
-                             virStorageVolOptionsPtr options,
+virStorageVolTargetDefFormat(virStorageVolOptionsPtr options,
                              virBufferPtr buf,
                              virStorageVolTargetPtr def,
                              const char *type) {
@@ -1258,7 +1229,7 @@ virStorageVolTargetDefFormat(virConnectPtr conn,
     if (options->formatToString) {
         const char *format = (options->formatToString)(def->format);
         if (!format) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   _("unknown volume format number %d"),
                                   def->format);
             return -1;
@@ -1282,7 +1253,7 @@ virStorageVolTargetDefFormat(virConnectPtr conn,
     virBufferAddLit(buf,"    </permissions>\n");
 
     if (def->encryption != NULL &&
-        virStorageEncryptionFormat(conn, buf, def->encryption) < 0)
+        virStorageEncryptionFormat(buf, def->encryption) < 0)
         return -1;
 
     virBufferVSprintf(buf, "  </%s>\n", type);
@@ -1291,8 +1262,7 @@ virStorageVolTargetDefFormat(virConnectPtr conn,
 }
 
 char *
-virStorageVolDefFormat(virConnectPtr conn,
-                       virStoragePoolDefPtr pool,
+virStorageVolDefFormat(virStoragePoolDefPtr pool,
                        virStorageVolDefPtr def) {
     virStorageVolOptionsPtr options;
     virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -1335,12 +1305,12 @@ virStorageVolDefFormat(virConnectPtr conn,
     virBufferVSprintf(&buf,"  <allocation>%llu</allocation>\n",
                       def->allocation);
 
-    if (virStorageVolTargetDefFormat(conn, options, &buf,
+    if (virStorageVolTargetDefFormat(options, &buf,
                                      &def->target, "target") < 0)
         goto cleanup;
 
     if (def->backingStore.path &&
-        virStorageVolTargetDefFormat(conn, options, &buf,
+        virStorageVolTargetDefFormat(options, &buf,
                                      &def->backingStore, "backingStore") < 0)
         goto cleanup;
 
@@ -1437,8 +1407,7 @@ virStorageVolDefFindByName(virStoragePoolObjPtr pool,
 }
 
 virStoragePoolObjPtr
-virStoragePoolObjAssignDef(virConnectPtr conn,
-                           virStoragePoolObjListPtr pools,
+virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools,
                            virStoragePoolDefPtr def) {
     virStoragePoolObjPtr pool;
 
@@ -1460,7 +1429,7 @@ virStoragePoolObjAssignDef(virConnectPtr conn,
     }
 
     if (virMutexInit(&pool->lock) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("cannot initialize mutex"));
         VIR_FREE(pool);
         return NULL;
@@ -1482,27 +1451,26 @@ virStoragePoolObjAssignDef(virConnectPtr conn,
 }
 
 static virStoragePoolObjPtr
-virStoragePoolObjLoad(virConnectPtr conn,
-                      virStoragePoolObjListPtr pools,
+virStoragePoolObjLoad(virStoragePoolObjListPtr pools,
                       const char *file,
                       const char *path,
                       const char *autostartLink) {
     virStoragePoolDefPtr def;
     virStoragePoolObjPtr pool;
 
-    if (!(def = virStoragePoolDefParseFile(conn, path))) {
+    if (!(def = virStoragePoolDefParseFile(path))) {
         return NULL;
     }
 
     if (!virFileMatchesNameSuffix(file, def->name, ".xml")) {
-        virStorageError(conn, VIR_ERR_INVALID_STORAGE_POOL,
-            "Storage pool config filename '%s' does not match pool name '%s'",
-                      path, def->name);
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
+                              "Storage pool config filename '%s' does not match pool name '%s'",
+                              path, def->name);
         virStoragePoolDefFree(def);
         return NULL;
     }
 
-    if (!(pool = virStoragePoolObjAssignDef(conn, pools, def))) {
+    if (!(pool = virStoragePoolObjAssignDef(pools, def))) {
         virStoragePoolDefFree(def);
         return NULL;
     }
@@ -1528,8 +1496,7 @@ virStoragePoolObjLoad(virConnectPtr conn,
 
 
 int
-virStoragePoolLoadAllConfigs(virConnectPtr conn,
-                             virStoragePoolObjListPtr pools,
+virStoragePoolLoadAllConfigs(virStoragePoolObjListPtr pools,
                              const char *configDir,
                              const char *autostartDir) {
     DIR *dir;
@@ -1556,21 +1523,21 @@ virStoragePoolLoadAllConfigs(virConnectPtr conn,
 
         if (virFileBuildPath(configDir, entry->d_name,
                              NULL, path, PATH_MAX) < 0) {
-            virStorageError(conn, VIR_ERR_INTERNAL_ERROR,
-                            "Config filename '%s/%s' is too long",
-                            configDir, entry->d_name);
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+                                  "Config filename '%s/%s' is too long",
+                                  configDir, entry->d_name);
             continue;
         }
 
         if (virFileBuildPath(autostartDir, entry->d_name,
                              NULL, autostartLink, PATH_MAX) < 0) {
-            virStorageError(conn, VIR_ERR_INTERNAL_ERROR,
-                            "Autostart link path '%s/%s' is too long",
-                            autostartDir, entry->d_name);
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+                                  "Autostart link path '%s/%s' is too long",
+                                  autostartDir, entry->d_name);
             continue;
         }
 
-        pool = virStoragePoolObjLoad(conn, pools, entry->d_name, path,
+        pool = virStoragePoolObjLoad(pools, entry->d_name, path,
                                      autostartLink);
         if (pool)
             virStoragePoolObjUnlock(pool);
@@ -1582,8 +1549,7 @@ virStoragePoolLoadAllConfigs(virConnectPtr conn,
 }
 
 int
-virStoragePoolObjSaveDef(virConnectPtr conn,
-                         virStorageDriverStatePtr driver,
+virStoragePoolObjSaveDef(virStorageDriverStatePtr driver,
                          virStoragePoolObjPtr pool,
                          virStoragePoolDefPtr def) {
     char *xml;
@@ -1603,7 +1569,7 @@ virStoragePoolObjSaveDef(virConnectPtr conn,
 
         if (virFileBuildPath(driver->configDir, def->name, ".xml",
                              path, sizeof(path)) < 0) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   "%s", _("cannot construct config file path"));
             return -1;
         }
@@ -1614,7 +1580,7 @@ virStoragePoolObjSaveDef(virConnectPtr conn,
 
         if (virFileBuildPath(driver->autostartDir, def->name, ".xml",
                              path, sizeof(path)) < 0) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   "%s", _("cannot construct "
                                           "autostart link path"));
             VIR_FREE(pool->configFile);
@@ -1627,8 +1593,8 @@ virStoragePoolObjSaveDef(virConnectPtr conn,
         }
     }
 
-    if (!(xml = virStoragePoolDefFormat(conn, def))) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+    if (!(xml = virStoragePoolDefFormat(def))) {
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("failed to generate XML"));
         return -1;
     }
@@ -1669,16 +1635,15 @@ virStoragePoolObjSaveDef(virConnectPtr conn,
 }
 
 int
-virStoragePoolObjDeleteDef(virConnectPtr conn,
-                           virStoragePoolObjPtr pool) {
+virStoragePoolObjDeleteDef(virStoragePoolObjPtr pool) {
     if (!pool->configFile) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("no config file for %s"), pool->def->name);
         return -1;
     }
 
     if (unlink(pool->configFile) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("cannot remove config for %s"),
                               pool->def->name);
         return -1;
@@ -1688,8 +1653,7 @@ virStoragePoolObjDeleteDef(virConnectPtr conn,
 }
 
 virStoragePoolSourcePtr
-virStoragePoolSourceListNewSource(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
-                                  virStoragePoolSourceListPtr list)
+virStoragePoolSourceListNewSource(virStoragePoolSourceListPtr list)
 {
     virStoragePoolSourcePtr source;
 
@@ -1704,8 +1668,7 @@ virStoragePoolSourceListNewSource(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORAR
     return source;
 }
 
-char *virStoragePoolSourceListFormat(virConnectPtr conn,
-                                     virStoragePoolSourceListPtr def)
+char *virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def)
 {
     virStoragePoolOptionsPtr options;
     virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -1718,7 +1681,7 @@ char *virStoragePoolSourceListFormat(virConnectPtr conn,
 
     type = virStoragePoolTypeToString(def->type);
     if (!type) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("unexpected pool type"));
         goto cleanup;
     }
@@ -1726,7 +1689,7 @@ char *virStoragePoolSourceListFormat(virConnectPtr conn,
     virBufferAddLit(&buf, "<sources>\n");
 
     for (i = 0; i < def->nsources; i++) {
-        virStoragePoolSourceFormat(conn, &buf, options, &def->sources[i]);
+        virStoragePoolSourceFormat(&buf, options, &def->sources[i]);
     }
 
     virBufferAddLit(&buf, "</sources>\n");
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index a5f0100..c643984 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -318,12 +318,11 @@ static inline int virStoragePoolObjIsActive(virStoragePoolObjPtr pool) {
     return pool->active;
 }
 
-#define virStorageReportError(conn, code, fmt...)                            \
-        virReportErrorHelper(conn, VIR_FROM_STORAGE, code, __FILE__,       \
-                               __FUNCTION__, __LINE__, fmt)
+#define virStorageReportError(code, fmt...)                             \
+    virReportErrorHelper(NULL, VIR_FROM_STORAGE, code, __FILE__,        \
+                         __FUNCTION__, __LINE__, fmt)
 
-int virStoragePoolLoadAllConfigs(virConnectPtr conn,
-                                 virStoragePoolObjListPtr pools,
+int virStoragePoolLoadAllConfigs(virStoragePoolObjListPtr pools,
                                  const char *configDir,
                                  const char *autostartDir);
 
@@ -341,40 +340,29 @@ virStorageVolDefPtr virStorageVolDefFindByName(virStoragePoolObjPtr pool,
 
 void virStoragePoolObjClearVols(virStoragePoolObjPtr pool);
 
-virStoragePoolDefPtr virStoragePoolDefParseString(virConnectPtr conn,
-                                                  const char *xml);
-virStoragePoolDefPtr virStoragePoolDefParseFile(virConnectPtr conn,
-                                                const char *filename);
-virStoragePoolDefPtr virStoragePoolDefParseNode(virConnectPtr conn,
-                                                xmlDocPtr xml,
+virStoragePoolDefPtr virStoragePoolDefParseString(const char *xml);
+virStoragePoolDefPtr virStoragePoolDefParseFile(const char *filename);
+virStoragePoolDefPtr virStoragePoolDefParseNode(xmlDocPtr xml,
                                                 xmlNodePtr root);
-char *virStoragePoolDefFormat(virConnectPtr conn,
-                              virStoragePoolDefPtr def);
+char *virStoragePoolDefFormat(virStoragePoolDefPtr def);
 
-virStorageVolDefPtr virStorageVolDefParseString(virConnectPtr conn,
-                                                virStoragePoolDefPtr pool,
+virStorageVolDefPtr virStorageVolDefParseString(virStoragePoolDefPtr pool,
                                                 const char *xml);
-virStorageVolDefPtr virStorageVolDefParseFile(virConnectPtr conn,
-                                              virStoragePoolDefPtr pool,
+virStorageVolDefPtr virStorageVolDefParseFile(virStoragePoolDefPtr pool,
                                               const char *filename);
-virStorageVolDefPtr virStorageVolDefParseNode(virConnectPtr conn,
-                                              virStoragePoolDefPtr pool,
+virStorageVolDefPtr virStorageVolDefParseNode(virStoragePoolDefPtr pool,
                                               xmlDocPtr xml,
                                               xmlNodePtr root);
-char *virStorageVolDefFormat(virConnectPtr conn,
-                             virStoragePoolDefPtr pool,
+char *virStorageVolDefFormat(virStoragePoolDefPtr pool,
                              virStorageVolDefPtr def);
 
-virStoragePoolObjPtr virStoragePoolObjAssignDef(virConnectPtr conn,
-                                                virStoragePoolObjListPtr pools,
+virStoragePoolObjPtr virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools,
                                                 virStoragePoolDefPtr def);
 
-int virStoragePoolObjSaveDef(virConnectPtr conn,
-                             virStorageDriverStatePtr driver,
+int virStoragePoolObjSaveDef(virStorageDriverStatePtr driver,
                              virStoragePoolObjPtr pool,
                              virStoragePoolDefPtr def);
-int virStoragePoolObjDeleteDef(virConnectPtr conn,
-                               virStoragePoolObjPtr pool);
+int virStoragePoolObjDeleteDef(virStoragePoolObjPtr pool);
 
 void virStorageVolDefFree(virStorageVolDefPtr def);
 void virStoragePoolSourceFree(virStoragePoolSourcePtr source);
@@ -385,14 +373,11 @@ void virStoragePoolObjRemove(virStoragePoolObjListPtr pools,
                              virStoragePoolObjPtr pool);
 
 virStoragePoolSourcePtr
-virStoragePoolDefParseSourceString(virConnectPtr conn,
-                                   const char *srcSpec,
+virStoragePoolDefParseSourceString(const char *srcSpec,
                                    int pool_type);
 virStoragePoolSourcePtr
-virStoragePoolSourceListNewSource(virConnectPtr conn,
-                                  virStoragePoolSourceListPtr list);
-char *virStoragePoolSourceListFormat(virConnectPtr conn,
-                                     virStoragePoolSourceListPtr def);
+virStoragePoolSourceListNewSource(virStoragePoolSourceListPtr list);
+char *virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def);
 
 void virStoragePoolObjLock(virStoragePoolObjPtr obj);
 void virStoragePoolObjUnlock(virStoragePoolObjPtr obj);
diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c
index f19af88..ed71688 100644
--- a/src/conf/storage_encryption_conf.c
+++ b/src/conf/storage_encryption_conf.c
@@ -70,7 +70,7 @@ virStorageEncryptionFree(virStorageEncryptionPtr enc)
 #ifndef PROXY
 
 static virStorageEncryptionSecretPtr
-virStorageEncryptionSecretParse(virConnectPtr conn, xmlXPathContextPtr ctxt,
+virStorageEncryptionSecretParse(xmlXPathContextPtr ctxt,
                                 xmlNodePtr node)
 {
     xmlNodePtr old_node;
@@ -89,13 +89,13 @@ virStorageEncryptionSecretParse(virConnectPtr conn, xmlXPathContextPtr ctxt,
 
     type_str = virXPathString("string(./@type)", ctxt);
     if (type_str == NULL) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR, "%s",
+        virStorageReportError(VIR_ERR_XML_ERROR, "%s",
                               _("unknown volume encryption secret type"));
         goto cleanup;
     }
     type = virStorageEncryptionSecretTypeTypeFromString(type_str);
     if (type < 0) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                               _("unknown volume encryption secret type %s"),
                               type_str);
         VIR_FREE(type_str);
@@ -107,14 +107,14 @@ virStorageEncryptionSecretParse(virConnectPtr conn, xmlXPathContextPtr ctxt,
     uuidstr = virXPathString("string(./@uuid)", ctxt);
     if (uuidstr) {
         if (virUUIDParse(uuidstr, ret->uuid) < 0) {
-            virStorageReportError(conn, VIR_ERR_XML_ERROR,
+            virStorageReportError(VIR_ERR_XML_ERROR,
                                   _("malformed volume encryption uuid '%s'"),
                                   uuidstr);
             goto cleanup;
         }
         VIR_FREE(uuidstr);
     } else {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR, "%s",
+        virStorageReportError(VIR_ERR_XML_ERROR, "%s",
                               _("missing volume encryption uuid"));
         goto cleanup;
     }
@@ -129,7 +129,7 @@ virStorageEncryptionSecretParse(virConnectPtr conn, xmlXPathContextPtr ctxt,
 }
 
 static virStorageEncryptionPtr
-virStorageEncryptionParseXML(virConnectPtr conn, xmlXPathContextPtr ctxt)
+virStorageEncryptionParseXML(xmlXPathContextPtr ctxt)
 {
     xmlNodePtr *nodes = NULL;
     virStorageEncryptionPtr ret;
@@ -143,13 +143,13 @@ virStorageEncryptionParseXML(virConnectPtr conn, xmlXPathContextPtr ctxt)
 
     format_str = virXPathString("string(./@format)", ctxt);
     if (format_str == NULL) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR, "%s",
+        virStorageReportError(VIR_ERR_XML_ERROR, "%s",
                               _("unknown volume encryption format"));
         goto cleanup;
     }
     format = virStorageEncryptionFormatTypeFromString(format_str);
     if (format < 0) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                               _("unknown volume encryption format type %s"),
                               format_str);
         VIR_FREE(format_str);
@@ -160,7 +160,7 @@ virStorageEncryptionParseXML(virConnectPtr conn, xmlXPathContextPtr ctxt)
 
     n = virXPathNodeSet("./secret", ctxt, &nodes);
     if (n < 0){
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                               _("cannot extract volume encryption secrets"));
         goto cleanup;
     }
@@ -170,7 +170,7 @@ virStorageEncryptionParseXML(virConnectPtr conn, xmlXPathContextPtr ctxt)
     }
     ret->nsecrets = n;
     for (i = 0; i < n; i++) {
-        ret->secrets[i] = virStorageEncryptionSecretParse(conn, ctxt, nodes[i]);
+        ret->secrets[i] = virStorageEncryptionSecretParse(ctxt, nodes[i]);
         if (ret->secrets[i] == NULL)
             goto cleanup;
     }
@@ -185,14 +185,13 @@ virStorageEncryptionParseXML(virConnectPtr conn, xmlXPathContextPtr ctxt)
 }
 
 virStorageEncryptionPtr
-virStorageEncryptionParseNode(virConnectPtr conn,
-                              xmlDocPtr xml, xmlNodePtr root)
+virStorageEncryptionParseNode(xmlDocPtr xml, xmlNodePtr root)
 {
     xmlXPathContextPtr ctxt = NULL;
     virStorageEncryptionPtr enc = NULL;
 
     if (STRNEQ((const char *) root->name, "encryption")) {
-        virStorageReportError(conn, VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_XML_ERROR,
                               "%s", _("unknown root element for volume "
                                       "encryption information"));
         goto cleanup;
@@ -205,7 +204,7 @@ virStorageEncryptionParseNode(virConnectPtr conn,
     }
 
     ctxt->node = root;
-    enc = virStorageEncryptionParseXML(conn, ctxt);
+    enc = virStorageEncryptionParseXML(ctxt);
 
   cleanup:
     xmlXPathFreeContext(ctxt);
@@ -215,8 +214,7 @@ virStorageEncryptionParseNode(virConnectPtr conn,
 
 
 static int
-virStorageEncryptionSecretFormat(virConnectPtr conn,
-                                 virBufferPtr buf,
+virStorageEncryptionSecretFormat(virBufferPtr buf,
                                  virStorageEncryptionSecretPtr secret)
 {
     const char *type;
@@ -224,7 +222,7 @@ virStorageEncryptionSecretFormat(virConnectPtr conn,
 
     type = virStorageEncryptionSecretTypeTypeToString(secret->type);
     if (!type) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                               _("unexpected volume encryption secret type"));
         return -1;
     }
@@ -235,8 +233,7 @@ virStorageEncryptionSecretFormat(virConnectPtr conn,
 }
 
 int
-virStorageEncryptionFormat(virConnectPtr conn,
-                           virBufferPtr buf,
+virStorageEncryptionFormat(virBufferPtr buf,
                            virStorageEncryptionPtr enc)
 {
     const char *format;
@@ -244,14 +241,14 @@ virStorageEncryptionFormat(virConnectPtr conn,
 
     format = virStorageEncryptionFormatTypeToString(enc->format);
     if (!format) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("unexpected encryption format"));
         return -1;
     }
     virBufferVSprintf(buf, "    <encryption format='%s'>\n", format);
 
     for (i = 0; i < enc->nsecrets; i++) {
-        if (virStorageEncryptionSecretFormat(conn, buf, enc->secrets[i]) < 0)
+        if (virStorageEncryptionSecretFormat(buf, enc->secrets[i]) < 0)
             return -1;
     }
 
@@ -261,7 +258,7 @@ virStorageEncryptionFormat(virConnectPtr conn,
 }
 
 int
-virStorageGenerateQcowPassphrase(virConnectPtr conn, unsigned char *dest)
+virStorageGenerateQcowPassphrase(unsigned char *dest)
 {
     int fd;
     size_t i;
@@ -271,7 +268,7 @@ virStorageGenerateQcowPassphrase(virConnectPtr conn, unsigned char *dest)
        unpleasant surprises with the qemu monitor input mechanism. */
     fd = open("/dev/urandom", O_RDONLY);
     if (fd < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                               _("Cannot open /dev/urandom"));
         return -1;
     }
@@ -282,7 +279,7 @@ virStorageGenerateQcowPassphrase(virConnectPtr conn, unsigned char *dest)
         while ((r = read(fd, dest + i, 1)) == -1 && errno == EINTR)
             ;
         if (r <= 0) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                   _("Cannot read from /dev/urandom"));
             close(fd);
             return -1;
diff --git a/src/conf/storage_encryption_conf.h b/src/conf/storage_encryption_conf.h
index 5d0bc3c..bb19850 100644
--- a/src/conf/storage_encryption_conf.h
+++ b/src/conf/storage_encryption_conf.h
@@ -64,10 +64,9 @@ struct _virStorageEncryption {
 
 void virStorageEncryptionFree(virStorageEncryptionPtr enc);
 
-virStorageEncryptionPtr virStorageEncryptionParseNode(virConnectPtr conn,
-                                                      xmlDocPtr xml,
+virStorageEncryptionPtr virStorageEncryptionParseNode(xmlDocPtr xml,
                                                       xmlNodePtr root);
-int virStorageEncryptionFormat(virConnectPtr conn, virBufferPtr buf,
+int virStorageEncryptionFormat(virBufferPtr buf,
                                virStorageEncryptionPtr enc);
 
 /* A helper for VIR_STORAGE_ENCRYPTION_FORMAT_QCOW */
@@ -75,6 +74,6 @@ enum {
   VIR_STORAGE_QCOW_PASSPHRASE_SIZE = 16
 };
 
-int virStorageGenerateQcowPassphrase(virConnectPtr conn, unsigned char *dest);
+int virStorageGenerateQcowPassphrase(unsigned char *dest);
 
 #endif /* __VIR_STORAGE_ENCRYPTION_H__ */
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 4c62d48..de7fbd1 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -271,7 +271,7 @@ cleanup:
 }
 
 int
-virStorageBackendCreateRaw(virConnectPtr conn,
+virStorageBackendCreateRaw(virConnectPtr conn ATTRIBUTE_UNUSED,
                            virStoragePoolObjPtr pool,
                            virStorageVolDefPtr vol,
                            virStorageVolDefPtr inputvol,
@@ -284,7 +284,7 @@ virStorageBackendCreateRaw(virConnectPtr conn,
     char *buf = NULL;
 
     if (vol->target.encryption != NULL) {
-        virStorageReportError(conn, VIR_ERR_NO_SUPPORT,
+        virStorageReportError(VIR_ERR_NO_SUPPORT,
                               "%s", _("storage pool does not support encrypted "
                                       "volumes"));
         return -1;
@@ -419,14 +419,14 @@ virStorageGenerateQcowEncryption(virConnectPtr conn,
         conn->secretDriver->lookupByUUID == NULL ||
         conn->secretDriver->defineXML == NULL ||
         conn->secretDriver->setValue == NULL) {
-        virStorageReportError(conn, VIR_ERR_NO_SUPPORT, "%s",
+        virStorageReportError(VIR_ERR_NO_SUPPORT, "%s",
                               _("secret storage not supported"));
         goto cleanup;
     }
 
     enc = vol->target.encryption;
     if (enc->nsecrets != 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                               _("secrets already defined"));
         goto cleanup;
     }
@@ -461,7 +461,7 @@ virStorageGenerateQcowEncryption(virConnectPtr conn,
     }
     VIR_FREE(xml);
 
-    if (virStorageGenerateQcowPassphrase(conn, value) < 0)
+    if (virStorageGenerateQcowPassphrase(value) < 0)
         goto cleanup;
 
     if (conn->secretDriver->setValue(secret, value, sizeof(value), 0) < 0)
@@ -619,13 +619,13 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
     };
 
     if (type == NULL) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("unknown storage vol type %d"),
                               vol->target.format);
         return -1;
     }
     if (inputvol && inputType == NULL) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("unknown storage vol type %d"),
                               inputvol->target.format);
         return -1;
@@ -640,14 +640,14 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
         if (inputvol &&
             (!inputBackingPath ||
              STRNEQ(inputBackingPath, vol->backingStore.path))) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   "%s", _("a different backing store can not "
                                           "be specified."));
             return -1;
         }
 
         if (backingType == NULL) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   _("unknown storage vol backing store type %d"),
                                   vol->backingStore.format);
             return -1;
@@ -665,7 +665,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
 
         if (vol->target.format != VIR_STORAGE_FILE_QCOW &&
             vol->target.format != VIR_STORAGE_FILE_QCOW2) {
-            virStorageReportError(conn, VIR_ERR_NO_SUPPORT,
+            virStorageReportError(VIR_ERR_NO_SUPPORT,
                                   _("qcow volume encryption unsupported with "
                                     "volume format %s"), type);
             return -1;
@@ -673,13 +673,13 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
         enc = vol->target.encryption;
         if (enc->format != VIR_STORAGE_ENCRYPTION_FORMAT_QCOW &&
             enc->format != VIR_STORAGE_ENCRYPTION_FORMAT_DEFAULT) {
-            virStorageReportError(conn, VIR_ERR_NO_SUPPORT,
+            virStorageReportError(VIR_ERR_NO_SUPPORT,
                                   _("unsupported volume encryption format %d"),
                                   vol->target.encryption->format);
             return -1;
         }
         if (enc->nsecrets > 1) {
-            virStorageReportError(conn, VIR_ERR_INVALID_STORAGE_VOL, "%s",
+            virStorageReportError(VIR_ERR_INVALID_STORAGE_VOL, "%s",
                                   _("too many secrets for qcow encryption"));
             return -1;
         }
@@ -695,7 +695,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
     else if ((create_tool = virFindFileInPath("qemu-img")) != NULL)
         use_kvmimg = 0;
     else {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("unable to find kvm-img or qemu-img"));
         return -1;
     }
@@ -737,7 +737,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
  * with a partially functional qcow-create. Go figure ??!?
  */
 static int
-virStorageBackendCreateQcowCreate(virConnectPtr conn,
+virStorageBackendCreateQcowCreate(virConnectPtr conn ATTRIBUTE_UNUSED,
                                   virStoragePoolObjPtr pool,
                                   virStorageVolDefPtr vol,
                                   virStorageVolDefPtr inputvol,
@@ -748,25 +748,25 @@ virStorageBackendCreateQcowCreate(virConnectPtr conn,
     const char *imgargv[4];
 
     if (inputvol) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                               _("cannot copy from volume with qcow-create"));
         return -1;
     }
 
     if (vol->target.format != VIR_STORAGE_FILE_QCOW2) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("unsupported storage vol type %d"),
                               vol->target.format);
         return -1;
     }
     if (vol->backingStore.path != NULL) {
-        virStorageReportError(conn, VIR_ERR_NO_SUPPORT, "%s",
+        virStorageReportError(VIR_ERR_NO_SUPPORT, "%s",
                               _("copy-on-write image not supported with "
                                       "qcow-create"));
         return -1;
     }
     if (vol->target.encryption != NULL) {
-        virStorageReportError(conn, VIR_ERR_NO_SUPPORT,
+        virStorageReportError(VIR_ERR_NO_SUPPORT,
                               "%s", _("encrypted volumes not supported with "
                                       "qcow-create"));
         return -1;
@@ -787,7 +787,7 @@ virStorageBackendCreateQcowCreate(virConnectPtr conn,
 }
 
 virStorageBackendBuildVolFrom
-virStorageBackendFSImageToolTypeToFunc(virConnectPtr conn, int tool_type)
+virStorageBackendFSImageToolTypeToFunc(int tool_type)
 {
     switch (tool_type) {
     case TOOL_KVM_IMG:
@@ -796,7 +796,7 @@ virStorageBackendFSImageToolTypeToFunc(virConnectPtr conn, int tool_type)
     case TOOL_QCOW_CREATE:
         return virStorageBackendCreateQcowCreate;
     default:
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("Unknown file create tool type '%d'."),
                               tool_type);
     }
@@ -827,8 +827,7 @@ virStorageBackendFindFSImageTool(char **tool)
 }
 
 virStorageBackendBuildVolFrom
-virStorageBackendGetBuildVolFromFunction(virConnectPtr conn,
-                                         virStorageVolDefPtr vol,
+virStorageBackendGetBuildVolFromFunction(virStorageVolDefPtr vol,
                                          virStorageVolDefPtr inputvol)
 {
     int tool_type;
@@ -845,13 +844,13 @@ virStorageBackendGetBuildVolFromFunction(virConnectPtr conn,
          inputvol->target.format != VIR_STORAGE_FILE_RAW)) {
 
         if ((tool_type = virStorageBackendFindFSImageTool(NULL)) < 0) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   "%s", _("creation of non-raw file images is "
                                           "not supported without qemu-img."));
             return NULL;
         }
 
-        return virStorageBackendFSImageToolTypeToFunc(conn, tool_type);
+        return virStorageBackendFSImageToolTypeToFunc(tool_type);
     }
 
     if (vol->type == VIR_STORAGE_VOL_BLOCK)
@@ -868,7 +867,7 @@ virStorageBackendForType(int type) {
         if (backends[i]->type == type)
             return backends[i];
 
-    virStorageReportError(NULL, VIR_ERR_INTERNAL_ERROR,
+    virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                           _("missing backend for pool type %d"), type);
     return NULL;
 }
@@ -1192,8 +1191,7 @@ virStorageBackendStablePath(virStoragePoolObjPtr pool,
  * then run a callback passing in all the matches
  */
 int
-virStorageBackendRunProgRegex(virConnectPtr conn,
-                              virStoragePoolObjPtr pool,
+virStorageBackendRunProgRegex(virStoragePoolObjPtr pool,
                               const char *const*prog,
                               int nregex,
                               const char **regex,
@@ -1223,7 +1221,7 @@ virStorageBackendRunProgRegex(virConnectPtr conn,
         if (err != 0) {
             char error[100];
             regerror(err, &reg[i], error, sizeof(error));
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   _("Failed to compile regex %s"), error);
             for (j = 0 ; j <= i ; j++)
                 regfree(&reg[j]);
@@ -1255,7 +1253,7 @@ virStorageBackendRunProgRegex(virConnectPtr conn,
     }
 
     if ((list = fdopen(fd, "r")) == NULL) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("cannot read fd"));
         goto cleanup;
     }
@@ -1286,7 +1284,7 @@ virStorageBackendRunProgRegex(virConnectPtr conn,
 
                 /* We're matching on the last regex, so callback time */
                 if (i == (nregex-1)) {
-                    if (((*func)(conn, pool, groups, data)) < 0)
+                    if (((*func)(pool, groups, data)) < 0)
                         goto cleanup;
 
                     /* Release matches & restart to matching the first regex */
@@ -1337,7 +1335,7 @@ virStorageBackendRunProgRegex(virConnectPtr conn,
             if (outexit != NULL)
                 *outexit = WEXITSTATUS(exitstatus);
         } else {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   "%s", _("command did not exit cleanly"));
             return -1;
         }
@@ -1358,8 +1356,7 @@ virStorageBackendRunProgRegex(virConnectPtr conn,
  * If there are no input tokens (empty input), call FUNC with N_COLUMNS == 0.
  */
 int
-virStorageBackendRunProgNul(virConnectPtr conn,
-                            virStoragePoolObjPtr pool,
+virStorageBackendRunProgNul(virStoragePoolObjPtr pool,
                             const char **prog,
                             size_t n_columns,
                             virStorageBackendListVolNulFunc func,
@@ -1391,7 +1388,7 @@ virStorageBackendRunProgNul(virConnectPtr conn,
     }
 
     if ((fp = fdopen(fd, "r")) == NULL) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("cannot read fd"));
         goto cleanup;
     }
@@ -1406,13 +1403,13 @@ virStorageBackendRunProgNul(virConnectPtr conn,
         if (tok_len < 0) {
             /* Maybe EOF, maybe an error.
                If n_tok > 0, then we know it's an error.  */
-            if (n_tok && func (conn, pool, n_tok, v, data) < 0)
+            if (n_tok && func (pool, n_tok, v, data) < 0)
                 goto cleanup;
             break;
         }
         ++n_tok;
         if (n_tok == n_columns) {
-            if (func (conn, pool, n_tok, v, data) < 0)
+            if (func (pool, n_tok, v, data) < 0)
                 goto cleanup;
             n_tok = 0;
             for (i = 0; i < n_columns; i++) {
@@ -1452,13 +1449,13 @@ virStorageBackendRunProgNul(virConnectPtr conn,
     } else {
         if (WIFEXITED(exitstatus)) {
             if (WEXITSTATUS(exitstatus) != 0) {
-                virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                       _("non-zero exit status from command %d"),
                                       WEXITSTATUS(exitstatus));
                 return -1;
             }
         } else {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   "%s", _("command did not exit cleanly"));
             return -1;
         }
@@ -1480,7 +1477,7 @@ virStorageBackendRunProgRegex(virConnectPtr conn,
                               void *data ATTRIBUTE_UNUSED,
                               int *outexit ATTRIBUTE_UNUSED)
 {
-    virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, _("%s not implemented on Win32"), __FUNCTION__);
+    virStorageReportError(VIR_ERR_INTERNAL_ERROR, _("%s not implemented on Win32"), __FUNCTION__);
     return -1;
 }
 
@@ -1492,7 +1489,7 @@ virStorageBackendRunProgNul(virConnectPtr conn,
                             virStorageBackendListVolNulFunc func ATTRIBUTE_UNUSED,
                             void *data ATTRIBUTE_UNUSED)
 {
-    virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, _("%s not implemented on Win32"), __FUNCTION__);
+    virStorageReportError(VIR_ERR_INTERNAL_ERROR, _("%s not implemented on Win32"), __FUNCTION__);
     return -1;
 }
 #endif
diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h
index a69aeee..00bc725 100644
--- a/src/storage/storage_backend.h
+++ b/src/storage/storage_backend.h
@@ -51,13 +51,11 @@ int virStorageBackendCreateRaw(virConnectPtr conn,
                                virStorageVolDefPtr inputvol,
                                unsigned int flags);
 virStorageBackendBuildVolFrom
-virStorageBackendGetBuildVolFromFunction(virConnectPtr conn,
-                                         virStorageVolDefPtr vol,
+virStorageBackendGetBuildVolFromFunction(virStorageVolDefPtr vol,
                                          virStorageVolDefPtr inputvol);
 int virStorageBackendFindFSImageTool(char **tool);
 virStorageBackendBuildVolFrom
-virStorageBackendFSImageToolTypeToFunc(virConnectPtr conn,
-                                       int tool_type);
+virStorageBackendFSImageToolTypeToFunc(int tool_type);
 
 
 typedef struct _virStorageBackend virStorageBackend;
@@ -100,18 +98,15 @@ virStorageBackendUpdateVolTargetFormatFD(virStorageVolTargetPtr target,
 char *virStorageBackendStablePath(virStoragePoolObjPtr pool,
                                   const char *devpath);
 
-typedef int (*virStorageBackendListVolRegexFunc)(virConnectPtr conn,
-                                                 virStoragePoolObjPtr pool,
+typedef int (*virStorageBackendListVolRegexFunc)(virStoragePoolObjPtr pool,
                                                  char **const groups,
                                                  void *data);
-typedef int (*virStorageBackendListVolNulFunc)(virConnectPtr conn,
-                                               virStoragePoolObjPtr pool,
+typedef int (*virStorageBackendListVolNulFunc)(virStoragePoolObjPtr pool,
                                                size_t n_tokens,
                                                char **const groups,
                                                void *data);
 
-int virStorageBackendRunProgRegex(virConnectPtr conn,
-                                  virStoragePoolObjPtr pool,
+int virStorageBackendRunProgRegex(virStoragePoolObjPtr pool,
                                   const char *const*prog,
                                   int nregex,
                                   const char **regex,
@@ -120,8 +115,7 @@ int virStorageBackendRunProgRegex(virConnectPtr conn,
                                   void *data,
                                   int *exitstatus);
 
-int virStorageBackendRunProgNul(virConnectPtr conn,
-                                virStoragePoolObjPtr pool,
+int virStorageBackendRunProgNul(virStoragePoolObjPtr pool,
                                 const char **prog,
                                 size_t n_columns,
                                 virStorageBackendListVolNulFunc func,
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 2082841..5717cfd 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -39,8 +39,7 @@
 #define SECTOR_SIZE 512
 
 static int
-virStorageBackendDiskMakeDataVol(virConnectPtr conn,
-                                 virStoragePoolObjPtr pool,
+virStorageBackendDiskMakeDataVol(virStoragePoolObjPtr pool,
                                  char **const groups,
                                  virStorageVolDefPtr vol)
 {
@@ -105,14 +104,14 @@ virStorageBackendDiskMakeDataVol(virConnectPtr conn,
 
         if (virStrToLong_ull(groups[3], NULL, 10,
                              &vol->source.extents[0].start) < 0) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   "%s", _("cannot parse device start location"));
             return -1;
         }
 
         if (virStrToLong_ull(groups[4], NULL, 10,
                              &vol->source.extents[0].end) < 0) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   "%s", _("cannot parse device end location"));
             return -1;
         }
@@ -154,8 +153,7 @@ virStorageBackendDiskMakeDataVol(virConnectPtr conn,
 }
 
 static int
-virStorageBackendDiskMakeFreeExtent(virConnectPtr conn ATTRIBUTE_UNUSED,
-                                    virStoragePoolObjPtr pool,
+virStorageBackendDiskMakeFreeExtent(virStoragePoolObjPtr pool,
                                     char **const groups)
 {
     virStoragePoolSourceDevicePtr dev = &pool->def->source.devices[0];
@@ -202,8 +200,7 @@ virStorageBackendDiskMakeFreeExtent(virConnectPtr conn ATTRIBUTE_UNUSED,
 
 
 static int
-virStorageBackendDiskMakeVol(virConnectPtr conn,
-                             virStoragePoolObjPtr pool,
+virStorageBackendDiskMakeVol(virStoragePoolObjPtr pool,
                              size_t ntok ATTRIBUTE_UNUSED,
                              char **const groups,
                              void *data)
@@ -237,10 +234,10 @@ virStorageBackendDiskMakeVol(virConnectPtr conn,
             }
         }
 
-        return virStorageBackendDiskMakeDataVol(conn, pool, groups, vol);
+        return virStorageBackendDiskMakeDataVol(pool, groups, vol);
     } else if (STREQ(groups[2], "free")) {
         /* ....or free space extents */
-        return virStorageBackendDiskMakeFreeExtent(conn, pool, groups);
+        return virStorageBackendDiskMakeFreeExtent(pool, groups);
     } else {
         /* This code path should never happen unless someone changed
          * libvirt_parthelper forgot to change this code */
@@ -260,8 +257,7 @@ virStorageBackendDiskMakeVol(virConnectPtr conn,
  * and we can even ensure the output is friendly.
  */
 static int
-virStorageBackendDiskReadPartitions(virConnectPtr conn,
-                                    virStoragePoolObjPtr pool,
+virStorageBackendDiskReadPartitions(virStoragePoolObjPtr pool,
                                     virStorageVolDefPtr vol)
 {
 
@@ -278,8 +274,7 @@ virStorageBackendDiskReadPartitions(virConnectPtr conn,
 
     pool->def->allocation = pool->def->capacity = pool->def->available = 0;
 
-    return virStorageBackendRunProgNul(conn,
-                                       pool,
+    return virStorageBackendRunProgNul(pool,
                                        prog,
                                        6,
                                        virStorageBackendDiskMakeVol,
@@ -287,11 +282,10 @@ virStorageBackendDiskReadPartitions(virConnectPtr conn,
 }
 
 static int
-virStorageBackendDiskMakePoolGeometry(virConnectPtr conn ATTRIBUTE_UNUSED,
-                                     virStoragePoolObjPtr pool,
-                                     size_t ntok ATTRIBUTE_UNUSED,
-                                     char **const groups,
-                                     void *data ATTRIBUTE_UNUSED)
+virStorageBackendDiskMakePoolGeometry(virStoragePoolObjPtr pool,
+                                      size_t ntok ATTRIBUTE_UNUSED,
+                                      char **const groups,
+                                      void *data ATTRIBUTE_UNUSED)
 {
 
        pool->def->source.devices[0].geometry.cyliders = atoi(groups[0]);
@@ -302,14 +296,13 @@ virStorageBackendDiskMakePoolGeometry(virConnectPtr conn ATTRIBUTE_UNUSED,
 }
 
 static int
-virStorageBackendDiskReadGeometry(virConnectPtr conn, virStoragePoolObjPtr pool)
+virStorageBackendDiskReadGeometry(virStoragePoolObjPtr pool)
 {
     const char *prog[] = {
         PARTHELPER, pool->def->source.devices[0].path, "-g", NULL,
     };
 
-    return virStorageBackendRunProgNul(conn,
-                                       pool,
+    return virStorageBackendRunProgNul(pool,
                                        prog,
                                        3,
                                        virStorageBackendDiskMakePoolGeometry,
@@ -317,7 +310,7 @@ virStorageBackendDiskReadGeometry(virConnectPtr conn, virStoragePoolObjPtr pool)
 }
 
 static int
-virStorageBackendDiskRefreshPool(virConnectPtr conn,
+virStorageBackendDiskRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
                                  virStoragePoolObjPtr pool)
 {
     VIR_FREE(pool->def->source.devices[0].freeExtents);
@@ -325,11 +318,11 @@ virStorageBackendDiskRefreshPool(virConnectPtr conn,
 
     virFileWaitForDevices();
 
-    if (virStorageBackendDiskReadGeometry(conn, pool) != 0) {
+    if (virStorageBackendDiskReadGeometry(pool) != 0) {
         return -1;
     }
 
-    return virStorageBackendDiskReadPartitions(conn, pool, NULL);
+    return virStorageBackendDiskReadPartitions(pool, NULL);
 }
 
 
@@ -386,7 +379,7 @@ virStorageBackendDiskPartTypeToCreate(virStoragePoolObjPtr pool)
 }
 
 static int
-virStorageBackendDiskPartFormat(virConnectPtr conn, virStoragePoolObjPtr pool,
+virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool,
                                 virStorageVolDefPtr vol,
                                 char* partFormat)
 {
@@ -394,7 +387,7 @@ virStorageBackendDiskPartFormat(virConnectPtr conn, virStoragePoolObjPtr pool,
     if (pool->def->source.format == VIR_STORAGE_POOL_DISK_DOS) {
         const char *partedFormat = virStoragePartedFsTypeTypeToString(vol->target.format);
         if(partedFormat == NULL) {
-           virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+           virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                  "%s", _("Invalid partition type"));
            return -1;
         }
@@ -402,7 +395,7 @@ virStorageBackendDiskPartFormat(virConnectPtr conn, virStoragePoolObjPtr pool,
             /* make sure we don't have a extended partition already */
             for (i = 0; i < pool->volumes.count; i++) {
                  if (pool->volumes.objs[i]->target.format == VIR_STORAGE_VOL_DISK_EXTENDED) {
-                     virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                     virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                            "%s", _("extended partition already exists"));
                      return -1;
                  }
@@ -426,7 +419,7 @@ virStorageBackendDiskPartFormat(virConnectPtr conn, virStoragePoolObjPtr pool,
                               }
                          }
                          if (i == pool->volumes.count) {
-                             virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                             virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                                    "%s", _("no extended partition found and no primary partition available"));
                              return -1;
                          }
@@ -448,8 +441,7 @@ virStorageBackendDiskPartFormat(virConnectPtr conn, virStoragePoolObjPtr pool,
  * partitions
  */
 static int
-virStorageBackendDiskPartBoundries(virConnectPtr conn,
-                                   virStoragePoolObjPtr pool,
+virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool,
                                    unsigned long long *start,
                                    unsigned long long *end,
                                    unsigned long long allocation)
@@ -511,7 +503,7 @@ virStorageBackendDiskPartBoundries(virConnectPtr conn,
     }
 
     if (smallestExtent == -1) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("no large enough free extent"));
         return -1;
     }
@@ -538,7 +530,7 @@ virStorageBackendDiskPartBoundries(virConnectPtr conn,
 
 
 static int
-virStorageBackendDiskCreateVol(virConnectPtr conn,
+virStorageBackendDiskCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
                                virStoragePoolObjPtr pool,
                                virStorageVolDefPtr vol)
 {
@@ -556,17 +548,17 @@ virStorageBackendDiskCreateVol(virConnectPtr conn,
     };
 
     if (vol->target.encryption != NULL) {
-        virStorageReportError(conn, VIR_ERR_NO_SUPPORT,
+        virStorageReportError(VIR_ERR_NO_SUPPORT,
                               "%s", _("storage pool does not support encrypted "
                                       "volumes"));
         return -1;
     }
 
-    if (virStorageBackendDiskPartFormat(conn, pool, vol, partFormat) != 0) {
+    if (virStorageBackendDiskPartFormat(pool, vol, partFormat) != 0) {
         return -1;
     }
 
-    if (virStorageBackendDiskPartBoundries(conn, pool, &startOffset,
+    if (virStorageBackendDiskPartBoundries(pool, &startOffset,
                                            &endOffset,
                                            vol->capacity) != 0) {
        return -1;
@@ -591,7 +583,7 @@ virStorageBackendDiskCreateVol(virConnectPtr conn,
     VIR_FREE(vol->target.path);
 
     /* Fetch actual extent info, generate key */
-    if (virStorageBackendDiskReadPartitions(conn, pool, vol) < 0)
+    if (virStorageBackendDiskReadPartitions(pool, vol) < 0)
         return -1;
 
     return 0;
@@ -606,7 +598,7 @@ virStorageBackendDiskBuildVolFrom(virConnectPtr conn,
 {
     virStorageBackendBuildVolFrom build_func;
 
-    build_func = virStorageBackendGetBuildVolFromFunction(conn, vol, inputvol);
+    build_func = virStorageBackendGetBuildVolFromFunction(vol, inputvol);
     if (!build_func)
         return -1;
 
@@ -614,7 +606,7 @@ virStorageBackendDiskBuildVolFrom(virConnectPtr conn,
 }
 
 static int
-virStorageBackendDiskDeleteVol(virConnectPtr conn,
+virStorageBackendDiskDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
                                virStoragePoolObjPtr pool,
                                virStorageVolDefPtr vol,
                                unsigned int flags ATTRIBUTE_UNUSED)
@@ -637,7 +629,7 @@ virStorageBackendDiskDeleteVol(virConnectPtr conn,
     DEBUG("devname=%s, srcname=%s", devname, srcname);
 
     if (!STRPREFIX(devname, srcname)) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("Volume path '%s' did not start with parent "
                                 "pool source device name."), devname);
         goto cleanup;
@@ -646,7 +638,7 @@ virStorageBackendDiskDeleteVol(virConnectPtr conn,
     part_num = devname + strlen(srcname);
 
     if (*part_num == 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("cannot parse partition number from target "
                                 "'%s'"), devname);
         goto cleanup;
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index a431ac1..03ba43a 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -135,8 +135,7 @@ struct _virNetfsDiscoverState {
 typedef struct _virNetfsDiscoverState virNetfsDiscoverState;
 
 static int
-virStorageBackendFileSystemNetFindPoolSourcesFunc(virConnectPtr conn,
-                                                  virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
+virStorageBackendFileSystemNetFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
                                                   char **const groups,
                                                   void *data)
 {
@@ -149,18 +148,18 @@ virStorageBackendFileSystemNetFindPoolSourcesFunc(virConnectPtr conn,
 
     name = strrchr(path, '/');
     if (name == NULL) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("invalid netfs path (no /): %s"), path);
         goto cleanup;
     }
     name += 1;
     if (*name == '\0') {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("invalid netfs path (ends in /): %s"), path);
         goto cleanup;
     }
 
-    if (!(src = virStoragePoolSourceListNewSource(conn, &state->list)))
+    if (!(src = virStoragePoolSourceListNewSource(&state->list)))
         goto cleanup;
 
     if (!(src->host.name = strdup(state->host)) ||
@@ -180,7 +179,7 @@ cleanup:
 
 
 static char *
-virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn,
+virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,
                                               const char *srcSpec,
                                               unsigned int flags ATTRIBUTE_UNUSED)
 {
@@ -212,7 +211,7 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn,
     char *retval = NULL;
     unsigned int i;
 
-    source = virStoragePoolDefParseSourceString(conn, srcSpec,
+    source = virStoragePoolDefParseSourceString(srcSpec,
                                                 VIR_STORAGE_POOL_NETFS);
     if (!source)
         goto cleanup;
@@ -220,12 +219,12 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn,
     state.host = source->host.name;
     prog[3] = source->host.name;
 
-    if (virStorageBackendRunProgRegex(conn, NULL, prog, 1, regexes, vars,
+    if (virStorageBackendRunProgRegex(NULL, prog, 1, regexes, vars,
                                       virStorageBackendFileSystemNetFindPoolSourcesFunc,
                                       &state, &exitstatus) < 0)
         goto cleanup;
 
-    retval = virStoragePoolSourceListFormat(conn, &state.list);
+    retval = virStoragePoolSourceListFormat(&state.list);
     if (retval == NULL) {
         virReportOOMError();
         goto cleanup;
@@ -286,8 +285,7 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool) {
  * Returns 0 if successfully mounted, -1 on error
  */
 static int
-virStorageBackendFileSystemMount(virConnectPtr conn,
-                                 virStoragePoolObjPtr pool) {
+virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) {
     char *src;
     char *options;
     const char **mntargv;
@@ -351,18 +349,18 @@ virStorageBackendFileSystemMount(virConnectPtr conn,
 
     if (pool->def->type == VIR_STORAGE_POOL_NETFS) {
         if (pool->def->source.host.name == NULL) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   "%s", _("missing source host"));
             return -1;
         }
         if (pool->def->source.dir == NULL) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   "%s", _("missing source path"));
             return -1;
         }
     } else {
         if (pool->def->source.ndevice != 1) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   "%s", _("missing source device"));
             return -1;
         }
@@ -420,25 +418,24 @@ virStorageBackendFileSystemMount(virConnectPtr conn,
  * Returns 0 if successfully unmounted, -1 on error
  */
 static int
-virStorageBackendFileSystemUnmount(virConnectPtr conn,
-                                   virStoragePoolObjPtr pool) {
+virStorageBackendFileSystemUnmount(virStoragePoolObjPtr pool) {
     const char *mntargv[3];
     int ret;
 
     if (pool->def->type == VIR_STORAGE_POOL_NETFS) {
         if (pool->def->source.host.name == NULL) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   "%s", _("missing source host"));
             return -1;
         }
         if (pool->def->source.dir == NULL) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   "%s", _("missing source dir"));
             return -1;
         }
     } else {
         if (pool->def->source.ndevice != 1) {
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   "%s", _("missing source device"));
             return -1;
         }
@@ -476,11 +473,11 @@ virStorageBackendFileSystemUnmount(virConnectPtr conn,
  */
 #if WITH_STORAGE_FS
 static int
-virStorageBackendFileSystemStart(virConnectPtr conn,
+virStorageBackendFileSystemStart(virConnectPtr conn ATTRIBUTE_UNUSED,
                                  virStoragePoolObjPtr pool)
 {
     if (pool->def->type != VIR_STORAGE_POOL_DIR &&
-        virStorageBackendFileSystemMount(conn, pool) < 0)
+        virStorageBackendFileSystemMount(pool) < 0)
         return -1;
 
     return 0;
@@ -499,7 +496,7 @@ virStorageBackendFileSystemStart(virConnectPtr conn,
  * Returns 0 on success, -1 on error
  */
 static int
-virStorageBackendFileSystemBuild(virConnectPtr conn,
+virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
                                  virStoragePoolObjPtr pool,
                                  unsigned int flags ATTRIBUTE_UNUSED)
 {
@@ -512,7 +509,7 @@ virStorageBackendFileSystemBuild(virConnectPtr conn,
         goto error;
     }
     if (!(p = strrchr(parent, '/'))) {
-        virStorageReportError(conn, VIR_ERR_INVALID_ARG,
+        virStorageReportError(VIR_ERR_INVALID_ARG,
                               _("path '%s' is not absolute"),
                               pool->def->target.path);
         goto error;
@@ -694,11 +691,11 @@ no_memory:
  */
 #if WITH_STORAGE_FS
 static int
-virStorageBackendFileSystemStop(virConnectPtr conn,
+virStorageBackendFileSystemStop(virConnectPtr conn ATTRIBUTE_UNUSED,
                                 virStoragePoolObjPtr pool)
 {
     if (pool->def->type != VIR_STORAGE_POOL_DIR &&
-        virStorageBackendFileSystemUnmount(conn, pool) < 0)
+        virStorageBackendFileSystemUnmount(pool) < 0)
         return -1;
 
     return 0;
@@ -766,7 +763,7 @@ virStorageBackendFileSystemVolCreate(virConnectPtr conn ATTRIBUTE_UNUSED,
     return 0;
 }
 
-static int createFileDir(virConnectPtr conn,
+static int createFileDir(virConnectPtr conn ATTRIBUTE_UNUSED,
                          virStoragePoolObjPtr pool,
                          virStorageVolDefPtr vol,
                          virStorageVolDefPtr inputvol,
@@ -774,7 +771,7 @@ static int createFileDir(virConnectPtr conn,
     int err;
 
     if (inputvol) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s",
                               _("cannot copy from volume to a directory volume"));
         return -1;
@@ -803,13 +800,13 @@ _virStorageBackendFileSystemVolBuild(virConnectPtr conn,
 
     if (inputvol) {
         if (vol->target.encryption != NULL) {
-            virStorageReportError(conn, VIR_ERR_NO_SUPPORT,
+            virStorageReportError(VIR_ERR_NO_SUPPORT,
                                   "%s", _("storage pool does not support "
                                           "building encrypted volumes from "
                                           "other volumes"));
             return -1;
         }
-        create_func = virStorageBackendGetBuildVolFromFunction(conn, vol,
+        create_func = virStorageBackendGetBuildVolFromFunction(vol,
                                                                inputvol);
         if (!create_func)
             return -1;
@@ -818,12 +815,12 @@ _virStorageBackendFileSystemVolBuild(virConnectPtr conn,
     } else if (vol->target.format == VIR_STORAGE_FILE_DIR) {
         create_func = createFileDir;
     } else if ((tool_type = virStorageBackendFindFSImageTool(NULL)) != -1) {
-        create_func = virStorageBackendFSImageToolTypeToFunc(conn, tool_type);
+        create_func = virStorageBackendFSImageToolTypeToFunc(tool_type);
 
         if (!create_func)
             return -1;
     } else {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("creation of non-raw images "
                                       "is not supported without qemu-img"));
         return -1;
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index 4e2a75e..f34123f 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -45,8 +45,7 @@
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
 static int
-virStorageBackendISCSITargetIP(virConnectPtr conn,
-                               const char *hostname,
+virStorageBackendISCSITargetIP(const char *hostname,
                                char *ipaddr,
                                size_t ipaddrlen)
 {
@@ -62,14 +61,14 @@ virStorageBackendISCSITargetIP(virConnectPtr conn,
 
     ret = getaddrinfo(hostname, NULL, &hints, &result);
     if (ret != 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("host lookup failed %s"),
                               gai_strerror(ret));
         return -1;
     }
 
     if (result == NULL) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("no IP address for target %s"),
                               hostname);
         return -1;
@@ -78,7 +77,7 @@ virStorageBackendISCSITargetIP(virConnectPtr conn,
     if (getnameinfo(result->ai_addr, result->ai_addrlen,
                     ipaddr, ipaddrlen, NULL, 0,
                     NI_NUMERICHOST) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("cannot format ip addr for %s"),
                               hostname);
         freeaddrinfo(result);
@@ -90,8 +89,7 @@ virStorageBackendISCSITargetIP(virConnectPtr conn,
 }
 
 static int
-virStorageBackendISCSIExtractSession(virConnectPtr conn ATTRIBUTE_UNUSED,
-                                     virStoragePoolObjPtr pool,
+virStorageBackendISCSIExtractSession(virStoragePoolObjPtr pool,
                                      char **const groups,
                                      void *data)
 {
@@ -108,8 +106,7 @@ virStorageBackendISCSIExtractSession(virConnectPtr conn ATTRIBUTE_UNUSED,
 }
 
 static char *
-virStorageBackendISCSISession(virConnectPtr conn,
-                              virStoragePoolObjPtr pool,
+virStorageBackendISCSISession(virStoragePoolObjPtr pool,
                               int probe)
 {
     /*
@@ -134,7 +131,7 @@ virStorageBackendISCSISession(virConnectPtr conn,
      * returned an exit status of > 0, even if they succeeded.  We will just
      * rely on whether session got filled in properly.
      */
-    if (virStorageBackendRunProgRegex(conn, pool,
+    if (virStorageBackendRunProgRegex(pool,
                                       prog,
                                       1,
                                       regexes,
@@ -146,7 +143,7 @@ virStorageBackendISCSISession(virConnectPtr conn,
 
     if (session == NULL &&
         !probe) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("cannot find session"));
         return NULL;
     }
@@ -158,8 +155,7 @@ virStorageBackendISCSISession(virConnectPtr conn,
 #define LINE_SIZE 4096
 
 static int
-virStorageBackendIQNFound(virConnectPtr conn,
-                          virStoragePoolObjPtr pool,
+virStorageBackendIQNFound(virStoragePoolObjPtr pool,
                           char **ifacename)
 {
     int ret = IQN_MISSING, fd = -1;
@@ -174,7 +170,7 @@ virStorageBackendIQNFound(virConnectPtr conn,
 
     if (VIR_ALLOC_N(line, LINE_SIZE) != 0) {
         ret = IQN_ERROR;
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("Could not allocate memory for output of '%s'"),
                               prog[0]);
         goto out;
@@ -183,7 +179,7 @@ virStorageBackendIQNFound(virConnectPtr conn,
     memset(line, 0, LINE_SIZE);
 
     if (virExec(prog, NULL, NULL, &child, -1, &fd, NULL, VIR_EXEC_NONE) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("Failed to run '%s' when looking for existing interface with IQN '%s'"),
                               prog[0], pool->def->source.initiator.iqn);
 
@@ -192,7 +188,7 @@ virStorageBackendIQNFound(virConnectPtr conn,
     }
 
     if ((fp = fdopen(fd, "r")) == NULL) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("Failed to open stream for file descriptor "
                                 "when reading output from '%s': '%s'"),
                               prog[0], virStrerror(errno, ebuf, sizeof ebuf));
@@ -204,7 +200,7 @@ virStorageBackendIQNFound(virConnectPtr conn,
         newline = strrchr(line, '\n');
         if (newline == NULL) {
             ret = IQN_ERROR;
-            virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                                   _("Unexpected line > %d characters "
                                     "when parsing output of '%s'"),
                                   LINE_SIZE, prog[0]);
@@ -251,15 +247,14 @@ out:
 
 
 static int
-virStorageBackendCreateIfaceIQN(virConnectPtr conn,
-                             virStoragePoolObjPtr pool,
-                             char **ifacename)
+virStorageBackendCreateIfaceIQN(virStoragePoolObjPtr pool,
+                                char **ifacename)
 {
     int ret = -1, exitstatus = -1;
     char temp_ifacename[32];
 
     if (virRandomInitialize(time(NULL) ^ getpid()) == -1) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                               _("Failed to initialize random generator "
                                 "when creating iscsi interface"));
         goto out;
@@ -280,7 +275,7 @@ virStorageBackendCreateIfaceIQN(virConnectPtr conn,
      * We will just rely on whether the interface got created
      * properly. */
     if (virRun(cmdargv1, &exitstatus) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("Failed to run command '%s' to create new iscsi interface"),
                               cmdargv1[0]);
         goto out;
@@ -296,14 +291,14 @@ virStorageBackendCreateIfaceIQN(virConnectPtr conn,
      * returned an exit status of > 0, even if they succeeded.  We will just
      * rely on whether iface file got updated properly. */
     if (virRun(cmdargv2, &exitstatus) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("Failed to run command '%s' to update iscsi interface with IQN '%s'"),
                               cmdargv1[0], pool->def->source.initiator.iqn);
         goto out;
     }
 
     /* Check again to make sure the interface was created. */
-    if (virStorageBackendIQNFound(conn, pool, ifacename) != IQN_FOUND) {
+    if (virStorageBackendIQNFound(pool, ifacename) != IQN_FOUND) {
         VIR_DEBUG("Failed to find interface '%s' with IQN '%s' "
                   "after attempting to create it",
                   &temp_ifacename[0], pool->def->source.initiator.iqn);
@@ -323,20 +318,19 @@ out:
 
 
 static int
-virStorageBackendISCSIConnectionIQN(virConnectPtr conn,
-                                    virStoragePoolObjPtr pool,
+virStorageBackendISCSIConnectionIQN(virStoragePoolObjPtr pool,
                                     const char *portal,
                                     const char *action)
 {
     int ret = -1;
     char *ifacename = NULL;
 
-    switch (virStorageBackendIQNFound(conn, pool, &ifacename)) {
+    switch (virStorageBackendIQNFound(pool, &ifacename)) {
     case IQN_FOUND:
         VIR_DEBUG("ifacename: '%s'", ifacename);
         break;
     case IQN_MISSING:
-        if (virStorageBackendCreateIfaceIQN(conn, pool, &ifacename) != 0) {
+        if (virStorageBackendCreateIfaceIQN(pool, &ifacename) != 0) {
             goto out;
         }
         break;
@@ -349,7 +343,7 @@ virStorageBackendISCSIConnectionIQN(virConnectPtr conn,
         ISCSIADM, "--mode", "discovery", "--type", "sendtargets", "--portal", portal, NULL
     };
     if (virRun(sendtargets, NULL) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("Failed to run %s to get target list"),
                               sendtargets[0]);
         goto out;
@@ -362,7 +356,7 @@ virStorageBackendISCSIConnectionIQN(virConnectPtr conn,
     };
 
     if (virRun(cmdargv, NULL) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("Failed to run command '%s' with action '%s'"),
                               cmdargv[0], action);
         goto out;
@@ -377,8 +371,7 @@ out:
 
 
 static int
-virStorageBackendISCSIConnection(virConnectPtr conn,
-                                 virStoragePoolObjPtr pool,
+virStorageBackendISCSIConnection(virStoragePoolObjPtr pool,
                                  const char *portal,
                                  const char *action)
 {
@@ -386,7 +379,7 @@ virStorageBackendISCSIConnection(virConnectPtr conn,
 
     if (pool->def->source.initiator.iqn != NULL) {
 
-        ret = virStorageBackendISCSIConnectionIQN(conn, pool, portal, action);
+        ret = virStorageBackendISCSIConnectionIQN(pool, portal, action);
 
     } else {
 
@@ -406,8 +399,7 @@ virStorageBackendISCSIConnection(virConnectPtr conn,
 
 
 static int
-virStorageBackendISCSIFindLUs(virConnectPtr conn,
-                              virStoragePoolObjPtr pool,
+virStorageBackendISCSIFindLUs(virStoragePoolObjPtr pool,
                               const char *session)
 {
     char sysfs_path[PATH_MAX];
@@ -425,7 +417,7 @@ virStorageBackendISCSIFindLUs(virConnectPtr conn,
         retval = -1;
     }
 
-    if (virStorageBackendSCSIFindLUs(conn, pool, host) < 0) {
+    if (virStorageBackendSCSIFindLUs(pool, host) < 0) {
         virReportSystemError(errno,
                              _("Failed to find LUs on host %u"), host);
         retval = -1;
@@ -435,8 +427,7 @@ virStorageBackendISCSIFindLUs(virConnectPtr conn,
 }
 
 static int
-virStorageBackendISCSIRescanLUNs(virConnectPtr conn ATTRIBUTE_UNUSED,
-                                 virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
+virStorageBackendISCSIRescanLUNs(virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
                                  const char *session)
 {
     const char *const cmdargv[] = {
@@ -451,8 +442,7 @@ virStorageBackendISCSIRescanLUNs(virConnectPtr conn ATTRIBUTE_UNUSED,
 
 
 static int
-virStorageBackendISCSILogin(virConnectPtr conn,
-                            virStoragePoolObjPtr pool,
+virStorageBackendISCSILogin(virStoragePoolObjPtr pool,
                             const char *portal)
 {
     const char *const cmdsendtarget[] = {
@@ -463,26 +453,23 @@ virStorageBackendISCSILogin(virConnectPtr conn,
     if (virRun(cmdsendtarget, NULL) < 0)
         return -1;
 
-    return virStorageBackendISCSIConnection(conn, pool, portal, "--login");
+    return virStorageBackendISCSIConnection(pool, portal, "--login");
 }
 
 static int
-virStorageBackendISCSILogout(virConnectPtr conn,
-                             virStoragePoolObjPtr pool,
+virStorageBackendISCSILogout(virStoragePoolObjPtr pool,
                              const char *portal)
 {
-    return virStorageBackendISCSIConnection(conn, pool, portal, "--logout");
+    return virStorageBackendISCSIConnection(pool, portal, "--logout");
 }
 
 static char *
-virStorageBackendISCSIPortal(virConnectPtr conn,
-                             virStoragePoolObjPtr pool)
+virStorageBackendISCSIPortal(virStoragePoolObjPtr pool)
 {
     char ipaddr[NI_MAXHOST];
     char *portal;
 
-    if (virStorageBackendISCSITargetIP(conn,
-                                       pool->def->source.host.name,
+    if (virStorageBackendISCSITargetIP(pool->def->source.host.name,
                                        ipaddr, sizeof(ipaddr)) < 0)
         return NULL;
 
@@ -499,29 +486,29 @@ virStorageBackendISCSIPortal(virConnectPtr conn,
 
 
 static int
-virStorageBackendISCSIStartPool(virConnectPtr conn,
+virStorageBackendISCSIStartPool(virConnectPtr conn ATTRIBUTE_UNUSED,
                                 virStoragePoolObjPtr pool)
 {
     char *portal = NULL;
     char *session;
 
     if (pool->def->source.host.name == NULL) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("missing source host"));
         return -1;
     }
 
     if (pool->def->source.ndevice != 1 ||
         pool->def->source.devices[0].path == NULL) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("missing source device"));
         return -1;
     }
 
-    if ((session = virStorageBackendISCSISession(conn, pool, 1)) == NULL) {
-        if ((portal = virStorageBackendISCSIPortal(conn, pool)) == NULL)
+    if ((session = virStorageBackendISCSISession(pool, 1)) == NULL) {
+        if ((portal = virStorageBackendISCSIPortal(pool)) == NULL)
             return -1;
-        if (virStorageBackendISCSILogin(conn, pool, portal) < 0) {
+        if (virStorageBackendISCSILogin(pool, portal) < 0) {
             VIR_FREE(portal);
             return -1;
         }
@@ -533,18 +520,18 @@ virStorageBackendISCSIStartPool(virConnectPtr conn,
 }
 
 static int
-virStorageBackendISCSIRefreshPool(virConnectPtr conn,
+virStorageBackendISCSIRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
                                   virStoragePoolObjPtr pool)
 {
     char *session = NULL;
 
     pool->def->allocation = pool->def->capacity = pool->def->available = 0;
 
-    if ((session = virStorageBackendISCSISession(conn, pool, 0)) == NULL)
+    if ((session = virStorageBackendISCSISession(pool, 0)) == NULL)
         goto cleanup;
-    if (virStorageBackendISCSIRescanLUNs(conn, pool, session) < 0)
+    if (virStorageBackendISCSIRescanLUNs(pool, session) < 0)
         goto cleanup;
-    if (virStorageBackendISCSIFindLUs(conn, pool, session) < 0)
+    if (virStorageBackendISCSIFindLUs(pool, session) < 0)
         goto cleanup;
     VIR_FREE(session);
 
@@ -557,15 +544,15 @@ virStorageBackendISCSIRefreshPool(virConnectPtr conn,
 
 
 static int
-virStorageBackendISCSIStopPool(virConnectPtr conn,
+virStorageBackendISCSIStopPool(virConnectPtr conn ATTRIBUTE_UNUSED,
                                virStoragePoolObjPtr pool)
 {
     char *portal;
 
-    if ((portal = virStorageBackendISCSIPortal(conn, pool)) == NULL)
+    if ((portal = virStorageBackendISCSIPortal(pool)) == NULL)
         return -1;
 
-    if (virStorageBackendISCSILogout(conn, pool, portal) < 0) {
+    if (virStorageBackendISCSILogout(pool, portal) < 0) {
         VIR_FREE(portal);
         return -1;
     }
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 35bedc0..06238d1 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -62,8 +62,7 @@ virStorageBackendLogicalSetActive(virStoragePoolObjPtr pool,
 
 
 static int
-virStorageBackendLogicalMakeVol(virConnectPtr conn,
-                                virStoragePoolObjPtr pool,
+virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool,
                                 char **const groups,
                                 void *data)
 {
@@ -149,17 +148,17 @@ virStorageBackendLogicalMakeVol(virConnectPtr conn,
     }
 
     if (virStrToLong_ull(groups[4], NULL, 10, &offset) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("malformed volume extent offset value"));
         return -1;
     }
     if (virStrToLong_ull(groups[5], NULL, 10, &length) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("malformed volume extent length value"));
         return -1;
     }
     if (virStrToLong_ull(groups[6], NULL, 10, &size) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("malformed volume extent size value"));
         return -1;
     }
@@ -172,8 +171,7 @@ virStorageBackendLogicalMakeVol(virConnectPtr conn,
 }
 
 static int
-virStorageBackendLogicalFindLVs(virConnectPtr conn,
-                                virStoragePoolObjPtr pool,
+virStorageBackendLogicalFindLVs(virStoragePoolObjPtr pool,
                                 virStorageVolDefPtr vol)
 {
     /*
@@ -208,8 +206,7 @@ virStorageBackendLogicalFindLVs(virConnectPtr conn,
 
     int exitstatus;
 
-    if (virStorageBackendRunProgRegex(conn,
-                                      pool,
+    if (virStorageBackendRunProgRegex(pool,
                                       prog,
                                       1,
                                       regexes,
@@ -217,13 +214,13 @@ virStorageBackendLogicalFindLVs(virConnectPtr conn,
                                       virStorageBackendLogicalMakeVol,
                                       vol,
                                       &exitstatus) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("lvs command failed"));
                               return -1;
     }
 
     if (exitstatus != 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("lvs command failed with exitstatus %d"),
                               exitstatus);
         return -1;
@@ -233,8 +230,7 @@ virStorageBackendLogicalFindLVs(virConnectPtr conn,
 }
 
 static int
-virStorageBackendLogicalRefreshPoolFunc(virConnectPtr conn ATTRIBUTE_UNUSED,
-                                        virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
+virStorageBackendLogicalRefreshPoolFunc(virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
                                         char **const groups,
                                         void *data ATTRIBUTE_UNUSED)
 {
@@ -249,8 +245,7 @@ virStorageBackendLogicalRefreshPoolFunc(virConnectPtr conn ATTRIBUTE_UNUSED,
 
 
 static int
-virStorageBackendLogicalFindPoolSourcesFunc(virConnectPtr conn,
-                                            virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
+virStorageBackendLogicalFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
                                             char **const groups,
                                             void *data)
 {
@@ -278,8 +273,7 @@ virStorageBackendLogicalFindPoolSourcesFunc(virConnectPtr conn,
     }
 
     if (thisSource == NULL) {
-        if (!(thisSource = virStoragePoolSourceListNewSource(conn,
-                                                             sourceList)))
+        if (!(thisSource = virStoragePoolSourceListNewSource(sourceList)))
             goto err_no_memory;
 
         thisSource->name = vgname;
@@ -309,7 +303,7 @@ virStorageBackendLogicalFindPoolSourcesFunc(virConnectPtr conn,
 }
 
 static char *
-virStorageBackendLogicalFindPoolSources(virConnectPtr conn,
+virStorageBackendLogicalFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,
                                         const char *srcSpec ATTRIBUTE_UNUSED,
                                         unsigned int flags ATTRIBUTE_UNUSED)
 {
@@ -343,14 +337,14 @@ virStorageBackendLogicalFindPoolSources(virConnectPtr conn,
     memset(&sourceList, 0, sizeof(sourceList));
     sourceList.type = VIR_STORAGE_POOL_LOGICAL;
 
-    if (virStorageBackendRunProgRegex(conn, NULL, prog, 1, regexes, vars,
+    if (virStorageBackendRunProgRegex(NULL, prog, 1, regexes, vars,
                                       virStorageBackendLogicalFindPoolSourcesFunc,
                                       &sourceList, &exitstatus) < 0)
         return NULL;
 
-    retval = virStoragePoolSourceListFormat(conn, &sourceList);
+    retval = virStoragePoolSourceListFormat(&sourceList);
     if (retval == NULL) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                               _("failed to get source from sourceList"));
         goto cleanup;
     }
@@ -451,7 +445,7 @@ virStorageBackendLogicalBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
 
 
 static int
-virStorageBackendLogicalRefreshPool(virConnectPtr conn,
+virStorageBackendLogicalRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
                                     virStoragePoolObjPtr pool)
 {
     /*
@@ -478,14 +472,13 @@ virStorageBackendLogicalRefreshPool(virConnectPtr conn,
     virFileWaitForDevices();
 
     /* Get list of all logical volumes */
-    if (virStorageBackendLogicalFindLVs(conn, pool, NULL) < 0) {
+    if (virStorageBackendLogicalFindLVs(pool, NULL) < 0) {
         virStoragePoolObjClearVols(pool);
         return -1;
     }
 
     /* Now get basic volgrp metadata */
-    if (virStorageBackendRunProgRegex(conn,
-                                      pool,
+    if (virStorageBackendRunProgRegex(pool,
                                       prog,
                                       1,
                                       regexes,
@@ -579,7 +572,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
     const char **cmdargv = cmdargvnew;
 
     if (vol->target.encryption != NULL) {
-        virStorageReportError(conn, VIR_ERR_NO_SUPPORT,
+        virStorageReportError(VIR_ERR_NO_SUPPORT,
                               "%s", _("storage pool does not support encrypted "
                                       "volumes"));
         return -1;
@@ -641,7 +634,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
     fd = -1;
 
     /* Fill in data about this new vol */
-    if (virStorageBackendLogicalFindLVs(conn, pool, vol) < 0) {
+    if (virStorageBackendLogicalFindLVs(pool, vol) < 0) {
         virReportSystemError(errno,
                              _("cannot find newly created volume '%s'"),
                              vol->target.path);
@@ -666,7 +659,7 @@ virStorageBackendLogicalBuildVolFrom(virConnectPtr conn,
 {
     virStorageBackendBuildVolFrom build_func;
 
-    build_func = virStorageBackendGetBuildVolFromFunction(conn, vol, inputvol);
+    build_func = virStorageBackendGetBuildVolFromFunction(vol, inputvol);
     if (!build_func)
         return -1;
 
diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c
index 8b8fba5..dbcd6d8 100644
--- a/src/storage/storage_backend_mpath.c
+++ b/src/storage/storage_backend_mpath.c
@@ -39,8 +39,7 @@
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
 static int
-virStorageBackendMpathUpdateVolTargetInfo(virConnectPtr conn,
-                                          virStorageVolTargetPtr target,
+virStorageBackendMpathUpdateVolTargetInfo(virStorageVolTargetPtr target,
                                           unsigned long long *allocation,
                                           unsigned long long *capacity)
 {
@@ -60,7 +59,7 @@ virStorageBackendMpathUpdateVolTargetInfo(virConnectPtr conn,
                                                allocation,
                                                capacity) < 0) {
 
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                           _("Failed to update volume target info for '%s'"),
                           target->path);
 
@@ -69,7 +68,7 @@ virStorageBackendMpathUpdateVolTargetInfo(virConnectPtr conn,
     }
 
     if (virStorageBackendUpdateVolTargetFormatFD(target, fd) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                           _("Failed to update volume target format for '%s'"),
                           target->path);
 
@@ -86,8 +85,7 @@ out:
 
 
 static int
-virStorageBackendMpathNewVol(virConnectPtr conn,
-                             virStoragePoolObjPtr pool,
+virStorageBackendMpathNewVol(virStoragePoolObjPtr pool,
                              const int devnum,
                              const char *dev)
 {
@@ -111,12 +109,11 @@ virStorageBackendMpathNewVol(virConnectPtr conn,
         goto cleanup;
     }
 
-    if (virStorageBackendMpathUpdateVolTargetInfo(conn,
-                                                  &vol->target,
+    if (virStorageBackendMpathUpdateVolTargetInfo(&vol->target,
                                                   &vol->allocation,
                                                   &vol->capacity) < 0) {
 
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("Failed to update volume for '%s'"),
                               vol->target.path);
         goto cleanup;
@@ -231,8 +228,7 @@ out:
 
 
 static int
-virStorageBackendCreateVols(virConnectPtr conn,
-                            virStoragePoolObjPtr pool,
+virStorageBackendCreateVols(virStoragePoolObjPtr pool,
                             struct dm_names *names)
 {
     int retval = 0, is_mpath = 0;
@@ -260,8 +256,7 @@ virStorageBackendCreateVols(virConnectPtr conn,
                 goto out;
             }
 
-            virStorageBackendMpathNewVol(conn,
-                                         pool,
+            virStorageBackendMpathNewVol(pool,
                                          minor,
                                          map_device);
 
@@ -280,8 +275,7 @@ out:
 
 
 static int
-virStorageBackendGetMaps(virConnectPtr conn,
-                         virStoragePoolObjPtr pool)
+virStorageBackendGetMaps(virStoragePoolObjPtr pool)
 {
     int retval = 0;
     struct dm_task *dmt = NULL;
@@ -309,7 +303,7 @@ virStorageBackendGetMaps(virConnectPtr conn,
         goto out;
     }
 
-    virStorageBackendCreateVols(conn, pool, names);
+    virStorageBackendCreateVols(pool, names);
 
 out:
     if (dmt != NULL) {
@@ -320,7 +314,7 @@ out:
 
 
 static int
-virStorageBackendMpathRefreshPool(virConnectPtr conn,
+virStorageBackendMpathRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
                                   virStoragePoolObjPtr pool)
 {
     int retval = 0;
@@ -331,7 +325,7 @@ virStorageBackendMpathRefreshPool(virConnectPtr conn,
 
     virFileWaitForDevices();
 
-    virStorageBackendGetMaps(conn, pool);
+    virStorageBackendGetMaps(pool);
 
     return retval;
 }
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index 9c13dee..0260818 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -40,8 +40,7 @@
  * the device otherwise.
  */
 static int
-getDeviceType(virConnectPtr conn,
-              uint32_t host,
+getDeviceType(uint32_t host,
               uint32_t bus,
               uint32_t target,
               uint32_t lun,
@@ -85,7 +84,7 @@ getDeviceType(virConnectPtr conn,
      * character is not \0, virStrToLong_i complains
      */
     if (virStrToLong_i(typestr, &p, 10, type) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("Device type '%s' is not an integer"),
                               typestr);
         /* Hm, type wasn't an integer; seems strange */
@@ -191,8 +190,7 @@ virStorageBackendSCSIUpdateVolTargetInfo(virStorageVolTargetPtr target,
 }
 
 static int
-virStorageBackendSCSINewLun(virConnectPtr conn,
-                            virStoragePoolObjPtr pool,
+virStorageBackendSCSINewLun(virStoragePoolObjPtr pool,
                             uint32_t host,
                             uint32_t bus,
                             uint32_t target,
@@ -252,7 +250,7 @@ virStorageBackendSCSINewLun(virConnectPtr conn,
                                                  &vol->allocation,
                                                  &vol->capacity) < 0) {
 
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("Failed to update volume for '%s'"),
                               devpath);
         retval = -1;
@@ -289,8 +287,7 @@ out:
 
 
 static int
-getNewStyleBlockDevice(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
-                       const char *lun_path,
+getNewStyleBlockDevice(const char *lun_path,
                        const char *block_name ATTRIBUTE_UNUSED,
                        char **block_device)
 {
@@ -344,8 +341,7 @@ out:
 
 
 static int
-getOldStyleBlockDevice(virConnectPtr conn,
-                       const char *lun_path ATTRIBUTE_UNUSED,
+getOldStyleBlockDevice(const char *lun_path ATTRIBUTE_UNUSED,
                        const char *block_name,
                        char **block_device)
 {
@@ -356,7 +352,7 @@ getOldStyleBlockDevice(virConnectPtr conn,
     blockp = strrchr(block_name, ':');
     if (blockp == NULL) {
         /* Hm, wasn't what we were expecting; have to give up */
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("Failed to parse block name %s"),
                               block_name);
         retval = -1;
@@ -379,8 +375,7 @@ out:
 
 
 static int
-getBlockDevice(virConnectPtr conn,
-               uint32_t host,
+getBlockDevice(uint32_t host,
                uint32_t bus,
                uint32_t target,
                uint32_t lun,
@@ -409,13 +404,11 @@ getBlockDevice(virConnectPtr conn,
     while ((lun_dirent = readdir(lun_dir))) {
         if (STREQLEN(lun_dirent->d_name, "block", 5)) {
             if (strlen(lun_dirent->d_name) == 5) {
-                retval = getNewStyleBlockDevice(conn,
-                                                lun_path,
+                retval = getNewStyleBlockDevice(lun_path,
                                                 lun_dirent->d_name,
                                                 block_device);
             } else {
-                retval = getOldStyleBlockDevice(conn,
-                                                lun_path,
+                retval = getOldStyleBlockDevice(lun_path,
                                                 lun_dirent->d_name,
                                                 block_device);
             }
@@ -432,8 +425,7 @@ out:
 
 
 static int
-processLU(virConnectPtr conn,
-          virStoragePoolObjPtr pool,
+processLU(virStoragePoolObjPtr pool,
           uint32_t host,
           uint32_t bus,
           uint32_t target,
@@ -447,8 +439,8 @@ processLU(virConnectPtr conn,
     VIR_DEBUG(_("Processing LU %u:%u:%u:%u"),
               host, bus, target, lun);
 
-    if (getDeviceType(conn, host, bus, target, lun, &device_type) < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+    if (getDeviceType(host, bus, target, lun, &device_type) < 0) {
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("Failed to determine if %u:%u:%u:%u is a Direct-Access LUN"),
                               host, bus, target, lun);
         retval = -1;
@@ -468,11 +460,11 @@ processLU(virConnectPtr conn,
     VIR_DEBUG(_("%u:%u:%u:%u is a Direct-Access LUN"),
               host, bus, target, lun);
 
-    if (getBlockDevice(conn, host, bus, target, lun, &block_device) < 0) {
+    if (getBlockDevice(host, bus, target, lun, &block_device) < 0) {
         goto out;
     }
 
-    if (virStorageBackendSCSINewLun(conn, pool,
+    if (virStorageBackendSCSINewLun(pool,
                                     host, bus, target, lun,
                                     block_device) < 0) {
         VIR_DEBUG(_("Failed to create new storage volume for %u:%u:%u:%u"),
@@ -492,8 +484,7 @@ out:
 
 
 int
-virStorageBackendSCSIFindLUs(virConnectPtr conn,
-                             virStoragePoolObjPtr pool,
+virStorageBackendSCSIFindLUs(virStoragePoolObjPtr pool,
                              uint32_t scanhost)
 {
     int retval = 0;
@@ -531,7 +522,7 @@ virStorageBackendSCSIFindLUs(virConnectPtr conn,
 
         VIR_DEBUG(_("Found LU '%s'"), lun_dirent->d_name);
 
-        processLU(conn, pool, scanhost, bus, target, lun);
+        processLU(pool, scanhost, bus, target, lun);
     }
 
     closedir(devicedir);
@@ -627,7 +618,7 @@ out:
 
 
 static int
-virStorageBackendSCSIRefreshPool(virConnectPtr conn,
+virStorageBackendSCSIRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
                                  virStoragePoolObjPtr pool)
 {
     int retval = 0;
@@ -649,7 +640,7 @@ virStorageBackendSCSIRefreshPool(virConnectPtr conn,
         goto out;
     }
 
-    virStorageBackendSCSIFindLUs(conn, pool, host);
+    virStorageBackendSCSIFindLUs(pool, host);
 
 out:
     return retval;
diff --git a/src/storage/storage_backend_scsi.h b/src/storage/storage_backend_scsi.h
index 8467993..a886660 100644
--- a/src/storage/storage_backend_scsi.h
+++ b/src/storage/storage_backend_scsi.h
@@ -36,8 +36,7 @@ int
 virStorageBackendSCSIGetHostNumber(const char *sysfs_path,
                                    uint32_t *host);
 int
-virStorageBackendSCSIFindLUs(virConnectPtr conn,
-                             virStoragePoolObjPtr pool,
+virStorageBackendSCSIFindLUs(virStoragePoolObjPtr pool,
                              uint32_t scanhost);
 
 #endif /* __VIR_STORAGE_BACKEND_SCSI_H__ */
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index fd5e51d..6b1045a 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -161,8 +161,7 @@ storageDriverStartup(int privileged) {
     }
     */
 
-    if (virStoragePoolLoadAllConfigs(NULL,
-                                     &driverState->pools,
+    if (virStoragePoolLoadAllConfigs(&driverState->pools,
                                      driverState->configDir,
                                      driverState->autostartDir) < 0)
         goto error;
@@ -192,8 +191,7 @@ storageDriverReload(void) {
         return -1;
 
     storageDriverLock(driverState);
-    virStoragePoolLoadAllConfigs(NULL,
-                                 &driverState->pools,
+    virStoragePoolLoadAllConfigs(&driverState->pools,
                                  driverState->configDir,
                                  driverState->autostartDir);
     storageDriverAutostart(driverState);
@@ -268,7 +266,7 @@ storagePoolLookupByUUID(virConnectPtr conn,
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virStorageReportError(conn, VIR_ERR_NO_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
                               "%s", _("no pool with matching uuid"));
         goto cleanup;
     }
@@ -293,7 +291,7 @@ storagePoolLookupByName(virConnectPtr conn,
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virStorageReportError(conn, VIR_ERR_NO_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
                               _("no pool with matching name '%s'"), name);
         goto cleanup;
     }
@@ -439,7 +437,7 @@ storageFindPoolSources(virConnectPtr conn,
 
     backend_type = virStoragePoolTypeFromString(type);
     if (backend_type < 0) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("unknown storage pool type %s"), type);
         goto cleanup;
     }
@@ -449,7 +447,7 @@ storageFindPoolSources(virConnectPtr conn,
         goto cleanup;
 
     if (!backend->findPoolSources) {
-        virStorageReportError(conn, VIR_ERR_NO_SUPPORT,
+        virStorageReportError(VIR_ERR_NO_SUPPORT,
                               _("pool type '%s' does not support source "
                                 "discovery"), type);
         goto cleanup;
@@ -472,7 +470,7 @@ static int storagePoolIsActive(virStoragePoolPtr pool)
     obj = virStoragePoolObjFindByUUID(&driver->pools, pool->uuid);
     storageDriverUnlock(driver);
     if (!obj) {
-        virStorageReportError(pool->conn, VIR_ERR_NO_STORAGE_POOL, NULL);
+        virStorageReportError(VIR_ERR_NO_STORAGE_POOL, NULL);
         goto cleanup;
     }
     ret = virStoragePoolObjIsActive(obj);
@@ -493,7 +491,7 @@ static int storagePoolIsPersistent(virStoragePoolPtr pool)
     obj = virStoragePoolObjFindByUUID(&driver->pools, pool->uuid);
     storageDriverUnlock(driver);
     if (!obj) {
-        virStorageReportError(pool->conn, VIR_ERR_NO_STORAGE_POOL, NULL);
+        virStorageReportError(VIR_ERR_NO_STORAGE_POOL, NULL);
         goto cleanup;
     }
     ret = obj->configFile ? 1 : 0;
@@ -516,7 +514,7 @@ storagePoolCreate(virConnectPtr conn,
     virStorageBackendPtr backend;
 
     storageDriverLock(driver);
-    if (!(def = virStoragePoolDefParseString(conn, xml)))
+    if (!(def = virStoragePoolDefParseString(xml)))
         goto cleanup;
 
     pool = virStoragePoolObjFindByUUID(&driver->pools, def->uuid);
@@ -524,7 +522,7 @@ storagePoolCreate(virConnectPtr conn,
         pool = virStoragePoolObjFindByName(&driver->pools, def->name);
 
     if (pool) {
-        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("storage pool already exists"));
         virStoragePoolObjUnlock(pool);
         pool = NULL;
@@ -534,7 +532,7 @@ storagePoolCreate(virConnectPtr conn,
     if ((backend = virStorageBackendForType(def->type)) == NULL)
         goto cleanup;
 
-    if (!(pool = virStoragePoolObjAssignDef(conn, &driver->pools, def)))
+    if (!(pool = virStoragePoolObjAssignDef(&driver->pools, def)))
         goto cleanup;
     def = NULL;
 
@@ -574,16 +572,16 @@ storagePoolDefine(virConnectPtr conn,
     virStoragePoolPtr ret = NULL;
 
     storageDriverLock(driver);
-    if (!(def = virStoragePoolDefParseString(conn, xml)))
+    if (!(def = virStoragePoolDefParseString(xml)))
         goto cleanup;
 
     if (virStorageBackendForType(def->type) == NULL)
         goto cleanup;
 
-    if (!(pool = virStoragePoolObjAssignDef(conn, &driver->pools, def)))
+    if (!(pool = virStoragePoolObjAssignDef(&driver->pools, def)))
         goto cleanup;
 
-    if (virStoragePoolObjSaveDef(conn, driver, pool, def) < 0) {
+    if (virStoragePoolObjSaveDef(driver, pool, def) < 0) {
         virStoragePoolObjRemove(&driver->pools, pool);
         def = NULL;
         goto cleanup;
@@ -609,25 +607,25 @@ storagePoolUndefine(virStoragePoolPtr obj) {
     storageDriverLock(driver);
     pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
 
     if (virStoragePoolObjIsActive(pool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("pool is still active"));
         goto cleanup;
     }
 
     if (pool->asyncjobs > 0) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("pool '%s' has asynchronous jobs running."),
                               pool->def->name);
         goto cleanup;
     }
 
-    if (virStoragePoolObjDeleteDef(obj->conn, pool) < 0)
+    if (virStoragePoolObjDeleteDef(pool) < 0)
         goto cleanup;
 
     if (unlink(pool->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) {
@@ -663,7 +661,7 @@ storagePoolStart(virStoragePoolPtr obj,
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
@@ -672,7 +670,7 @@ storagePoolStart(virStoragePoolPtr obj,
         goto cleanup;
 
     if (virStoragePoolObjIsActive(pool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("pool already active"));
         goto cleanup;
     }
@@ -708,7 +706,7 @@ storagePoolBuild(virStoragePoolPtr obj,
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
@@ -717,7 +715,7 @@ storagePoolBuild(virStoragePoolPtr obj,
         goto cleanup;
 
     if (virStoragePoolObjIsActive(pool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("storage pool is already active"));
         goto cleanup;
     }
@@ -745,7 +743,7 @@ storagePoolDestroy(virStoragePoolPtr obj) {
     pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
@@ -754,13 +752,13 @@ storagePoolDestroy(virStoragePoolPtr obj) {
         goto cleanup;
 
     if (!virStoragePoolObjIsActive(pool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("storage pool is not active"));
         goto cleanup;
     }
 
     if (pool->asyncjobs > 0) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("pool '%s' has asynchronous jobs running."),
                               pool->def->name);
         goto cleanup;
@@ -801,7 +799,7 @@ storagePoolDelete(virStoragePoolPtr obj,
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
@@ -810,20 +808,20 @@ storagePoolDelete(virStoragePoolPtr obj,
         goto cleanup;
 
     if (virStoragePoolObjIsActive(pool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("storage pool is still active"));
         goto cleanup;
     }
 
     if (pool->asyncjobs > 0) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("pool '%s' has asynchronous jobs running."),
                               pool->def->name);
         goto cleanup;
     }
 
     if (!backend->deletePool) {
-        virStorageReportError(obj->conn, VIR_ERR_NO_SUPPORT,
+        virStorageReportError(VIR_ERR_NO_SUPPORT,
                               "%s", _("pool does not support volume delete"));
         goto cleanup;
     }
@@ -850,7 +848,7 @@ storagePoolRefresh(virStoragePoolPtr obj,
     pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
@@ -859,13 +857,13 @@ storagePoolRefresh(virStoragePoolPtr obj,
         goto cleanup;
 
     if (!virStoragePoolObjIsActive(pool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("storage pool is not active"));
         goto cleanup;
     }
 
     if (pool->asyncjobs > 0) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("pool '%s' has asynchronous jobs running."),
                               pool->def->name);
         goto cleanup;
@@ -906,7 +904,7 @@ storagePoolGetInfo(virStoragePoolPtr obj,
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
@@ -942,12 +940,12 @@ storagePoolDumpXML(virStoragePoolPtr obj,
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
 
-    ret = virStoragePoolDefFormat(obj->conn, pool->def);
+    ret = virStoragePoolDefFormat(pool->def);
 
 cleanup:
     if (pool)
@@ -967,7 +965,7 @@ storagePoolGetAutostart(virStoragePoolPtr obj,
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no pool with matching uuid"));
         goto cleanup;
     }
@@ -996,13 +994,13 @@ storagePoolSetAutostart(virStoragePoolPtr obj,
     pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no pool with matching uuid"));
         goto cleanup;
     }
 
     if (!pool->configFile) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_ARG,
+        virStorageReportError(VIR_ERR_INVALID_ARG,
                               "%s", _("pool has no config file"));
         goto cleanup;
     }
@@ -1058,13 +1056,13 @@ storagePoolNumVolumes(virStoragePoolPtr obj) {
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
 
     if (!virStoragePoolObjIsActive(pool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("storage pool is not active"));
         goto cleanup;
     }
@@ -1091,13 +1089,13 @@ storagePoolListVolumes(virStoragePoolPtr obj,
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
 
     if (!virStoragePoolObjIsActive(pool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("storage pool is not active"));
         goto cleanup;
     }
@@ -1136,13 +1134,13 @@ storageVolumeLookupByName(virStoragePoolPtr obj,
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
 
     if (!virStoragePoolObjIsActive(pool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("storage pool is not active"));
         goto cleanup;
     }
@@ -1150,8 +1148,8 @@ storageVolumeLookupByName(virStoragePoolPtr obj,
     vol = virStorageVolDefFindByName(pool, name);
 
     if (!vol) {
-        virStorageReportError(obj->conn, VIR_ERR_NO_STORAGE_VOL,
-                             _("no storage vol with matching name '%s'"),
+        virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
+                              _("no storage vol with matching name '%s'"),
                               name);
         goto cleanup;
     }
@@ -1190,7 +1188,7 @@ storageVolumeLookupByKey(virConnectPtr conn,
     storageDriverUnlock(driver);
 
     if (!ret)
-        virStorageReportError(conn, VIR_ERR_INVALID_STORAGE_VOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_VOL,
                               "%s", _("no storage vol with matching key"));
 
     return ret;
@@ -1236,7 +1234,7 @@ storageVolumeLookupByPath(virConnectPtr conn,
     }
 
     if (!ret)
-        virStorageReportError(conn, VIR_ERR_INVALID_STORAGE_VOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_VOL,
                               "%s", _("no storage vol with matching path"));
 
 cleanup:
@@ -1261,13 +1259,13 @@ storageVolumeCreateXML(virStoragePoolPtr obj,
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
 
     if (!virStoragePoolObjIsActive(pool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("storage pool is not active"));
         goto cleanup;
     }
@@ -1275,12 +1273,12 @@ storageVolumeCreateXML(virStoragePoolPtr obj,
     if ((backend = virStorageBackendForType(pool->def->type)) == NULL)
         goto cleanup;
 
-    voldef = virStorageVolDefParseString(obj->conn, pool->def, xmldesc);
+    voldef = virStorageVolDefParseString(pool->def, xmldesc);
     if (voldef == NULL)
         goto cleanup;
 
     if (virStorageVolDefFindByName(pool, voldef->name)) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("storage vol already exists"));
         goto cleanup;
     }
@@ -1292,7 +1290,7 @@ storageVolumeCreateXML(virStoragePoolPtr obj,
     }
 
     if (!backend->createVol) {
-        virStorageReportError(obj->conn, VIR_ERR_NO_SUPPORT,
+        virStorageReportError(VIR_ERR_NO_SUPPORT,
                               "%s", _("storage pool does not support volume "
                                       "creation"));
         goto cleanup;
@@ -1382,26 +1380,26 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
     }
     storageDriverUnlock(driver);
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
 
     if (STRNEQ(obj->name, vobj->pool) && !origpool) {
-        virStorageReportError(obj->conn, VIR_ERR_NO_STORAGE_POOL,
-                             _("no storage pool with matching name '%s'"),
+        virStorageReportError(VIR_ERR_NO_STORAGE_POOL,
+                              _("no storage pool with matching name '%s'"),
                               vobj->pool);
         goto cleanup;
     }
 
     if (!virStoragePoolObjIsActive(pool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("storage pool is not active"));
         goto cleanup;
     }
 
     if (origpool && !virStoragePoolObjIsActive(origpool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("storage pool is not active"));
         goto cleanup;
     }
@@ -1411,18 +1409,18 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
 
     origvol = virStorageVolDefFindByName(origpool ? origpool : pool, vobj->name);
     if (!origvol) {
-        virStorageReportError(obj->conn, VIR_ERR_NO_STORAGE_VOL,
-                             _("no storage vol with matching name '%s'"),
+        virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
+                              _("no storage vol with matching name '%s'"),
                               vobj->name);
         goto cleanup;
     }
 
-    newvol = virStorageVolDefParseString(obj->conn, pool->def, xmldesc);
+    newvol = virStorageVolDefParseString(pool->def, xmldesc);
     if (newvol == NULL)
         goto cleanup;
 
     if (virStorageVolDefFindByName(pool, newvol->name)) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               _("storage volume name '%s' already in use."),
                               newvol->name);
         goto cleanup;
@@ -1438,13 +1436,13 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
         newvol->allocation = origvol->capacity;
 
     if (!backend->buildVolFrom) {
-        virStorageReportError(obj->conn, VIR_ERR_NO_SUPPORT,
+        virStorageReportError(VIR_ERR_NO_SUPPORT,
                               "%s", _("storage pool does not support volume creation from an existing volume"));
         goto cleanup;
     }
 
     if (origvol->building) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("volume '%s' is still being allocated."),
                               origvol->name);
         goto cleanup;
@@ -1535,13 +1533,13 @@ storageVolumeDelete(virStorageVolPtr obj,
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
 
     if (!virStoragePoolObjIsActive(pool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("storage pool is not active"));
         goto cleanup;
     }
@@ -1552,21 +1550,21 @@ storageVolumeDelete(virStorageVolPtr obj,
     vol = virStorageVolDefFindByName(pool, obj->name);
 
     if (!vol) {
-        virStorageReportError(obj->conn, VIR_ERR_NO_STORAGE_VOL,
+        virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
                              _("no storage vol with matching name '%s'"),
                               obj->name);
         goto cleanup;
     }
 
     if (vol->building) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               _("volume '%s' is still being allocated."),
                               vol->name);
         goto cleanup;
     }
 
     if (!backend->deleteVol) {
-        virStorageReportError(obj->conn, VIR_ERR_NO_SUPPORT,
+        virStorageReportError(VIR_ERR_NO_SUPPORT,
                               "%s", _("storage pool does not support vol deletion"));
 
         goto cleanup;
@@ -1614,13 +1612,13 @@ storageVolumeGetInfo(virStorageVolPtr obj,
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
 
     if (!virStoragePoolObjIsActive(pool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("storage pool is not active"));
         goto cleanup;
     }
@@ -1628,8 +1626,8 @@ storageVolumeGetInfo(virStorageVolPtr obj,
     vol = virStorageVolDefFindByName(pool, obj->name);
 
     if (!vol) {
-        virStorageReportError(obj->conn, VIR_ERR_NO_STORAGE_VOL,
-                             _("no storage vol with matching name '%s'"),
+        virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
+                              _("no storage vol with matching name '%s'"),
                               obj->name);
         goto cleanup;
     }
@@ -1667,13 +1665,13 @@ storageVolumeGetXMLDesc(virStorageVolPtr obj,
     storageDriverUnlock(driver);
 
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
 
     if (!virStoragePoolObjIsActive(pool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("storage pool is not active"));
         goto cleanup;
     }
@@ -1681,7 +1679,7 @@ storageVolumeGetXMLDesc(virStorageVolPtr obj,
     vol = virStorageVolDefFindByName(pool, obj->name);
 
     if (!vol) {
-        virStorageReportError(obj->conn, VIR_ERR_NO_STORAGE_VOL,
+        virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
                              _("no storage vol with matching name '%s'"),
                               obj->name);
         goto cleanup;
@@ -1694,7 +1692,7 @@ storageVolumeGetXMLDesc(virStorageVolPtr obj,
         backend->refreshVol(obj->conn, pool, vol) < 0)
         goto cleanup;
 
-    ret = virStorageVolDefFormat(obj->conn, pool->def, vol);
+    ret = virStorageVolDefFormat(pool->def, vol);
 
 cleanup:
     if (pool)
@@ -1714,13 +1712,13 @@ storageVolumeGetPath(virStorageVolPtr obj) {
     pool = virStoragePoolObjFindByName(&driver->pools, obj->pool);
     storageDriverUnlock(driver);
     if (!pool) {
-        virStorageReportError(obj->conn, VIR_ERR_INVALID_STORAGE_POOL,
+        virStorageReportError(VIR_ERR_INVALID_STORAGE_POOL,
                               "%s", _("no storage pool with matching uuid"));
         goto cleanup;
     }
 
     if (!virStoragePoolObjIsActive(pool)) {
-        virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
                               "%s", _("storage pool is not active"));
         goto cleanup;
     }
@@ -1728,8 +1726,8 @@ storageVolumeGetPath(virStorageVolPtr obj) {
     vol = virStorageVolDefFindByName(pool, obj->name);
 
     if (!vol) {
-        virStorageReportError(obj->conn, VIR_ERR_NO_STORAGE_VOL,
-                             _("no storage vol with matching name '%s'"),
+        virStorageReportError(VIR_ERR_NO_STORAGE_VOL,
+                              _("no storage vol with matching name '%s'"),
                               obj->name);
         goto cleanup;
     }
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 5cecb93..ac0818b 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -577,10 +577,10 @@ static int testOpenDefault(virConnectPtr conn) {
     interfaceobj->active = 1;
     virInterfaceObjUnlock(interfaceobj);
 
-    if (!(pooldef = virStoragePoolDefParseString(conn, defaultPoolXML)))
+    if (!(pooldef = virStoragePoolDefParseString(defaultPoolXML)))
         goto error;
 
-    if (!(poolobj = virStoragePoolObjAssignDef(conn, &privconn->pools,
+    if (!(poolobj = virStoragePoolObjAssignDef(&privconn->pools,
                                                pooldef))) {
         virStoragePoolDefFree(pooldef);
         goto error;
@@ -648,8 +648,7 @@ static char *testBuildFilename(const char *relativeTo,
     }
 }
 
-static int testOpenVolumesForPool(virConnectPtr conn,
-                                  xmlDocPtr xml,
+static int testOpenVolumesForPool(xmlDocPtr xml,
                                   xmlXPathContextPtr ctxt,
                                   const char *file,
                                   virStoragePoolObjPtr pool,
@@ -684,12 +683,12 @@ static int testOpenVolumesForPool(virConnectPtr conn,
                 goto error;
             }
 
-            def = virStorageVolDefParseFile(conn, pool->def, absFile);
+            def = virStorageVolDefParseFile(pool->def, absFile);
             VIR_FREE(absFile);
             if (!def)
                 goto error;
         } else {
-            if ((def = virStorageVolDefParseNode(conn, pool->def, xml,
+            if ((def = virStorageVolDefParseNode(pool->def, xml,
                                                  vols[i])) == NULL) {
                 goto error;
             }
@@ -1008,18 +1007,18 @@ static int testOpenFromFile(virConnectPtr conn,
                 goto error;
             }
 
-            def = virStoragePoolDefParseFile(conn, absFile);
+            def = virStoragePoolDefParseFile(absFile);
             VIR_FREE(absFile);
             if (!def)
                 goto error;
         } else {
-            if ((def = virStoragePoolDefParseNode(conn, xml,
+            if ((def = virStoragePoolDefParseNode(xml,
                                                   pools[i])) == NULL) {
                 goto error;
             }
         }
 
-        if (!(pool = virStoragePoolObjAssignDef(conn, &privconn->pools,
+        if (!(pool = virStoragePoolObjAssignDef(&privconn->pools,
                                                 def))) {
             virStoragePoolDefFree(def);
             goto error;
@@ -1032,7 +1031,7 @@ static int testOpenFromFile(virConnectPtr conn,
         pool->active = 1;
 
         /* Find storage volumes */
-        if (testOpenVolumesForPool(conn, xml, ctxt, file, pool, i+1) < 0) {
+        if (testOpenVolumesForPool(xml, ctxt, file, pool, i+1) < 0) {
             virStoragePoolObjUnlock(pool);
             goto error;
         }
@@ -3727,7 +3726,7 @@ testStorageFindPoolSources(virConnectPtr conn,
     }
 
     if (srcSpec) {
-        source = virStoragePoolDefParseSourceString(conn, srcSpec, pool_type);
+        source = virStoragePoolDefParseSourceString(srcSpec, pool_type);
         if (!source)
             goto cleanup;
     }
@@ -3773,7 +3772,7 @@ testStoragePoolCreate(virConnectPtr conn,
     virStoragePoolPtr ret = NULL;
 
     testDriverLock(privconn);
-    if (!(def = virStoragePoolDefParseString(conn, xml)))
+    if (!(def = virStoragePoolDefParseString(xml)))
         goto cleanup;
 
     pool = virStoragePoolObjFindByUUID(&privconn->pools, def->uuid);
@@ -3785,7 +3784,7 @@ testStoragePoolCreate(virConnectPtr conn,
         goto cleanup;
     }
 
-    if (!(pool = virStoragePoolObjAssignDef(conn, &privconn->pools, def)))
+    if (!(pool = virStoragePoolObjAssignDef(&privconn->pools, def)))
         goto cleanup;
     def = NULL;
 
@@ -3816,14 +3815,14 @@ testStoragePoolDefine(virConnectPtr conn,
     virStoragePoolPtr ret = NULL;
 
     testDriverLock(privconn);
-    if (!(def = virStoragePoolDefParseString(conn, xml)))
+    if (!(def = virStoragePoolDefParseString(xml)))
         goto cleanup;
 
     def->capacity = defaultPoolCap;
     def->allocation = defaultPoolAlloc;
     def->available = defaultPoolCap - defaultPoolAlloc;
 
-    if (!(pool = virStoragePoolObjAssignDef(conn, &privconn->pools, def)))
+    if (!(pool = virStoragePoolObjAssignDef(&privconn->pools, def)))
         goto cleanup;
     def = NULL;
 
@@ -4055,7 +4054,7 @@ testStoragePoolDumpXML(virStoragePoolPtr pool,
         goto cleanup;
     }
 
-    ret = virStoragePoolDefFormat(pool->conn, privpool->def);
+    ret = virStoragePoolDefFormat(privpool->def);
 
 cleanup:
     if (privpool)
@@ -4341,7 +4340,7 @@ testStorageVolumeCreateXML(virStoragePoolPtr pool,
         goto cleanup;
     }
 
-    privvol = virStorageVolDefParseString(pool->conn, privpool->def, xmldesc);
+    privvol = virStorageVolDefParseString(privpool->def, xmldesc);
     if (privvol == NULL)
         goto cleanup;
 
@@ -4422,7 +4421,7 @@ testStorageVolumeCreateXMLFrom(virStoragePoolPtr pool,
         goto cleanup;
     }
 
-    privvol = virStorageVolDefParseString(pool->conn, privpool->def, xmldesc);
+    privvol = virStorageVolDefParseString(privpool->def, xmldesc);
     if (privvol == NULL)
         goto cleanup;
 
@@ -4645,7 +4644,7 @@ testStorageVolumeGetXMLDesc(virStorageVolPtr vol,
         goto cleanup;
     }
 
-    ret = virStorageVolDefFormat(vol->conn, privpool->def, privvol);
+    ret = virStorageVolDefFormat(privpool->def, privvol);
 
 cleanup:
     if (privpool)
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 06f6802..0965021 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -6578,7 +6578,7 @@ static virStorageVolPtr vboxStorageVolCreateXML(virStoragePoolPtr pool,
     memset(&poolDef, 0, sizeof(poolDef));
     poolDef.type = VIR_STORAGE_POOL_DIR;
 
-    if ((def = virStorageVolDefParseString(pool->conn, &poolDef, xml)) == NULL)
+    if ((def = virStorageVolDefParseString(&poolDef, xml)) == NULL)
         goto cleanup;
 
     if (   !def->name
@@ -6922,7 +6922,7 @@ static char *vboxStorageVolGetXMLDesc(virStorageVolPtr vol, unsigned int flags A
     vboxIIDUtf16Free(hddIID);
 
     if (defOk)
-        ret = virStorageVolDefFormat(vol->conn, &pool, &def);
+        ret = virStorageVolDefFormat(&pool, &def);
 
     return ret;
 }
diff --git a/tests/storagepoolxml2xmltest.c b/tests/storagepoolxml2xmltest.c
index a7370c7..4550407 100644
--- a/tests/storagepoolxml2xmltest.c
+++ b/tests/storagepoolxml2xmltest.c
@@ -33,10 +33,10 @@ static int testCompareXMLToXMLFiles(const char *inxml, const char *outxml) {
     if (virtTestLoadFile(outxml, &outXmlPtr, MAX_FILE) < 0)
         goto fail;
 
-    if (!(dev = virStoragePoolDefParseString(NULL, inXmlData)))
+    if (!(dev = virStoragePoolDefParseString(inXmlData)))
         goto fail;
 
-    if (!(actual = virStoragePoolDefFormat(NULL, dev)))
+    if (!(actual = virStoragePoolDefFormat(dev)))
         goto fail;
 
     if (STRNEQ(outXmlData, actual)) {
diff --git a/tests/storagevolxml2xmltest.c b/tests/storagevolxml2xmltest.c
index 17bf009..ffa5dfe 100644
--- a/tests/storagevolxml2xmltest.c
+++ b/tests/storagevolxml2xmltest.c
@@ -40,13 +40,13 @@ static int testCompareXMLToXMLFiles(const char *poolxml,
     if (virtTestLoadFile(outxml, &outXmlPtr, MAX_FILE) < 0)
         goto fail;
 
-    if (!(pool = virStoragePoolDefParseString(NULL, poolXmlData)))
+    if (!(pool = virStoragePoolDefParseString(poolXmlData)))
         goto fail;
 
-    if (!(dev = virStorageVolDefParseString(NULL, pool, inXmlData)))
+    if (!(dev = virStorageVolDefParseString(pool, inXmlData)))
         goto fail;
 
-    if (!(actual = virStorageVolDefFormat(NULL, pool, dev)))
+    if (!(actual = virStorageVolDefFormat(pool, dev)))
         goto fail;
 
     if (STRNEQ(outXmlData, actual)) {
-- 
1.6.6


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