mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
As suggested by danpb, to fix up the regression caused by last week's VIR_ENUM
cleanup patch, add a ".defaultFormat" member to .poolOptions. In storage_conf.c, if virXPathString(/pool/source/format/@type) returns NULL, then set the pool type to .defaultFormat; otherwise, lookup the type via formatFromString. Signed-off-by: Chris Lalancette <clalance@redhat.com>
This commit is contained in:
parent
6d035f67e0
commit
c0c0fb8eef
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
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.
|
||||
|
@ -77,6 +77,7 @@ typedef struct _virStorageBackendPoolOptions virStorageBackendPoolOptions;
|
||||
typedef virStorageBackendPoolOptions *virStorageBackendPoolOptionsPtr;
|
||||
struct _virStorageBackendPoolOptions {
|
||||
int flags;
|
||||
int defaultFormat;
|
||||
virStoragePoolFormatToString formatToString;
|
||||
virStoragePoolFormatFromString formatFromString;
|
||||
};
|
||||
|
@ -448,6 +448,7 @@ virStorageBackend virStorageBackendDisk = {
|
||||
|
||||
.poolOptions = {
|
||||
.flags = (VIR_STORAGE_BACKEND_POOL_SOURCE_DEVICE),
|
||||
.defaultFormat = VIR_STORAGE_POOL_DISK_UNKNOWN,
|
||||
.formatFromString = virStorageBackendPartTableTypeFromString,
|
||||
.formatToString = virStorageBackendPartTableTypeToString,
|
||||
},
|
||||
|
@ -1083,6 +1083,7 @@ virStorageBackend virStorageBackendNetFileSystem = {
|
||||
.poolOptions = {
|
||||
.flags = (VIR_STORAGE_BACKEND_POOL_SOURCE_HOST |
|
||||
VIR_STORAGE_BACKEND_POOL_SOURCE_DIR),
|
||||
.defaultFormat = VIR_STORAGE_POOL_FS_AUTO,
|
||||
.formatFromString = virStorageBackendFileSystemNetPoolTypeFromString,
|
||||
.formatToString = virStorageBackendFileSystemNetPoolTypeToString,
|
||||
},
|
||||
|
@ -616,6 +616,7 @@ virStorageBackend virStorageBackendLogical = {
|
||||
.poolOptions = {
|
||||
.flags = (VIR_STORAGE_BACKEND_POOL_SOURCE_NAME |
|
||||
VIR_STORAGE_BACKEND_POOL_SOURCE_DEVICE),
|
||||
.defaultFormat = VIR_STORAGE_POOL_LOGICAL_LVM2,
|
||||
.formatFromString = virStorageBackendLogicalPoolTypeFromString,
|
||||
.formatToString = virStorageBackendLogicalPoolTypeToString,
|
||||
},
|
||||
|
@ -275,7 +275,12 @@ virStoragePoolDefParseDoc(virConnectPtr conn,
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user