+Thu Oct 23 13:31:00 CEST 2008 Chris Lalancette <clalance@redhat.com>
+ * src/storage_backend.h src/storage_backend_disk.c
+ src/storage_backend_fs.c src/storage_backend_logical.c
+ src/storage_conf.c: Fix up a regression caused by the transition of
+ the storage backends to VIR_ENUM_IMPL. Before, we would accept
+ no format type, which would then use whatever the default for the pool
+ was. But the conversion caused this to instead cause a SEGFAULT,
+ which isn't good. Introduce a .defaultFormat parameter so that we
+ restore the previous behavior, although in a more generic format.
+
Wed Oct 22 09:53:00 EST 2008 Cole Robinson <crobinso@redhat.com>
* configure.in: Fix syntax error which was breaking RPM builds.
typedef virStorageBackendPoolOptions *virStorageBackendPoolOptionsPtr;
struct _virStorageBackendPoolOptions {
int flags;
+ int defaultFormat;
virStoragePoolFormatToString formatToString;
virStoragePoolFormatFromString formatFromString;
};
.poolOptions = {
.flags = (VIR_STORAGE_BACKEND_POOL_SOURCE_DEVICE),
+ .defaultFormat = VIR_STORAGE_POOL_DISK_UNKNOWN,
.formatFromString = virStorageBackendPartTableTypeFromString,
.formatToString = virStorageBackendPartTableTypeToString,
},
.poolOptions = {
.flags = (VIR_STORAGE_BACKEND_POOL_SOURCE_HOST |
VIR_STORAGE_BACKEND_POOL_SOURCE_DIR),
+ .defaultFormat = VIR_STORAGE_POOL_FS_AUTO,
.formatFromString = virStorageBackendFileSystemNetPoolTypeFromString,
.formatToString = virStorageBackendFileSystemNetPoolTypeToString,
},
.poolOptions = {
.flags = (VIR_STORAGE_BACKEND_POOL_SOURCE_NAME |
VIR_STORAGE_BACKEND_POOL_SOURCE_DEVICE),
+ .defaultFormat = VIR_STORAGE_POOL_LOGICAL_LVM2,
.formatFromString = virStorageBackendLogicalPoolTypeFromString,
.formatToString = virStorageBackendLogicalPoolTypeToString,
},
if (options->formatFromString) {
char *format = virXPathString(conn, "string(/pool/source/format/@type)", ctxt);
- if ((ret->source.format = (options->formatFromString)(format)) < 0) {
+ if (format == NULL)
+ ret->source.format = options->defaultFormat;
+ else
+ ret->source.format = options->formatFromString(format);
+
+ if (ret->source.format < 0) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
_("unknown pool format type %s"), format);
VIR_FREE(format);