From nobody Wed Dec 17 04:38:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=smartx.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1739608718449105.21960053088742; Sat, 15 Feb 2025 00:38:38 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 6233F1D4F; Sat, 15 Feb 2025 03:38:37 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 83C2B1E73; Sat, 15 Feb 2025 03:37:12 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 436AE1D92; Sat, 15 Feb 2025 03:37:05 -0500 (EST) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 902921D13 for ; Sat, 15 Feb 2025 03:37:04 -0500 (EST) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-22100006bc8so14989605ad.0 for ; Sat, 15 Feb 2025 00:37:04 -0800 (PST) Received: from Hyman-Dev-Euler.zelin.local ([154.64.226.178]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-220d55866ecsm39797445ad.212.2025.02.15.00.37.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Feb 2025 00:37:03 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20230601.gappssmtp.com; s=20230601; t=1739608623; x=1740213423; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pNxrXWWjg0dEQzcdZi6TSl67nsz9LvYI1mVhal9mmNw=; b=1Gc83Lz9CRIT6Nki0sKRloATqCRe4YynZBPBIj4a1fb4f52pepttCmYl3fEwK5DcQE NeehXmRGHuo3ixrPAn29/0O45EnPthIVHnhxcMue1ZuX4w9bRxwzEl3lmdq8FRe/nRQC ibfO5WoYOTuWXupYunU9eMV9707IUc82E3S2vLWKsBGorYfAwn+Fn3+ecTjtEpIJlukB 7Efy5KLazS5l+hzeAYmD3JLj3wCQlBH+4Nxnqp2vMYT+m97AHNpGgrgmWUGiiFUmITcM uPqOxEi6zymVUnQgG19YdP6t14y+P+kbFelrn62R1CHgpV3t895PUgk3e4X2YqYFqBxE ktWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739608623; x=1740213423; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pNxrXWWjg0dEQzcdZi6TSl67nsz9LvYI1mVhal9mmNw=; b=qvasQ69dFwR9PTRvc8r7KRhUIhnvJdzU5FsXpEc+iLTwpqqJR5jCdtFDDpM4HP3H3a ok2/NCZfhffwW+mVEj/nms5czN3xt0D4nB3yt2R5bYjUy8E9a+RghDn27jOMM27VlVCA L6IMF9pky1CSLwo3GBiXgA2b2gUygUJqMFce0Pc5oH6JG8G4lfSNLdKmJ8FAv+ST+myA /6zYERiEnAWMqh0ap0B0p42XxQN6KGiJwWMjaEQOZ1YDw5NcqqBD4OAd40y948yYi+xI D/UhF9oB4hFAZVPkCJ+4r4J4zp30X3bEnVCNQCb3PnitX5qWWU2tGaO5F7nYoSIZY18n uLEA== X-Gm-Message-State: AOJu0Yx1NZiTPRnAhqdTuKTv/92eEsuRlAqKMWr3dlxJ+spxOplaib7g gbOsI2PIHzjx8spC89brsfmuw4FIsQnrlznKNoHjuSI8dF/vAs8x+Fw2cKhKtJRI1kLZhbk7C7B QYqPvpw== X-Gm-Gg: ASbGnctDt6ufukhGHqcxquHS3ejW5Boz8/P/DmriAD+YPEuXBd01Ya40W1VZDaOhpTf 8IzVphqfWGhqDKqDQIRyeF8im9+K7otPVdcGdLHQzsqmwmAlARr3L1IJi/cueN3AAc2CxmkwCx6 XP62o3X7QBmhrDbEFn8dJU7k43q+39z6x+V9HhKSLYj9L37F8RA4fXLerZZXH9grz/W4JMCDZZK pMOXW0KUB4f79ikil1D93RMANL8m+bR2fqme7+roYfq7lVN3PmFhfP6kE5SByhR6fEwLKZpCAQO w8Zp1O9dMek5t2H4l52EDY0ypyha6skyMUB7GZTd X-Google-Smtp-Source: AGHT+IFO8/qc7myUaF1ThDbhtUR1Fxwrev/PyE/Uw1Nui2Q4tRMO9oCmCuEBDTLlKSzaXMXioVlbjQ== X-Received: by 2002:a17:902:d502:b0:21f:4c8b:c514 with SMTP id d9443c01a7336-221040ce543mr36845195ad.45.1739608623267; Sat, 15 Feb 2025 00:37:03 -0800 (PST) From: yong.huang@smartx.com To: devel@lists.libvirt.org Subject: [PATCH v1 3/3] virsh: Use the new API to implement cmdSetvcpu Date: Sat, 15 Feb 2025 16:35:53 +0800 Message-Id: <1343c6dc19acecfdb282e68383303bd4fb8da80c.1739608445.git.yong.huang@smartx.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 74TDMLTSWHURIPA7S6VUYLR3WOYEG4AM X-Message-ID-Hash: 74TDMLTSWHURIPA7S6VUYLR3WOYEG4AM X-MailFrom: yong.huang@smartx.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: yong.huang@smartx.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1739608719695019100 Content-Type: text/plain; charset="utf-8" From: Hyman Huang Signed-off-by: Hyman Huang --- tools/virsh-domain.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index f3da2f903f..83db56460b 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -7345,6 +7345,7 @@ cmdSetvcpu(vshControl *ctl, const vshCmd *cmd) const char *vcpulist =3D NULL; int state =3D 0; unsigned int flags =3D VIR_DOMAIN_AFFECT_CURRENT; + virTypedParameterPtr params =3D NULL; =20 VSH_EXCLUSIVE_OPTIONS_VAR(enable, disable); =20 @@ -7370,7 +7371,14 @@ cmdSetvcpu(vshControl *ctl, const vshCmd *cmd) if (enable) state =3D 1; =20 - if (virDomainSetVcpu(dom, vcpulist, state, flags) < 0) + params =3D g_new0(virTypedParameter, 1); + if (virTypedParameterAssign(¶ms[0], + VIR_DOMAIN_VCPU_STATE, + VIR_TYPED_PARAM_INT, + state) < 0) + return false; + + if (virDomainSetVcpuTuneParameters(dom, vcpulist, params, 1, flags) < = 0) return false; =20 return true; --=20 2.27.0