On 11/01/2011 07:47 PM, Eric Blake wrote:
Qemu will be the first driver to make use of a typed string in the
next round of additions. Separate out the trivial addition.
* src/qemu/qemu_driver.c (qemudSupportsFeature): Advertise feature.
(qemuDomainGetBlkioParameters, qemuDomainGetMemoryParameters)
(qemuGetSchedulerParametersFlags, qemudDomainBlockStatsFlags):
Allow typed strings flag where trivially supported.
---
src/qemu/qemu_driver.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 37272e0..acb32d6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -920,6 +920,7 @@ qemudSupportsFeature (virConnectPtr conn ATTRIBUTE_UNUSED, int
feature)
case VIR_DRV_FEATURE_MIGRATION_P2P:
case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION:
case VIR_DRV_FEATURE_FD_PASSING:
+ case VIR_DRV_FEATURE_TYPED_PARAM_STRING:
return 1;
default:
return 0;
@@ -6041,9 +6042,13 @@ static int qemuDomainGetBlkioParameters(virDomainPtr dom,
bool isActive;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
- VIR_DOMAIN_AFFECT_CONFIG, -1);
+ VIR_DOMAIN_AFFECT_CONFIG |
+ VIR_TYPED_PARAM_STRING_OKAY, -1);
Here you seem to be mixing
flags of different 'enum types', though they
don't step on each other. Couldn't you make the
VIR_TYPED_PARAM_STRING_OKAY be of the same type as the
VIR_DOMAIN_AFFECT_LIVE?
Or do something like this here to prevent the two types of flags from
ever stepping on each other:
typedef enum {
VIR_TYPED_PARAM_STRING_OKAY = (VIR_DOMAIN_AFFECT_LAST<< 0),
} virTypedParameterFlags;
with VIR_DOMAIN_AFFECT_LAST = (1 << 2).
qemuDriverLock(driver);
+ /* We don't return strings, and thus trivially support this flag. */
+ flags&= ~VIR_TYPED_PARAM_STRING_OKAY;
+
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (vm == NULL) {
@@ -6336,10 +6341,14 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom,
bool isActive;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
- VIR_DOMAIN_AFFECT_CONFIG, -1);
+ VIR_DOMAIN_AFFECT_CONFIG |
+ VIR_TYPED_PARAM_STRING_OKAY, -1);
qemuDriverLock(driver);
+ /* We don't return strings, and thus trivially support this flag. */
+ flags&= ~VIR_TYPED_PARAM_STRING_OKAY;
+
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (vm == NULL) {
@@ -6883,10 +6892,14 @@ qemuGetSchedulerParametersFlags(virDomainPtr dom,
int saved_nparams = 0;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
- VIR_DOMAIN_AFFECT_CONFIG, -1);
+ VIR_DOMAIN_AFFECT_CONFIG |
+ VIR_TYPED_PARAM_STRING_OKAY, -1);
qemuDriverLock(driver);
+ /* We don't return strings, and thus trivially support this flag. */
+ flags&= ~VIR_TYPED_PARAM_STRING_OKAY;
+
if ((flags& (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG)) ==
(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG)) {
qemuReportError(VIR_ERR_INVALID_ARG, "%s",
@@ -7142,7 +7155,10 @@ qemuDomainBlockStatsFlags(virDomainPtr dom,
long long wr_total_times, flush_req, flush_total_times, errs;
virTypedParameterPtr param;
- virCheckFlags(0, -1);
+ virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
+
+ /* We don't return strings, and thus trivially support this flag. */
+ flags&= ~VIR_TYPED_PARAM_STRING_OKAY;
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
Rest looks
good. ACK