From nobody Sun Feb 8 18:44:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1654087840; cv=none; d=zohomail.com; s=zohoarc; b=BibXOINeQs8RjL5rbaVVr2+DyV67WHVjp/9DMw0v7PHDMk5N/8GlGRaZwpALYEW5Qy6IUL4seYS2k9KLOj8TrjrsEUflGH2gGpla5Hiy3Y5qLpwv8jptGBFospCEwJ8fTkE5icOUoYXGF/+LTkoMRUVEKv/qpbg9DKPolJQmyzE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654087840; h=Content-Type:Content-Transfer-Encoding:Cc: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=g4PQGvL4+ybkL9Hu+XDz11YgJZ0A+F37degw4mqEAZQ=; b=Fw45JHl+3rHGbeP24ggkv0cxUVY92bldLottv/rhCwlKB30ZMdB7p97yKV8efekoX1hNbmySZxkJJ5aXl6pYTzZIcwjGqumQzWZFFlJ0gAlaYAWp9kbkxuQzih4N02QtjOeL9tgX/qbTzE+DfbwWH79WEsnkEtPZgqMTd6FwLZA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1654087840014330.3238396926239; Wed, 1 Jun 2022 05:50:40 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-597-x4GPMizINc2stJbF1Fu2_A-1; Wed, 01 Jun 2022 08:50:34 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2ACED180138B; Wed, 1 Jun 2022 12:50:30 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14E2940EC004; Wed, 1 Jun 2022 12:50:30 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8D8CD1947BA1; Wed, 1 Jun 2022 12:50:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DE0E61947B8C for ; Wed, 1 Jun 2022 12:50:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B28B0492C3B; Wed, 1 Jun 2022 12:50:27 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.227]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9184D40F06B; Wed, 1 Jun 2022 12:50:27 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 68774245B54; Wed, 1 Jun 2022 14:50:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654087838; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=g4PQGvL4+ybkL9Hu+XDz11YgJZ0A+F37degw4mqEAZQ=; b=WiNgnWc/8GJ1+r23/IL9v4Ngriyfb9ry3BUN0/JTn459isGDhd4MwITZd2szqJLluJszbB E7y6dPe+nOsPfBBrQcoskcUzy1p5NFurjB2KqrV2OaZlOOcN2I0eCPhKF6F+fxeoba/LYb bsBflqWqIg/kloAtqQxUi45dIvDJDUg= X-MC-Unique: x4GPMizINc2stJbF1Fu2_A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH v2 08/81] conf: Introduce virDomainObjIsPostcopy helper Date: Wed, 1 Jun 2022 14:49:08 +0200 Message-Id: <18a8c33002e83692f8143fbfe4163a4e8f1a1002.1654087150.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Krempa , Pavel Hrdina Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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) X-ZM-MESSAGEID: 1654087841645100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa Reviewed-by: Pavel Hrdina --- Notes: Version 2: - no change src/conf/domain_conf.c | 22 ++++++++++++++++++++++ src/conf/domain_conf.h | 4 ++++ src/libvirt_private.syms | 1 + 3 files changed, 27 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 34ecc7e7a9..05fd64b1c3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -29249,6 +29249,28 @@ virDomainObjIsFailedPostcopy(virDomainObj *dom) } =20 =20 +bool +virDomainObjIsPostcopy(virDomainObj *dom, + virDomainJobOperation op) +{ + if (op !=3D VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN && + op !=3D VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT) + return false; + + if (op =3D=3D VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN) { + return (dom->state.state =3D=3D VIR_DOMAIN_PAUSED && + dom->state.reason =3D=3D VIR_DOMAIN_PAUSED_POSTCOPY_FAILED= ) || + (dom->state.state =3D=3D VIR_DOMAIN_RUNNING && + (dom->state.reason =3D=3D VIR_DOMAIN_RUNNING_POSTCOPY || + dom->state.reason =3D=3D VIR_DOMAIN_RUNNING_POSTCOPY_FAIL= ED)); + } + + return dom->state.state =3D=3D VIR_DOMAIN_PAUSED && + (dom->state.reason =3D=3D VIR_DOMAIN_PAUSED_POSTCOPY || + dom->state.reason =3D=3D VIR_DOMAIN_PAUSED_POSTCOPY_FAILED); +} + + void virDomainObjSetState(virDomainObj *dom, virDomainState state, int reason) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index da85c6ecd4..1efdb439ac 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3889,6 +3889,10 @@ virDomainObjGetState(virDomainObj *obj, int *reason) bool virDomainObjIsFailedPostcopy(virDomainObj *obj) ATTRIBUTE_NONNULL(1); +bool +virDomainObjIsPostcopy(virDomainObj *dom, + virDomainJobOperation op) + ATTRIBUTE_NONNULL(1); =20 virSecurityLabelDef * virDomainDefGetSecurityLabelDef(const virDomainDef *def, const char *model= ); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 0c6dd4fa49..770dfe459a 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -578,6 +578,7 @@ virDomainObjGetOneDefState; virDomainObjGetPersistentDef; virDomainObjGetState; virDomainObjIsFailedPostcopy; +virDomainObjIsPostcopy; virDomainObjNew; virDomainObjParseFile; virDomainObjParseNode; --=20 2.35.1