From nobody Fri Mar 29 02:40:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1562843104; cv=none; d=zoho.com; s=zohoarc; b=UFPXkbGpOXNxmUAbAdkLkj9gUvaYqtrBcd3TShL3CQp2x8EwRMi5NXpMLSdpDxrGtcHbDUyiitSq4Rx5dXTDxOcnCeUDzPdBcGoxRNF24JDJ3qdvBtpNzoZfN6n4m28ZtDo5RhK67uLxCxrvQRgeZGGSzZYy/ybHI0+Dkc4nq9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562843104; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=q7qcrrdvWd6aJOoS+vZV7ug/oMEoeOdel2JJy02nlcI=; b=oc+CW2oHjPNur4XOQBjrpe8diUS2vanKLSfqvllvEzpSQB2rjeRxDrUQyWSh5cgvJyGZfbCHezyPLReKdT1ZQr6z3YYk5s7FzIXbLrRCCFmPBMclud5w3cKrOYgA4JuhYZgwVLINYcK5HSrtbYpipSkfcZ9qZcSjKPIP4zpNCjw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1562843104853497.50662225265523; Thu, 11 Jul 2019 04:05:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D6F523082AF2; Thu, 11 Jul 2019 11:05:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 867D588F9; Thu, 11 Jul 2019 11:05:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A93A754D3D; Thu, 11 Jul 2019 11:05:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6BB50pV025006 for ; Thu, 11 Jul 2019 07:05:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8497C60605; Thu, 11 Jul 2019 11:05:00 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D33D60603 for ; Thu, 11 Jul 2019 11:04:58 +0000 (UTC) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 10B05C049598 for ; Thu, 11 Jul 2019 11:04:57 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id s15so5264886wmj.3 for ; Thu, 11 Jul 2019 04:04:56 -0700 (PDT) Received: from archpc.localdomain (x8d1ee222.agdsn.tu-dresden.de. [141.30.226.34]) by smtp.gmail.com with ESMTPSA id t140sm6941271wmt.0.2019.07.11.04.04.51 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 11 Jul 2019 04:04:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=iLusx4kKAya53515iUOZku1G+disXvJ4AVz5Vs4Nhmg=; b=aE2kskFX2j7rBZ8aBdA8ELz4dDkZ1LLPZMgFtT6215xbJK0lTdfnWXPQzLjmRCafyL KgBfztpNlDvn3hcYeAsTL0Tjtx05j4GD6db4ZEzv/QqjU7war45Hj+XoUZJPg4pTMFdN wqGF/GLdYj2wl0XC6vV00bxZKUsGtAG/SRmZQhi+G5Sfxm8Oi60GNswayu1rREIXML5w NXpStv02Sc4NcQyN2/tTBT8Yr87XFa2NNOthSI5pCVazYoMUQAjr0zMxXxJjyHQDlNkW WO3X79dskH2U/ZZaXHtcOieAOdRsOg1I2Ff/xx6lD75p9h1YFGoxShidJSJ/UHRTY+KQ GMrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=iLusx4kKAya53515iUOZku1G+disXvJ4AVz5Vs4Nhmg=; b=jAuyZ7SjePm/pZHVPLWefIOpMh+OGdEbfJhd2uEvB+STkffH75OEXvpCMQB5pwSBac mE/KGLB3k4B/fkqsSWIkB2TnQ7wYRwuo7XoeryMC6GXRSGxZhYZjbHUuJccu1Gro84MT qeeqfQ8I5hX/g1FHdveYMOdQ92yAKOiQMOwMt5765+bpgktmYQvwgoLffDwBbjm1rwRe poMnRsOvvEoouji6lpqCBxTZY89cwOMSHR0NREDjfPX05408AFeJaFEShNvrv1H2f8FP pdYNdnjJetcH3uwW3nb0w0bm+b4Egy4BycomaW8HhRzi7sshl0IsDscP3CcQXBw8koTj t8Gg== X-Gm-Message-State: APjAAAXv2xzH7iuVc0ctClPa66RAu6qJ+82gPcx5YsBOzV8A8vgB27Df ALhl4I/TgmH5GSfYmFqMy1LECs5NaMo= X-Google-Smtp-Source: APXvYqyhVW0IZWknJ59YweE3SVynzvv/mGd/yBsEvXRk4UqzauuH4k6G7TywFYzTboeE9MEDJ0Z66Q== X-Received: by 2002:a1c:a101:: with SMTP id k1mr3872757wme.98.1562843095023; Thu, 11 Jul 2019 04:04:55 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Thu, 11 Jul 2019 13:04:50 +0200 Message-Id: <20190711110450.16444-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 11 Jul 2019 11:04:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 11 Jul 2019 11:04:57 +0000 (UTC) for IP:'209.85.128.66' DOMAIN:'mail-wm1-f66.google.com' HELO:'mail-wm1-f66.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.195 * (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, PDS_NO_HELO_DNS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 209.85.128.66 mail-wm1-f66.google.com 209.85.128.66 mail-wm1-f66.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] test_driver: consider flags in testDomainSetMemoryFlags X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 11 Jul 2019 11:05:03 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Update the current or max memory, on the persistent or live definition depending on the flags which are currently ignored. Signed-off-by: Ilias Stamatis --- src/test/test_driver.c | 51 +++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index c10344f6cd..90910060ed 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2473,24 +2473,59 @@ static int testDomainSetMemoryFlags(virDomainPtr do= main, unsigned long memory, unsigned int flags) { - virDomainObjPtr privdom; + virDomainObjPtr vm; + virDomainDefPtr def; int ret =3D -1; - virCheckFlags(0, -1); + virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | + VIR_DOMAIN_AFFECT_CONFIG | + VIR_DOMAIN_MEM_MAXIMUM, -1); - if (!(privdom =3D testDomObjFromDomain(domain))) + if (!(vm =3D testDomObjFromDomain(domain))) return -1; - if (memory > virDomainDefGetMemoryTotal(privdom->def)) { - virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); + if (!(def =3D virDomainObjGetOneDef(vm, flags))) goto cleanup; + + if (flags & VIR_DOMAIN_MEM_MAXIMUM) { + if (virDomainObjCheckActive(vm)) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot resize the maximum memory on an " + "active domain")); + goto cleanup; + } + + if (virDomainNumaGetNodeCount(def->numa) > 0) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("initial memory size of a domain with NUMA " + "nodes cannot be modified with this API")); + goto cleanup; + } + + if (def->mem.max_memory && def->mem.max_memory < memory) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot set initial memory size greater than " + "the maximum memory size")); + goto cleanup; + } + + virDomainDefSetMemoryTotal(def, memory); + + if (def->mem.cur_balloon > memory) + def->mem.cur_balloon =3D memory; + } else { + if (memory > virDomainDefGetMemoryTotal(def)) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("cannot set memory higher than max memory")); + goto cleanup; + } + + def->mem.cur_balloon =3D memory; } - privdom->def->mem.cur_balloon =3D memory; ret =3D 0; - cleanup: - virDomainObjEndAPI(&privdom); + virDomainObjEndAPI(&vm); return ret; } -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list