From nobody Sun Feb 8 12:43:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1603295167; cv=none; d=zohomail.com; s=zohoarc; b=SvlWHOL8rEzgJm4EBvGstMmEhH0B7LOeeh7/iXSTDt88qDVV7OWfqL3QQ271xKFXy0MTAikPDlRrsBYVbzDqcGhwmu2EpoEYIQzLmgapBgiqf/TtLbxt/1/LC+b2zV50XK1wceX2dwNmx5aWr3XauFYEruminrI4oDlwNFOoPaU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603295167; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=U0plIM1/OJAa+dTCn2YFUTyLeCoVCZMOBdG5++pED4k=; b=gRuqSyUUDHPooKBaywTD5gw6XOhfkitmebCTGAEO3bTAOsINikPzni2Ps7T31u9FyMtbc2p0HYTrEq2AqSZcnuV2e3zueP5WriNO2KYfwLVeLOIYLPYi4/a5fDOB/9gqcAL/43gaaAl7EltQX7EA7wJgPmzBXNsG+P3V1Mq/pto= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603295167195738.7522457242104; Wed, 21 Oct 2020 08:46:07 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-349-DdhjOvezP1qK6SxkF-C9Mw-1; Wed, 21 Oct 2020 11:45:28 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DAA12AD746; Wed, 21 Oct 2020 15:45:22 +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 3290A1002C0C; Wed, 21 Oct 2020 15:45:22 +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 EB953922E1; Wed, 21 Oct 2020 15:45:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09LFj09X032103 for ; Wed, 21 Oct 2020 11:45:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 519A55C26A; Wed, 21 Oct 2020 15:45:00 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.139]) by smtp.corp.redhat.com (Postfix) with ESMTP id C78E55C269 for ; Wed, 21 Oct 2020 15:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603295166; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=U0plIM1/OJAa+dTCn2YFUTyLeCoVCZMOBdG5++pED4k=; b=Jnf7C+vJd3Hbjnb8qmvWn2bpbM69f+El4wmLDvYFTFhDuM10orDOf5QgZiqAhkAuWYDkD/ OUqMEzqIACF3916WCxUB6+qD9hJG2lYrXo8p5dtKStEjgRsi8HXolylRShFkZhsJB1L2VA 5WS9HFCOPzes6DWO+/yVhoJ9V0AB+1A= X-MC-Unique: DdhjOvezP1qK6SxkF-C9Mw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/4] hyperv: Use hypervRequestStateChange() in hypervDomainSuspend() Date: Wed, 21 Oct 2020 17:44:51 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" A few commits ago, hypervRequestStateChange() helper was introduced which has exactly the same code as a part of hypervDomainSuspend(). Deduplicate by calling the helper. Signed-off-by: Michal Privoznik --- src/hyperv/hyperv_driver.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 4b198f5b95..d08b6cff2e 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -893,9 +893,7 @@ hypervDomainLookupByName(virConnectPtr conn, const char= *name) static int hypervDomainSuspend(virDomainPtr domain) { - int result =3D -1; hypervPrivate *priv =3D domain->conn->privateData; - Msvm_ComputerSystem *computerSystem =3D NULL; int requestedState =3D -1; =20 switch (priv->wmiVersion) { @@ -907,20 +905,7 @@ hypervDomainSuspend(virDomainPtr domain) break; } =20 - if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) - goto cleanup; - - if (computerSystem->data.common->EnabledState !=3D MSVM_COMPUTERSYSTEM= _ENABLEDSTATE_ENABLED) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not a= ctive")); - goto cleanup; - } - - result =3D hypervInvokeMsvmComputerSystemRequestStateChange(domain, re= questedState); - - cleanup: - hypervFreeObject(priv, (hypervObject *)computerSystem); - - return result; + return hypervRequestStateChange(domain, requestedState); } =20 =20 --=20 2.26.2