[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCHv5 7/9] Implement virDomain{G, S}etNumaParameters for the qemu driver



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 redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]