From nobody Mon May 6 00:27:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1587489320; cv=none; d=zohomail.com; s=zohoarc; b=fBaVqF67PvrWQetpQaun2hhmBwRTKdoREVlwMCwJ1OPlY6LYYFxpXkpgquNQZGzqYYrioN9YVkQ0HvQ44vTkYS+O/7XYiCk59VaBxXD+BqxX1PX2EIyksFiZcVMOmFQHgVKnNDhavWBw8w5H8pWrMOlITlWNpGW5AOvUprzZJXo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587489320; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=rUWPeXiONpcw40RDPyrkdacL5ZexNheRPZ1c1necu24=; b=UbJ5ksgCVU7D9IosyzDV4gYTTSFAIjAHFMNL4RX1pdIhvvX8h+TR+M0e9ouLLjYE8E3LPLByCI3TVLZQqj7MrCDwk1SDPKaQOF/Bj3A5ST/lISJpjXi/M29/Bxbjc5FNHngW+4eNHyCYNEkjQqnnU4RFbZjsnw1d9dswHbDa5Xk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1587489320257718.2123857959779; Tue, 21 Apr 2020 10:15:20 -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-460-H9RcsO_bOUepaNZpx7djfw-1; Tue, 21 Apr 2020 13:15:16 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E3E11007276; Tue, 21 Apr 2020 17:15:11 +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 E75173AD; Tue, 21 Apr 2020 17:15:10 +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 4FFE193A97; Tue, 21 Apr 2020 17:15:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 03LHF8PP020966 for ; Tue, 21 Apr 2020 13:15:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id C803DB3A82; Tue, 21 Apr 2020 17:15:08 +0000 (UTC) Received: from kinshicho.usersys.redhat.com (unknown [10.40.194.250]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C3F56B3A80; Tue, 21 Apr 2020 17:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587489319; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rUWPeXiONpcw40RDPyrkdacL5ZexNheRPZ1c1necu24=; b=ehFZovvDfHRMBj631067UdCpaeMAA0Dz38m57WWmADtF4Fd2Hmq9c3KzCjdcjhIsi90tG4 4QtV08C5OvMKTayr6etv0ODwZpcQUliDscQcnbkI4XiV/zsTd9GIOsedhekitCgwDZZ3cn dLmeWixxVY5r6m6bSX/dJ++wUhYIl0U= X-MC-Unique: H9RcsO_bOUepaNZpx7djfw-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH] virsh: Fix return code for dump and migrate Date: Tue, 21 Apr 2020 19:15:00 +0200 Message-Id: <20200421171500.161962-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: brak@gameservers.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.23 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" When the job monitoring logic was refactored, these two commands were not converted properly and the result is that a successful dump or migration (char '0') would be reported as a failed one (int 48) instead. Fixes: dc0771cfa2e78ffecd7c8234538ee548748d7bef Reported-by: Brian Rak Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrang=C3=A9 --- tools/virsh-domain.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index d52eb7bc2f..502685f44b 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5436,7 +5436,6 @@ static const vshCmdOptDef opts_dump[] =3D { static void doDump(void *opaque) { - char ret =3D '1'; virshCtrlData *data =3D opaque; vshControl *ctl =3D data->ctl; const vshCmd *cmd =3D data->cmd; @@ -5508,7 +5507,7 @@ doDump(void *opaque) } } =20 - ret =3D '0'; + data->ret =3D 0; out: #ifndef WIN32 pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL); @@ -5516,7 +5515,6 @@ doDump(void *opaque) #endif /* !WIN32 */ if (dom) virshDomainFree(dom); - data->ret =3D ret; g_main_loop_quit(data->eventLoop); } =20 @@ -10722,7 +10720,6 @@ static const vshCmdOptDef opts_migrate[] =3D { static void doMigrate(void *opaque) { - char ret =3D '1'; virDomainPtr dom =3D NULL; const char *desturi =3D NULL; const char *opt =3D NULL; @@ -11001,14 +10998,14 @@ doMigrate(void *opaque) =20 if (flags & VIR_MIGRATE_PEER2PEER || vshCommandOptBool(cmd, "direct"))= { if (virDomainMigrateToURI3(dom, desturi, params, nparams, flags) = =3D=3D 0) - ret =3D '0'; + data->ret =3D 0; } else { /* For traditional live migration, connect to the destination host= directly. */ virDomainPtr ddom =3D NULL; =20 if ((ddom =3D virDomainMigrate3(dom, dconn, params, nparams, flags= ))) { virshDomainFree(ddom); - ret =3D '0'; + data->ret =3D 0; } } =20 @@ -11019,7 +11016,6 @@ doMigrate(void *opaque) #endif /* !WIN32 */ virTypedParamsFree(params, nparams); virshDomainFree(dom); - data->ret =3D ret; g_main_loop_quit(data->eventLoop); return; =20 --=20 2.25.3