From nobody Thu Sep 19 16:41:48 2024 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=linux.microsoft.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 172286906419181.62241437167427; Mon, 5 Aug 2024 07:44:24 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EAB9BD45; Mon, 5 Aug 2024 10:44:22 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id D57B7125B; Mon, 5 Aug 2024 10:41:24 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id F2FCFB37; Mon, 5 Aug 2024 10:41:06 -0400 (EDT) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lists.libvirt.org (Postfix) with ESMTP id 882C8B31 for ; Mon, 5 Aug 2024 10:41:06 -0400 (EDT) Received: from paekkaladevi-dev-u22.gi4irqh5pfqublruu4yyku2wof.phxx.internal.cloudapp.net (unknown [20.125.125.171]) by linux.microsoft.com (Postfix) with ESMTPSA id D34D520B7165; Mon, 5 Aug 2024 07:41:05 -0700 (PDT) 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,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D34D520B7165 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1722868866; bh=izj/EQUR32PWVdfNPfqgPKH6jusbmlMV60Iu5to26yA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lyxLVfBgtpgrMFtn1IB2MxPF+KFXPeOkUegJrpX6hGdIlygz6hoIBeGaonGnTPvqE N1pBw81Z6Z7DftAt74ro/m2G4LNNRcunc5ZYRtzBEjAjge/T7KfeoqvJ0AzqNV7iAb UprT7pZ5IhW+aKEjUDTzaaajlDVre56RjImDsiis= From: Purna Pavan Chandra To: devel@lists.libvirt.org Subject: [PATCH v3 8/9] ch: kill CH process if restore fails Date: Mon, 5 Aug 2024 14:41:00 +0000 Message-Id: <20240805144101.4864-9-paekkaladevi@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240805144101.4864-1-paekkaladevi@linux.microsoft.com> References: <20240805144101.4864-1-paekkaladevi@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NEVQMEALUQW4VEBIGWFDCRKA3C4ESFD4 X-Message-ID-Hash: NEVQMEALUQW4VEBIGWFDCRKA3C4ESFD4 X-MailFrom: paekkaladevi@linux.microsoft.com 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; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: paekkaladevi@microsoft.com, kumarpraveen@linux.microsoft.com, liuwe@microsoft.com, prapal@linux.microsoft.com, Purna Pavan Chandra 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 (Computed bodyhash is different from the expected one) X-ZM-MESSAGEID: 1722869065895116600 Content-Type: text/plain; charset="utf-8" Invoke virCHProcessStop to kill CH process incase of any failures during restore operation. Signed-off-by: Purna Pavan Chandra --- src/ch/ch_process.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c index ff0fc5ca63..38216bbf8d 100644 --- a/src/ch/ch_process.c +++ b/src/ch/ch_process.c @@ -980,7 +980,7 @@ virCHProcessStartRestore(virCHDriver *driver, virDomain= Obj *vm, const char *from if (!(priv->monitor =3D virCHProcessConnectMonitor(driver, vm))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("failed to create connection to CH socket")); - return -1; + goto cleanup; } } =20 @@ -991,7 +991,7 @@ virCHProcessStartRestore(virCHDriver *driver, virDomain= Obj *vm, const char *from if (virCHMonitorBuildRestoreJson(vm->def, from, &payload) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("failed to restore domain")); - return -1; + goto cleanup; } =20 virBufferAddLit(&http_headers, "PUT /api/v1/vm.restore HTTP/1.1\r\n"); @@ -1004,7 +1004,7 @@ virCHProcessStartRestore(virCHDriver *driver, virDoma= inObj *vm, const char *from payload =3D virBufferContentAndReset(&buf); =20 if ((mon_sockfd =3D chMonitorSocketConnect(priv->monitor)) < 0) - return -1; + goto cleanup; =20 if (virCHRestoreCreateNetworkDevices(driver, vm->def, &tapfds, &ntapfd= s, &nicindexes, &nnicindexes) < 0) goto cleanup; @@ -1041,5 +1041,7 @@ virCHProcessStartRestore(virCHDriver *driver, virDoma= inObj *vm, const char *from cleanup: if (tapfds) chCloseFDs(tapfds, ntapfds); + if (ret) + virCHProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED); return ret; } --=20 2.34.1