Another struct being moved to util. This one doesn't have as much use yet, thankfully. * src/conf/domain_conf.h (virDomainDiskSourcePoolMode) (virDomainDiskSourcePoolDef): Move... * src/util/virstoragefile.h (virStorageSourcePoolMode) (virStorageSourcePoolDef): ...and rename. * src/conf/domain_conf.c (virDomainDiskSourcePoolDefFree) (virDomainDiskSourceDefClear, virDomainDiskSourcePoolDefParse) (virDomainDiskDefParseXML, virDomainDiskSourceDefParse) (virDomainDiskSourceDefFormatInternal) (virDomainDiskDefForeachPath, virDomainDiskSourceIsBlockType): Adjust clients. * src/qemu/qemu_conf.c (qemuTranslateDiskSourcePool): Likewise. * src/libvirt_private.syms (domain_conf.h): Move symbols... (virstoragefile.h): ...as appropriate. Signed-off-by: Eric Blake <eblake@xxxxxxxxxx> --- src/conf/domain_conf.c | 23 +++++++++-------------- src/conf/domain_conf.h | 38 +++----------------------------------- src/libvirt_private.syms | 2 ++ src/qemu/qemu_conf.c | 10 +++++----- src/util/virstoragefile.c | 5 +++++ src/util/virstoragefile.h | 35 +++++++++++++++++++++++++++++++++++ 6 files changed, 59 insertions(+), 54 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 36149da..643b066 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -763,11 +763,6 @@ VIR_ENUM_IMPL(virDomainDiskDiscard, VIR_DOMAIN_DISK_DISCARD_LAST, "default", "unmap", "ignore") -VIR_ENUM_IMPL(virDomainDiskSourcePoolMode, - VIR_DOMAIN_DISK_SOURCE_POOL_MODE_LAST, - "default", - "host", - "direct") #define VIR_DOMAIN_XML_WRITE_FLAGS VIR_DOMAIN_XML_SECURE #define VIR_DOMAIN_XML_READ_FLAGS VIR_DOMAIN_XML_INACTIVE @@ -1190,7 +1185,7 @@ void virDomainLeaseDefFree(virDomainLeaseDefPtr def) } static void -virDomainDiskSourcePoolDefFree(virDomainDiskSourcePoolDefPtr def) +virDomainDiskSourcePoolDefFree(virStorageSourcePoolDefPtr def) { if (!def) return; @@ -4964,10 +4959,10 @@ virDomainLeaseDefParseXML(xmlNodePtr node) static int virDomainDiskSourcePoolDefParse(xmlNodePtr node, - virDomainDiskSourcePoolDefPtr *srcpool) + virStorageSourcePoolDefPtr *srcpool) { char *mode = NULL; - virDomainDiskSourcePoolDefPtr source; + virStorageSourcePoolDefPtr source; int ret = -1; *srcpool = NULL; @@ -4993,7 +4988,7 @@ virDomainDiskSourcePoolDefParse(xmlNodePtr node, } if (mode && - (source->mode = virDomainDiskSourcePoolModeTypeFromString(mode)) <= 0) { + (source->mode = virStorageSourcePoolModeTypeFromString(mode)) <= 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown source mode '%s' for volume type disk"), mode); @@ -5018,7 +5013,7 @@ virDomainDiskSourceDefParse(xmlNodePtr node, int *proto, size_t *nhosts, virStorageNetHostDefPtr *hosts, - virDomainDiskSourcePoolDefPtr *srcpool) + virStorageSourcePoolDefPtr *srcpool) { char *protocol = NULL; char *transport = NULL; @@ -14761,7 +14756,7 @@ virDomainDiskSourceDefFormatInternal(virBufferPtr buf, virStorageNetHostDefPtr hosts, size_t nseclabels, virSecurityDeviceLabelDefPtr *seclabels, - virDomainDiskSourcePoolDefPtr srcpool, + virStorageSourcePoolDefPtr srcpool, unsigned int flags) { size_t n; @@ -14831,7 +14826,7 @@ virDomainDiskSourceDefFormatInternal(virBufferPtr buf, srcpool->pool, srcpool->volume); if (srcpool->mode) virBufferAsprintf(buf, " mode='%s'", - virDomainDiskSourcePoolModeTypeToString(srcpool->mode)); + virStorageSourcePoolModeTypeToString(srcpool->mode)); } virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy); @@ -18530,7 +18525,7 @@ virDomainDiskDefForeachPath(virDomainDiskDefPtr disk, if (!path || type == VIR_STORAGE_TYPE_NETWORK || (type == VIR_STORAGE_TYPE_VOLUME && disk->src.srcpool && - disk->src.srcpool->mode == VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT)) + disk->src.srcpool->mode == VIR_STORAGE_SOURCE_POOL_MODE_DIRECT)) return 0; if (iter(disk, path, 0, opaque) < 0) @@ -19392,7 +19387,7 @@ virDomainDiskSourceIsBlockType(virDomainDiskDefPtr def) * (e.g. set sgio=filtered|unfiltered for it) in libvirt. */ if (def->src.srcpool->pooltype == VIR_STORAGE_POOL_ISCSI && - def->src.srcpool->mode == VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT) + def->src.srcpool->mode == VIR_STORAGE_SOURCE_POOL_MODE_DIRECT) return false; return true; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b2eeefd..e5d945f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -602,37 +602,6 @@ struct _virDomainBlockIoTuneInfo { }; typedef virDomainBlockIoTuneInfo *virDomainBlockIoTuneInfoPtr; -/* - * Used for volume "type" disk to indicate how to represent - * the disk source if the specified "pool" is of iscsi type. - */ -enum virDomainDiskSourcePoolMode { - VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DEFAULT = 0, - - /* Use the path as it shows up on host, e.g. - * /dev/disk/by-path/ip-$ip-iscsi-$iqn:iscsi.iscsi-pool0-lun-1 - */ - VIR_DOMAIN_DISK_SOURCE_POOL_MODE_HOST, - - /* Use the URI from the storage pool source element host attribute. E.g. - * file=iscsi://demo.org:6000/iqn.1992-01.com.example/1. - */ - VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT, - - VIR_DOMAIN_DISK_SOURCE_POOL_MODE_LAST -}; - -typedef struct _virDomainDiskSourcePoolDef virDomainDiskSourcePoolDef; -struct _virDomainDiskSourcePoolDef { - char *pool; /* pool name */ - char *volume; /* volume name */ - int voltype; /* enum virStorageVolType, internal only */ - int pooltype; /* enum virStoragePoolType, internal only */ - int actualtype; /* enum virStorageType, internal only */ - int mode; /* enum virDomainDiskSourcePoolMode */ -}; -typedef virDomainDiskSourcePoolDef *virDomainDiskSourcePoolDefPtr; - typedef struct _virDomainDiskSourceDef virDomainDiskSourceDef; typedef virDomainDiskSourceDef *virDomainDiskSourceDefPtr; @@ -645,7 +614,7 @@ struct _virDomainDiskSourceDef { int protocol; /* enum virStorageNetProtocol */ size_t nhosts; virStorageNetHostDefPtr hosts; - virDomainDiskSourcePoolDefPtr srcpool; + virStorageSourcePoolDefPtr srcpool; struct { char *username; int secretType; /* enum virDomainDiskSecretType */ @@ -2347,7 +2316,7 @@ int virDomainDiskSourceDefFormatInternal(virBufferPtr buf, virStorageNetHostDefPtr hosts, size_t nseclabels, virSecurityDeviceLabelDefPtr *seclabels, - virDomainDiskSourcePoolDefPtr srcpool, + virStorageSourcePoolDefPtr srcpool, unsigned int flags); int virDomainNetDefFormat(virBufferPtr buf, @@ -2401,7 +2370,7 @@ int virDomainDiskSourceDefParse(xmlNodePtr node, int *proto, size_t *nhosts, virStorageNetHostDefPtr *hosts, - virDomainDiskSourcePoolDefPtr *srcpool); + virStorageSourcePoolDefPtr *srcpool); bool virDomainHasDiskMirror(virDomainObjPtr vm); @@ -2623,7 +2592,6 @@ VIR_ENUM_DECL(virDomainDiskSecretType) VIR_ENUM_DECL(virDomainDeviceSGIO) VIR_ENUM_DECL(virDomainDiskTray) VIR_ENUM_DECL(virDomainDiskDiscard) -VIR_ENUM_DECL(virDomainDiskSourcePoolMode) VIR_ENUM_DECL(virDomainIoEventFd) VIR_ENUM_DECL(virDomainVirtioEventIdx) VIR_ENUM_DECL(virDomainDiskCopyOnRead) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 60c2d44..da70ee3 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1840,6 +1840,8 @@ virStorageNetHostDefFree; virStorageNetHostTransportTypeFromString; virStorageNetHostTransportTypeToString; virStorageNetProtocolTypeToString; +virStorageSourcePoolModeTypeFromString; +virStorageSourcePoolModeTypeToString; virStorageTypeFromString; virStorageTypeToString; diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 0f33553..96a2caf 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1364,17 +1364,17 @@ qemuTranslateDiskSourcePool(virConnectPtr conn, } switch (def->src.srcpool->mode) { - case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DEFAULT: - case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_LAST: - def->src.srcpool->mode = VIR_DOMAIN_DISK_SOURCE_POOL_MODE_HOST; + case VIR_STORAGE_SOURCE_POOL_MODE_DEFAULT: + case VIR_STORAGE_SOURCE_POOL_MODE_LAST: + def->src.srcpool->mode = VIR_STORAGE_SOURCE_POOL_MODE_HOST; /* fallthrough */ - case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_HOST: + case VIR_STORAGE_SOURCE_POOL_MODE_HOST: def->src.srcpool->actualtype = VIR_STORAGE_TYPE_BLOCK; if (!(def->src.path = virStorageVolGetPath(vol))) goto cleanup; break; - case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT: + case VIR_STORAGE_SOURCE_POOL_MODE_DIRECT: def->src.srcpool->actualtype = VIR_STORAGE_TYPE_NETWORK; def->src.protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI; diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 2ed5617..e1b69ec 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -90,6 +90,11 @@ VIR_ENUM_IMPL(virStorageNetHostTransport, VIR_STORAGE_NET_HOST_TRANS_LAST, "unix", "rdma") +VIR_ENUM_IMPL(virStorageSourcePoolMode, + VIR_STORAGE_SOURCE_POOL_MODE_LAST, + "default", + "host", + "direct") enum lv_endian { LV_LITTLE_ENDIAN = 1, /* 1234 */ diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index fccf0b9..81d6954 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -137,6 +137,41 @@ struct _virStorageNetHostDef { char *socket; /* path to unix socket */ }; +/* Information for a storage volume from a virStoragePool */ + +/* + * Used for volume "type" disk to indicate how to represent + * the disk source if the specified "pool" is of iscsi type. + */ +enum virStorageSourcePoolMode { + VIR_STORAGE_SOURCE_POOL_MODE_DEFAULT = 0, + + /* Use the path as it shows up on host, e.g. + * /dev/disk/by-path/ip-$ip-iscsi-$iqn:iscsi.iscsi-pool0-lun-1 + */ + VIR_STORAGE_SOURCE_POOL_MODE_HOST, + + /* Use the URI from the storage pool source element host attribute. E.g. + * file=iscsi://demo.org:6000/iqn.1992-01.com.example/1. + */ + VIR_STORAGE_SOURCE_POOL_MODE_DIRECT, + + VIR_STORAGE_SOURCE_POOL_MODE_LAST +}; + +VIR_ENUM_DECL(virStorageSourcePoolMode) + +typedef struct _virStorageSourcePoolDef virStorageSourcePoolDef; +struct _virStorageSourcePoolDef { + char *pool; /* pool name */ + char *volume; /* volume name */ + int voltype; /* enum virStorageVolType, internal only */ + int pooltype; /* enum virStoragePoolType, internal only */ + int actualtype; /* enum virStorageType, internal only */ + int mode; /* enum virStorageSourcePoolMode */ +}; +typedef virStorageSourcePoolDef *virStorageSourcePoolDefPtr; + # ifndef DEV_BSIZE # define DEV_BSIZE 512 -- 1.9.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list