[libvirt] [PATCHv5 7/9] Implement virDomain{G, S}etNumaParameters for the qemu driver
Eric Blake
eblake at redhat.com
Tue Dec 20 18:01:21 UTC 2011
On 12/20/2011 01:35 AM, Hu Tao wrote:
> static int
> +qemuDomainSetNumaParameters(virDomainPtr dom,
> + virTypedParameterPtr params,
> + int nparams,
> + unsigned int flags)
> +{
> + if (STREQ(param->field, VIR_DOMAIN_NUMA_MODE)) {
> + if (param->type != VIR_TYPED_PARAM_INT) {
> + qemuReportError(VIR_ERR_INVALID_ARG, "%s",
> + _("invalid type for numa strict tunable, "
> + "expected an 'int'"));
> + ret = -1;
> + continue;
> + }
> +
> + if (flags & VIR_DOMAIN_AFFECT_LIVE) {
> + qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
> + _("can't change numa mode for running domain"));
> + ret = -1;
> + goto cleanup;
> + }
One minor tweak - we should allow the user to re-specify the mode that
is already present.
> +static int
> +qemuDomainGetNumaParameters(virDomainPtr dom,
> + virTypedParameterPtr params,
> + int *nparams,
> + unsigned int flags)
> +{
> + struct qemud_driver *driver = dom->conn->privateData;
> + int i;
> + virCgroupPtr group = NULL;
> + virDomainObjPtr vm = NULL;
> + virDomainDefPtr persistentDef = NULL;
> + char *nodeset = NULL;
> + int ret = -1;
> + int rc;
> +
> + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
> + VIR_DOMAIN_AFFECT_CONFIG |
> + VIR_TYPED_PARAM_STRING_OKAY, -1);
> +
> + qemuDriverLock(driver);
> +
> + /* We blindly return a string, and let libvirt.c and
> + * remote_driver.c do the filtering on behalf of older clients
> + * that can't parse it. */
> + flags &= ~VIR_TYPED_PARAM_STRING_OKAY;
I just realized this comment is not technically necessary - since the
new numa parameters API itself post-dates the addition of
VIR_TYPED_PARAM_STRING_OKAY, there is no older client that can't handle
the return of a string. But I'm keeping it unchanged, as it is
consistent with the blkiotune where the comment is indeed valid.
diff --git i/src/qemu/qemu_driver.c w/src/qemu/qemu_driver.c
index bb03c5c..176a324 100644
--- i/src/qemu/qemu_driver.c
+++ w/src/qemu/qemu_driver.c
@@ -6661,7 +6661,8 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
continue;
}
- if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+ if ((flags & VIR_DOMAIN_AFFECT_LIVE) &&
+ vm->def->numatune.memory.mode != params[i].value.i) {
qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("can't change numa mode for running
domain"));
ret = -1;
--
Eric Blake eblake at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111220/9a26d877/attachment-0001.sig>
More information about the libvir-list
mailing list