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;
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)
#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,
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;
}
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;
}
}
static int
-virStoragePoolDefParseSource(virConnectPtr conn,
- xmlXPathContextPtr ctxt,
+virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
virStoragePoolSourcePtr source,
int pool_type,
xmlNodePtr node) {
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;
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;
}
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;
}
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;
}
}
virStoragePoolSourcePtr
-virStoragePoolDefParseSourceString(virConnectPtr conn,
- const char *srcSpec,
+virStoragePoolDefParseSourceString(const char *srcSpec,
int pool_type)
{
xmlDocPtr doc = NULL;
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;
}
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;
return ret;
}
static int
-virStorageDefParsePerms(virConnectPtr conn,
- xmlXPathContextPtr ctxt,
+virStorageDefParsePerms(xmlXPathContextPtr ctxt,
virStoragePermsPtr perms,
const char *permxpath,
int defaultmode) {
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;
}
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;
}
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;
}
}
static virStoragePoolDefPtr
-virStoragePoolDefParseXML(virConnectPtr conn,
- xmlXPathContextPtr ctxt) {
+virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) {
virStoragePoolOptionsPtr options;
virStoragePoolDefPtr ret;
xmlNodePtr source_node;
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;
}
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;
}
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;
}
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;
}
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;
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;
}
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;
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);
}
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;
}
}
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;
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 |
}
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);
}
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)
{
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;
char *
-virStoragePoolDefFormat(virConnectPtr conn,
- virStoragePoolDefPtr def) {
+virStoragePoolDefFormat(virStoragePoolDefPtr def) {
virStoragePoolOptionsPtr options;
virBuffer buf = VIR_BUFFER_INITIALIZER;
const char *type;
type = virStoragePoolTypeToString(def->type);
if (!type) {
- virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("unexpected pool type"));
goto cleanup;
}
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");
static int
-virStorageSize(virConnectPtr conn,
- const char *unit,
+virStorageSize(const char *unit,
const char *val,
unsigned long long *ret) {
unsigned long long mult;
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;
}
}
static virStorageVolDefPtr
-virStorageVolDefParseXML(virConnectPtr conn,
- virStoragePoolDefPtr pool,
+virStorageVolDefParseXML(virStoragePoolDefPtr pool,
xmlXPathContextPtr ctxt) {
virStorageVolDefPtr ret;
virStorageVolOptionsPtr options;
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;
}
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);
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);
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;
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;
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;
VIR_FREE(format);
}
- if (virStorageDefParsePerms(conn, ctxt, &ret->backingStore.perms,
+ if (virStorageDefParsePerms(ctxt, &ret->backingStore.perms,
"./backingStore/permissions", 0600) < 0)
goto cleanup;
}
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;
}
}
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;
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,
}
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);
}
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) {
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;
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);
}
char *
-virStorageVolDefFormat(virConnectPtr conn,
- virStoragePoolDefPtr pool,
+virStorageVolDefFormat(virStoragePoolDefPtr pool,
virStorageVolDefPtr def) {
virStorageVolOptionsPtr options;
virBuffer buf = VIR_BUFFER_INITIALIZER;
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;
}
virStoragePoolObjPtr
-virStoragePoolObjAssignDef(virConnectPtr conn,
- virStoragePoolObjListPtr pools,
+virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools,
virStoragePoolDefPtr def) {
virStoragePoolObjPtr pool;
}
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;
}
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;
}
int
-virStoragePoolLoadAllConfigs(virConnectPtr conn,
- virStoragePoolObjListPtr pools,
+virStoragePoolLoadAllConfigs(virStoragePoolObjListPtr pools,
const char *configDir,
const char *autostartDir) {
DIR *dir;
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);
}
int
-virStoragePoolObjSaveDef(virConnectPtr conn,
- virStorageDriverStatePtr driver,
+virStoragePoolObjSaveDef(virStorageDriverStatePtr driver,
virStoragePoolObjPtr pool,
virStoragePoolDefPtr def) {
char *xml;
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;
}
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);
}
}
- 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;
}
}
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;
}
virStoragePoolSourcePtr
-virStoragePoolSourceListNewSource(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
- virStoragePoolSourceListPtr list)
+virStoragePoolSourceListNewSource(virStoragePoolSourceListPtr list)
{
virStoragePoolSourcePtr source;
return source;
}
-char *virStoragePoolSourceListFormat(virConnectPtr conn,
- virStoragePoolSourceListPtr def)
+char *virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def)
{
virStoragePoolOptionsPtr options;
virBuffer buf = VIR_BUFFER_INITIALIZER;
type = virStoragePoolTypeToString(def->type);
if (!type) {
- virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("unexpected pool type"));
goto cleanup;
}
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");
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);
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);
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);
#ifndef PROXY
static virStorageEncryptionSecretPtr
-virStorageEncryptionSecretParse(virConnectPtr conn, xmlXPathContextPtr ctxt,
+virStorageEncryptionSecretParse(xmlXPathContextPtr ctxt,
xmlNodePtr node)
{
xmlNodePtr old_node;
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);
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;
}
}
static virStorageEncryptionPtr
-virStorageEncryptionParseXML(virConnectPtr conn, xmlXPathContextPtr ctxt)
+virStorageEncryptionParseXML(xmlXPathContextPtr ctxt)
{
xmlNodePtr *nodes = NULL;
virStorageEncryptionPtr ret;
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);
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;
}
}
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;
}
}
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;
}
ctxt->node = root;
- enc = virStorageEncryptionParseXML(conn, ctxt);
+ enc = virStorageEncryptionParseXML(ctxt);
cleanup:
xmlXPathFreeContext(ctxt);
static int
-virStorageEncryptionSecretFormat(virConnectPtr conn,
- virBufferPtr buf,
+virStorageEncryptionSecretFormat(virBufferPtr buf,
virStorageEncryptionSecretPtr secret)
{
const char *type;
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;
}
}
int
-virStorageEncryptionFormat(virConnectPtr conn,
- virBufferPtr buf,
+virStorageEncryptionFormat(virBufferPtr buf,
virStorageEncryptionPtr enc)
{
const char *format;
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;
}
}
int
-virStorageGenerateQcowPassphrase(virConnectPtr conn, unsigned char *dest)
+virStorageGenerateQcowPassphrase(unsigned char *dest)
{
int fd;
size_t i;
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;
}
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;
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 */
VIR_STORAGE_QCOW_PASSPHRASE_SIZE = 16
};
-int virStorageGenerateQcowPassphrase(virConnectPtr conn, unsigned char *dest);
+int virStorageGenerateQcowPassphrase(unsigned char *dest);
#endif /* __VIR_STORAGE_ENCRYPTION_H__ */
}
int
-virStorageBackendCreateRaw(virConnectPtr conn,
+virStorageBackendCreateRaw(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool,
virStorageVolDefPtr vol,
virStorageVolDefPtr inputvol,
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;
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;
}
}
VIR_FREE(xml);
- if (virStorageGenerateQcowPassphrase(conn, value) < 0)
+ if (virStorageGenerateQcowPassphrase(value) < 0)
goto cleanup;
if (conn->secretDriver->setValue(secret, value, sizeof(value), 0) < 0)
};
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;
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;
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;
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;
}
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;
}
* with a partially functional qcow-create. Go figure ??!?
*/
static int
-virStorageBackendCreateQcowCreate(virConnectPtr conn,
+virStorageBackendCreateQcowCreate(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool,
virStorageVolDefPtr vol,
virStorageVolDefPtr inputvol,
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;
}
virStorageBackendBuildVolFrom
-virStorageBackendFSImageToolTypeToFunc(virConnectPtr conn, int tool_type)
+virStorageBackendFSImageToolTypeToFunc(int tool_type)
{
switch (tool_type) {
case TOOL_KVM_IMG:
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);
}
}
virStorageBackendBuildVolFrom
-virStorageBackendGetBuildVolFromFunction(virConnectPtr conn,
- virStorageVolDefPtr vol,
+virStorageBackendGetBuildVolFromFunction(virStorageVolDefPtr vol,
virStorageVolDefPtr inputvol)
{
int tool_type;
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)
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;
}
* 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,
if (err != 0) {
char error[100];
regerror(err, ®[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(®[j]);
}
if ((list = fdopen(fd, "r")) == NULL) {
- virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot read fd"));
goto cleanup;
}
/* 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 */
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;
}
* 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,
}
if ((fp = fdopen(fd, "r")) == NULL) {
- virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot read fd"));
goto cleanup;
}
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++) {
} 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;
}
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;
}
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
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;
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,
void *data,
int *exitstatus);
-int virStorageBackendRunProgNul(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+int virStorageBackendRunProgNul(virStoragePoolObjPtr pool,
const char **prog,
size_t n_columns,
virStorageBackendListVolNulFunc func,
#define SECTOR_SIZE 512
static int
-virStorageBackendDiskMakeDataVol(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendDiskMakeDataVol(virStoragePoolObjPtr pool,
char **const groups,
virStorageVolDefPtr vol)
{
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;
}
}
static int
-virStorageBackendDiskMakeFreeExtent(virConnectPtr conn ATTRIBUTE_UNUSED,
- virStoragePoolObjPtr pool,
+virStorageBackendDiskMakeFreeExtent(virStoragePoolObjPtr pool,
char **const groups)
{
virStoragePoolSourceDevicePtr dev = &pool->def->source.devices[0];
static int
-virStorageBackendDiskMakeVol(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendDiskMakeVol(virStoragePoolObjPtr pool,
size_t ntok ATTRIBUTE_UNUSED,
char **const groups,
void *data)
}
}
- 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 */
* and we can even ensure the output is friendly.
*/
static int
-virStorageBackendDiskReadPartitions(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendDiskReadPartitions(virStoragePoolObjPtr pool,
virStorageVolDefPtr vol)
{
pool->def->allocation = pool->def->capacity = pool->def->available = 0;
- return virStorageBackendRunProgNul(conn,
- pool,
+ return virStorageBackendRunProgNul(pool,
prog,
6,
virStorageBackendDiskMakeVol,
}
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]);
}
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,
}
static int
-virStorageBackendDiskRefreshPool(virConnectPtr conn,
+virStorageBackendDiskRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool)
{
VIR_FREE(pool->def->source.devices[0].freeExtents);
virFileWaitForDevices();
- if (virStorageBackendDiskReadGeometry(conn, pool) != 0) {
+ if (virStorageBackendDiskReadGeometry(pool) != 0) {
return -1;
}
- return virStorageBackendDiskReadPartitions(conn, pool, NULL);
+ return virStorageBackendDiskReadPartitions(pool, NULL);
}
}
static int
-virStorageBackendDiskPartFormat(virConnectPtr conn, virStoragePoolObjPtr pool,
+virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool,
virStorageVolDefPtr vol,
char* partFormat)
{
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;
}
/* 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;
}
}
}
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;
}
* partitions
*/
static int
-virStorageBackendDiskPartBoundries(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool,
unsigned long long *start,
unsigned long long *end,
unsigned long long allocation)
}
if (smallestExtent == -1) {
- virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("no large enough free extent"));
return -1;
}
static int
-virStorageBackendDiskCreateVol(virConnectPtr conn,
+virStorageBackendDiskCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool,
virStorageVolDefPtr vol)
{
};
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;
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;
{
virStorageBackendBuildVolFrom build_func;
- build_func = virStorageBackendGetBuildVolFromFunction(conn, vol, inputvol);
+ build_func = virStorageBackendGetBuildVolFromFunction(vol, inputvol);
if (!build_func)
return -1;
}
static int
-virStorageBackendDiskDeleteVol(virConnectPtr conn,
+virStorageBackendDiskDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool,
virStorageVolDefPtr vol,
unsigned int flags ATTRIBUTE_UNUSED)
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;
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;
typedef struct _virNetfsDiscoverState virNetfsDiscoverState;
static int
-virStorageBackendFileSystemNetFindPoolSourcesFunc(virConnectPtr conn,
- virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
+virStorageBackendFileSystemNetFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
char **const groups,
void *data)
{
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)) ||
static char *
-virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn,
+virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,
const char *srcSpec,
unsigned int flags ATTRIBUTE_UNUSED)
{
char *retval = NULL;
unsigned int i;
- source = virStoragePoolDefParseSourceString(conn, srcSpec,
+ source = virStoragePoolDefParseSourceString(srcSpec,
VIR_STORAGE_POOL_NETFS);
if (!source)
goto cleanup;
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;
* 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;
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;
}
* 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;
}
*/
#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;
* Returns 0 on success, -1 on error
*/
static int
-virStorageBackendFileSystemBuild(virConnectPtr conn,
+virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool,
unsigned int flags ATTRIBUTE_UNUSED)
{
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;
*/
#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;
return 0;
}
-static int createFileDir(virConnectPtr conn,
+static int createFileDir(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool,
virStorageVolDefPtr vol,
virStorageVolDefPtr inputvol,
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;
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;
} 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;
#define VIR_FROM_THIS VIR_FROM_STORAGE
static int
-virStorageBackendISCSITargetIP(virConnectPtr conn,
- const char *hostname,
+virStorageBackendISCSITargetIP(const char *hostname,
char *ipaddr,
size_t ipaddrlen)
{
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;
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);
}
static int
-virStorageBackendISCSIExtractSession(virConnectPtr conn ATTRIBUTE_UNUSED,
- virStoragePoolObjPtr pool,
+virStorageBackendISCSIExtractSession(virStoragePoolObjPtr pool,
char **const groups,
void *data)
{
}
static char *
-virStorageBackendISCSISession(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendISCSISession(virStoragePoolObjPtr pool,
int probe)
{
/*
* 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,
if (session == NULL &&
!probe) {
- virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot find session"));
return NULL;
}
#define LINE_SIZE 4096
static int
-virStorageBackendIQNFound(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendIQNFound(virStoragePoolObjPtr pool,
char **ifacename)
{
int ret = IQN_MISSING, fd = -1;
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;
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);
}
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));
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]);
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;
* 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;
* 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);
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;
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;
};
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;
static int
-virStorageBackendISCSIConnection(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendISCSIConnection(virStoragePoolObjPtr pool,
const char *portal,
const char *action)
{
if (pool->def->source.initiator.iqn != NULL) {
- ret = virStorageBackendISCSIConnectionIQN(conn, pool, portal, action);
+ ret = virStorageBackendISCSIConnectionIQN(pool, portal, action);
} else {
static int
-virStorageBackendISCSIFindLUs(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendISCSIFindLUs(virStoragePoolObjPtr pool,
const char *session)
{
char sysfs_path[PATH_MAX];
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;
}
static int
-virStorageBackendISCSIRescanLUNs(virConnectPtr conn ATTRIBUTE_UNUSED,
- virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
+virStorageBackendISCSIRescanLUNs(virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
const char *session)
{
const char *const cmdargv[] = {
static int
-virStorageBackendISCSILogin(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendISCSILogin(virStoragePoolObjPtr pool,
const char *portal)
{
const char *const cmdsendtarget[] = {
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;
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;
}
}
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);
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;
}
static int
-virStorageBackendLogicalMakeVol(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool,
char **const groups,
void *data)
{
}
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;
}
}
static int
-virStorageBackendLogicalFindLVs(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendLogicalFindLVs(virStoragePoolObjPtr pool,
virStorageVolDefPtr vol)
{
/*
int exitstatus;
- if (virStorageBackendRunProgRegex(conn,
- pool,
+ if (virStorageBackendRunProgRegex(pool,
prog,
1,
regexes,
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;
}
static int
-virStorageBackendLogicalRefreshPoolFunc(virConnectPtr conn ATTRIBUTE_UNUSED,
- virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
+virStorageBackendLogicalRefreshPoolFunc(virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
char **const groups,
void *data ATTRIBUTE_UNUSED)
{
static int
-virStorageBackendLogicalFindPoolSourcesFunc(virConnectPtr conn,
- virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
+virStorageBackendLogicalFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
char **const groups,
void *data)
{
}
if (thisSource == NULL) {
- if (!(thisSource = virStoragePoolSourceListNewSource(conn,
- sourceList)))
+ if (!(thisSource = virStoragePoolSourceListNewSource(sourceList)))
goto err_no_memory;
thisSource->name = vgname;
}
static char *
-virStorageBackendLogicalFindPoolSources(virConnectPtr conn,
+virStorageBackendLogicalFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,
const char *srcSpec ATTRIBUTE_UNUSED,
unsigned int flags ATTRIBUTE_UNUSED)
{
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;
}
static int
-virStorageBackendLogicalRefreshPool(virConnectPtr conn,
+virStorageBackendLogicalRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool)
{
/*
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,
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;
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);
{
virStorageBackendBuildVolFrom build_func;
- build_func = virStorageBackendGetBuildVolFromFunction(conn, vol, inputvol);
+ build_func = virStorageBackendGetBuildVolFromFunction(vol, inputvol);
if (!build_func)
return -1;
#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)
{
allocation,
capacity) < 0) {
- virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to update volume target info for '%s'"),
target->path);
}
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);
static int
-virStorageBackendMpathNewVol(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendMpathNewVol(virStoragePoolObjPtr pool,
const int devnum,
const char *dev)
{
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;
static int
-virStorageBackendCreateVols(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendCreateVols(virStoragePoolObjPtr pool,
struct dm_names *names)
{
int retval = 0, is_mpath = 0;
goto out;
}
- virStorageBackendMpathNewVol(conn,
- pool,
+ virStorageBackendMpathNewVol(pool,
minor,
map_device);
static int
-virStorageBackendGetMaps(virConnectPtr conn,
- virStoragePoolObjPtr pool)
+virStorageBackendGetMaps(virStoragePoolObjPtr pool)
{
int retval = 0;
struct dm_task *dmt = NULL;
goto out;
}
- virStorageBackendCreateVols(conn, pool, names);
+ virStorageBackendCreateVols(pool, names);
out:
if (dmt != NULL) {
static int
-virStorageBackendMpathRefreshPool(virConnectPtr conn,
+virStorageBackendMpathRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool)
{
int retval = 0;
virFileWaitForDevices();
- virStorageBackendGetMaps(conn, pool);
+ virStorageBackendGetMaps(pool);
return retval;
}
* the device otherwise.
*/
static int
-getDeviceType(virConnectPtr conn,
- uint32_t host,
+getDeviceType(uint32_t host,
uint32_t bus,
uint32_t target,
uint32_t lun,
* 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 */
}
static int
-virStorageBackendSCSINewLun(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendSCSINewLun(virStoragePoolObjPtr pool,
uint32_t host,
uint32_t bus,
uint32_t target,
&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;
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)
{
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)
{
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;
static int
-getBlockDevice(virConnectPtr conn,
- uint32_t host,
+getBlockDevice(uint32_t host,
uint32_t bus,
uint32_t target,
uint32_t lun,
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);
}
static int
-processLU(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+processLU(virStoragePoolObjPtr pool,
uint32_t host,
uint32_t bus,
uint32_t target,
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;
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"),
int
-virStorageBackendSCSIFindLUs(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendSCSIFindLUs(virStoragePoolObjPtr pool,
uint32_t scanhost)
{
int retval = 0;
VIR_DEBUG(_("Found LU '%s'"), lun_dirent->d_name);
- processLU(conn, pool, scanhost, bus, target, lun);
+ processLU(pool, scanhost, bus, target, lun);
}
closedir(devicedir);
static int
-virStorageBackendSCSIRefreshPool(virConnectPtr conn,
+virStorageBackendSCSIRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool)
{
int retval = 0;
goto out;
}
- virStorageBackendSCSIFindLUs(conn, pool, host);
+ virStorageBackendSCSIFindLUs(pool, host);
out:
return retval;
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__ */
}
*/
- if (virStoragePoolLoadAllConfigs(NULL,
- &driverState->pools,
+ if (virStoragePoolLoadAllConfigs(&driverState->pools,
driverState->configDir,
driverState->autostartDir) < 0)
goto error;
return -1;
storageDriverLock(driverState);
- virStoragePoolLoadAllConfigs(NULL,
- &driverState->pools,
+ virStoragePoolLoadAllConfigs(&driverState->pools,
driverState->configDir,
driverState->autostartDir);
storageDriverAutostart(driverState);
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;
}
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;
}
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;
}
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;
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);
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;
virStorageBackendPtr backend;
storageDriverLock(driver);
- if (!(def = virStoragePoolDefParseString(conn, xml)))
+ if (!(def = virStoragePoolDefParseString(xml)))
goto cleanup;
pool = virStoragePoolObjFindByUUID(&driver->pools, def->uuid);
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;
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;
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;
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) {
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;
}
goto cleanup;
if (virStoragePoolObjIsActive(pool)) {
- virStorageReportError(obj->conn, VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("pool already active"));
goto cleanup;
}
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;
}
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;
}
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;
}
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;
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;
}
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;
}
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;
}
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;
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;
}
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)
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
if (!ret)
- virStorageReportError(conn, VIR_ERR_INVALID_STORAGE_VOL,
+ virStorageReportError(VIR_ERR_INVALID_STORAGE_VOL,
"%s", _("no storage vol with matching path"));
cleanup:
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;
}
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;
}
}
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;
}
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;
}
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;
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;
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;
}
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;
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;
}
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;
}
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;
}
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;
backend->refreshVol(obj->conn, pool, vol) < 0)
goto cleanup;
- ret = virStorageVolDefFormat(obj->conn, pool->def, vol);
+ ret = virStorageVolDefFormat(pool->def, vol);
cleanup:
if (pool)
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;
}
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;
}
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;
}
}
-static int testOpenVolumesForPool(virConnectPtr conn,
- xmlDocPtr xml,
+static int testOpenVolumesForPool(xmlDocPtr xml,
xmlXPathContextPtr ctxt,
const char *file,
virStoragePoolObjPtr pool,
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;
}
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;
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;
}
}
if (srcSpec) {
- source = virStoragePoolDefParseSourceString(conn, srcSpec, pool_type);
+ source = virStoragePoolDefParseSourceString(srcSpec, pool_type);
if (!source)
goto cleanup;
}
virStoragePoolPtr ret = NULL;
testDriverLock(privconn);
- if (!(def = virStoragePoolDefParseString(conn, xml)))
+ if (!(def = virStoragePoolDefParseString(xml)))
goto cleanup;
pool = virStoragePoolObjFindByUUID(&privconn->pools, def->uuid);
goto cleanup;
}
- if (!(pool = virStoragePoolObjAssignDef(conn, &privconn->pools, def)))
+ if (!(pool = virStoragePoolObjAssignDef(&privconn->pools, def)))
goto cleanup;
def = NULL;
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;
goto cleanup;
}
- ret = virStoragePoolDefFormat(pool->conn, privpool->def);
+ ret = virStoragePoolDefFormat(privpool->def);
cleanup:
if (privpool)
goto cleanup;
}
- privvol = virStorageVolDefParseString(pool->conn, privpool->def, xmldesc);
+ privvol = virStorageVolDefParseString(privpool->def, xmldesc);
if (privvol == NULL)
goto cleanup;
goto cleanup;
}
- privvol = virStorageVolDefParseString(pool->conn, privpool->def, xmldesc);
+ privvol = virStorageVolDefParseString(privpool->def, xmldesc);
if (privvol == NULL)
goto cleanup;
goto cleanup;
}
- ret = virStorageVolDefFormat(vol->conn, privpool->def, privvol);
+ ret = virStorageVolDefFormat(privpool->def, privvol);
cleanup:
if (privpool)
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
vboxIIDUtf16Free(hddIID);
if (defOk)
- ret = virStorageVolDefFormat(vol->conn, &pool, &def);
+ ret = virStorageVolDefFormat(&pool, &def);
return ret;
}
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)) {
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)) {