diff --git a/ChangeLog b/ChangeLog index eefc6664ea..97acbd041a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Oct 21 19:18:00 CEST 2008 Chris Lalancette + * src/storage_conf.c: Make sure to set errors on paths where + ->formatToString() or ->formatFromString() fail. + Tue Oct 21 19:13:00 CEST 2008 Chris Lalancette * src/qemu_driver.c src/storage_conf.c src/network_driver.c src/storage_driver.c: Shore up the uses of virGetLastError() so that diff --git a/src/storage_conf.c b/src/storage_conf.c index 23e7538f0c..792e740ff4 100644 --- a/src/storage_conf.c +++ b/src/storage_conf.c @@ -276,6 +276,8 @@ virStoragePoolDefParseDoc(virConnectPtr conn, if (options->formatFromString) { char *format = virXPathString(conn, "string(/pool/source/format/@type)", ctxt); if ((ret->source.format = (options->formatFromString)(format)) < 0) { + virStorageReportError(conn, VIR_ERR_XML_ERROR, + _("unknown pool format type %s"), format); VIR_FREE(format); goto cleanup; } @@ -521,8 +523,12 @@ virStoragePoolDefFormat(virConnectPtr conn, if (options->formatToString) { const char *format = (options->formatToString)(def->source.format); - if (!format) + if (!format) { + virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, + _("unknown pool format number %d"), + def->source.format); goto cleanup; + } virBufferVSprintf(&buf," \n", format); } @@ -751,6 +757,8 @@ virStorageVolDefParseDoc(virConnectPtr conn, if (options->formatFromString) { char *format = virXPathString(conn, "string(/volume/target/format/@type)", ctxt); if ((ret->target.format = (options->formatFromString)(format)) < 0) { + virStorageReportError(conn, VIR_ERR_XML_ERROR, + _("unknown volume format type %s"), format); VIR_FREE(format); goto cleanup; } @@ -885,8 +893,12 @@ virStorageVolDefFormat(virConnectPtr conn, if (options->formatToString) { const char *format = (options->formatToString)(def->target.format); - if (!format) + if (!format) { + virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, + _("unknown volume format number %d"), + def->target.format); goto cleanup; + } virBufferVSprintf(&buf," \n", format); }