storage_conf: Put "%s" at the same line with error type

Trivial, but it allows the "error message" to have more spaces.
This commit is contained in:
Osier Yang 2013-05-22 20:05:15 +08:00
parent 0175f03cde
commit 3c37730efc
1 changed files with 47 additions and 48 deletions

View File

@ -446,15 +446,15 @@ virStoragePoolDefParseAuthChap(xmlXPathContextPtr ctxt,
{ {
auth->login = virXPathString("string(./auth/@login)", ctxt); auth->login = virXPathString("string(./auth/@login)", ctxt);
if (auth->login == NULL) { if (auth->login == NULL) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("missing auth login attribute")); _("missing auth login attribute"));
return -1; return -1;
} }
auth->passwd = virXPathString("string(./auth/@passwd)", ctxt); auth->passwd = virXPathString("string(./auth/@passwd)", ctxt);
if (auth->passwd == NULL) { if (auth->passwd == NULL) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("missing auth passwd attribute")); _("missing auth passwd attribute"));
return -1; return -1;
} }
@ -470,8 +470,8 @@ virStoragePoolDefParseAuthCephx(xmlXPathContextPtr ctxt,
auth->username = virXPathString("string(./auth/@username)", ctxt); auth->username = virXPathString("string(./auth/@username)", ctxt);
if (auth->username == NULL) { if (auth->username == NULL) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("missing auth username attribute")); _("missing auth username attribute"));
return -1; return -1;
} }
@ -490,8 +490,8 @@ virStoragePoolDefParseAuthCephx(xmlXPathContextPtr ctxt,
goto cleanup; goto cleanup;
} }
if (virUUIDParse(uuid, auth->secret.uuid) < 0) { if (virUUIDParse(uuid, auth->secret.uuid) < 0) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("invalid auth secret uuid")); _("invalid auth secret uuid"));
goto cleanup; goto cleanup;
} }
auth->secret.uuidUsable = true; auth->secret.uuidUsable = true;
@ -564,8 +564,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
for (i = 0; i < source->nhost; i++) { for (i = 0; i < source->nhost; i++) {
name = virXMLPropString(nodeset[i], "name"); name = virXMLPropString(nodeset[i], "name");
if (name == NULL) { if (name == NULL) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("missing storage pool host name")); _("missing storage pool host name"));
goto cleanup; goto cleanup;
} }
source->hosts[i].name = name; source->hosts[i].name = name;
@ -600,8 +600,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
char *path = virXMLPropString(nodeset[i], "path"); char *path = virXMLPropString(nodeset[i], "path");
if (path == NULL) { if (path == NULL) {
VIR_FREE(nodeset); VIR_FREE(nodeset);
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("missing storage pool source device path")); _("missing storage pool source device path"));
goto cleanup; goto cleanup;
} }
source->devices[i].path = path; source->devices[i].path = path;
@ -773,8 +773,8 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
if (virStrToLong_i(mode, NULL, 8, &tmp) < 0 || (tmp & ~0777)) { if (virStrToLong_i(mode, NULL, 8, &tmp) < 0 || (tmp & ~0777)) {
VIR_FREE(mode); VIR_FREE(mode);
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("malformed octal mode")); _("malformed octal mode"));
goto error; goto error;
} }
perms->mode = tmp; perms->mode = tmp;
@ -785,8 +785,8 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
perms->uid = (uid_t) -1; perms->uid = (uid_t) -1;
} else { } else {
if (virXPathLong("number(./owner)", ctxt, &v) < 0) { if (virXPathLong("number(./owner)", ctxt, &v) < 0) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("malformed owner element")); _("malformed owner element"));
goto error; goto error;
} }
perms->uid = (int)v; perms->uid = (int)v;
@ -796,8 +796,8 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
perms->gid = (gid_t) -1; perms->gid = (gid_t) -1;
} else { } else {
if (virXPathLong("number(./group)", ctxt, &v) < 0) { if (virXPathLong("number(./group)", ctxt, &v) < 0) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("malformed group element")); _("malformed group element"));
goto error; goto error;
} }
perms->gid = (int)v; perms->gid = (int)v;
@ -853,22 +853,22 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
options->flags & VIR_STORAGE_POOL_SOURCE_NAME) options->flags & VIR_STORAGE_POOL_SOURCE_NAME)
ret->name = ret->source.name; ret->name = ret->source.name;
if (ret->name == NULL) { if (ret->name == NULL) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("missing pool source name element")); _("missing pool source name element"));
goto cleanup; goto cleanup;
} }
uuid = virXPathString("string(./uuid)", ctxt); uuid = virXPathString("string(./uuid)", ctxt);
if (uuid == NULL) { if (uuid == NULL) {
if (virUUIDGenerate(ret->uuid) < 0) { if (virUUIDGenerate(ret->uuid) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"%s", _("unable to generate uuid")); _("unable to generate uuid"));
goto cleanup; goto cleanup;
} }
} else { } else {
if (virUUIDParse(uuid, ret->uuid) < 0) { if (virUUIDParse(uuid, ret->uuid) < 0) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("malformed uuid element")); _("malformed uuid element"));
goto cleanup; goto cleanup;
} }
VIR_FREE(uuid); VIR_FREE(uuid);
@ -876,8 +876,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
if (options->flags & VIR_STORAGE_POOL_SOURCE_HOST) { if (options->flags & VIR_STORAGE_POOL_SOURCE_HOST) {
if (!ret->source.nhost) { if (!ret->source.nhost) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s",
_("missing storage pool source host name")); _("missing storage pool source host name"));
goto cleanup; goto cleanup;
} }
@ -885,8 +884,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
if (options->flags & VIR_STORAGE_POOL_SOURCE_DIR) { if (options->flags & VIR_STORAGE_POOL_SOURCE_DIR) {
if (!ret->source.dir) { if (!ret->source.dir) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("missing storage pool source path")); _("missing storage pool source path"));
goto cleanup; goto cleanup;
} }
} }
@ -921,8 +920,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
} else if (ret->source.adapter.type == } else if (ret->source.adapter.type ==
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) { VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
if (!ret->source.adapter.data.name) { if (!ret->source.adapter.data.name) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("missing storage pool source adapter name")); _("missing storage pool source adapter name"));
goto cleanup; goto cleanup;
} }
} }
@ -931,8 +930,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
/* If DEVICE is the only source type, then its required */ /* If DEVICE is the only source type, then its required */
if (options->flags == VIR_STORAGE_POOL_SOURCE_DEVICE) { if (options->flags == VIR_STORAGE_POOL_SOURCE_DEVICE) {
if (!ret->source.ndevice) { if (!ret->source.ndevice) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("missing storage pool source device name")); _("missing storage pool source device name"));
goto cleanup; goto cleanup;
} }
} }
@ -941,8 +940,8 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt)
* path and permissions */ * path and permissions */
if (!(options->flags & VIR_STORAGE_POOL_SOURCE_NETWORK)) { if (!(options->flags & VIR_STORAGE_POOL_SOURCE_NETWORK)) {
if ((tmppath = virXPathString("string(./target/path)", ctxt)) == NULL) { if ((tmppath = virXPathString("string(./target/path)", ctxt)) == NULL) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("missing storage pool target path")); _("missing storage pool target path"));
goto cleanup; goto cleanup;
} }
ret->target.path = virFileSanitizePath(tmppath); ret->target.path = virFileSanitizePath(tmppath);
@ -1152,8 +1151,8 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def)
type = virStoragePoolTypeToString(def->type); type = virStoragePoolTypeToString(def->type);
if (!type) { if (!type) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"%s", _("unexpected pool type")); _("unexpected pool type"));
goto cleanup; goto cleanup;
} }
virBufferAsprintf(&buf, "<pool type='%s'>\n", type); virBufferAsprintf(&buf, "<pool type='%s'>\n", type);
@ -1217,8 +1216,8 @@ virStorageSize(const char *unit,
unsigned long long *ret) unsigned long long *ret)
{ {
if (virStrToLong_ull(val, NULL, 10, ret) < 0) { if (virStrToLong_ull(val, NULL, 10, ret) < 0) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("malformed capacity element")); _("malformed capacity element"));
return -1; return -1;
} }
/* off_t is signed, so you cannot create a file larger than 2**63 /* off_t is signed, so you cannot create a file larger than 2**63
@ -1251,8 +1250,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
ret->name = virXPathString("string(./name)", ctxt); ret->name = virXPathString("string(./name)", ctxt);
if (ret->name == NULL) { if (ret->name == NULL) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("missing volume name element")); _("missing volume name element"));
goto cleanup; goto cleanup;
} }
@ -1262,8 +1261,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
capacity = virXPathString("string(./capacity)", ctxt); capacity = virXPathString("string(./capacity)", ctxt);
unit = virXPathString("string(./capacity/@unit)", ctxt); unit = virXPathString("string(./capacity/@unit)", ctxt);
if (capacity == NULL) { if (capacity == NULL) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR, "%s",
"%s", _("missing capacity element")); _("missing capacity element"));
goto cleanup; goto cleanup;
} }
if (virStorageSize(unit, capacity, &ret->capacity) < 0) if (virStorageSize(unit, capacity, &ret->capacity) < 0)
@ -1663,8 +1662,8 @@ virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools,
} }
if (virMutexInit(&pool->lock) < 0) { if (virMutexInit(&pool->lock) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"%s", _("cannot initialize mutex")); _("cannot initialize mutex"));
VIR_FREE(pool); VIR_FREE(pool);
return NULL; return NULL;
} }
@ -1808,8 +1807,8 @@ virStoragePoolObjSaveDef(virStorageDriverStatePtr driver,
} }
if (!(xml = virStoragePoolDefFormat(def))) { if (!(xml = virStoragePoolDefFormat(def))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"%s", _("failed to generate XML")); _("failed to generate XML"));
return -1; return -1;
} }
@ -1871,8 +1870,8 @@ virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def)
type = virStoragePoolTypeToString(def->type); type = virStoragePoolTypeToString(def->type);
if (!type) { if (!type) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"%s", _("unexpected pool type")); _("unexpected pool type"));
goto cleanup; goto cleanup;
} }