Express the default disk type as an enum, for easier handling. * src/conf/capabilities.h (_virCaps): Store enum rather than string for disk type. * src/conf/domain_conf.c (virDomainDiskDefParseXML): Adjust clients. * src/qemu/qemu_driver.c (qemuCreateCapabilities): Likewise. --- src/conf/capabilities.h | 4 ++-- src/conf/domain_conf.c | 6 ++++-- src/qemu/qemu_driver.c | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h index 0d56290..99056f8 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -1,7 +1,7 @@ /* * capabilities.h: hypervisor capabilities * - * Copyright (C) 2006-2008, 2010 Red Hat, Inc. + * Copyright (C) 2006-2008, 2010, 2012 Red Hat, Inc. * Copyright (C) 2006-2008 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -149,7 +149,7 @@ struct _virCaps { unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN]; unsigned int emulatorRequired : 1; const char *defaultDiskDriverName; - const char *defaultDiskDriverType; + int defaultDiskDriverType; /* enum virStorageFileFormat */ int (*defaultConsoleTargetType)(const char *ostype); void *(*privateDataAllocFunc)(void); void (*privateDataFreeFunc)(void *); diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 52e8f6c..70e3b53 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4160,7 +4160,8 @@ virDomainDiskDefParseXML(virCapsPtr caps, if (!def->driverType && caps->defaultDiskDriverType && - !(def->driverType = strdup(caps->defaultDiskDriverType))) + !(def->driverType = strdup(virStorageFileFormatTypeToString( + caps->defaultDiskDriverType)))) goto no_memory; if (!def->driverName && @@ -4171,7 +4172,8 @@ virDomainDiskDefParseXML(virCapsPtr caps, if (def->mirror && !def->mirrorFormat && caps->defaultDiskDriverType && - !(def->mirrorFormat = strdup(caps->defaultDiskDriverType))) + !(def->mirrorFormat = strdup(virStorageFileFormatTypeToString( + caps->defaultDiskDriverType)))) goto no_memory; if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0e4b2d0..f514199 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -394,10 +394,10 @@ qemuCreateCapabilities(struct qemud_driver *driver) if (driver->allowDiskFormatProbing) { caps->defaultDiskDriverName = NULL; - caps->defaultDiskDriverType = NULL; + caps->defaultDiskDriverType = VIR_STORAGE_FILE_AUTO; } else { caps->defaultDiskDriverName = "qemu"; - caps->defaultDiskDriverType = "raw"; + caps->defaultDiskDriverType = VIR_STORAGE_FILE_RAW; } qemuDomainSetPrivateDataHooks(caps); -- 1.7.11.7 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list