From nobody Wed Nov 27 04:34:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1556560641; cv=none; d=zoho.com; s=zohoarc; b=Qez4avN4HepnqYqLYa0O0gOwU0G2OYejZis6jj0dBzG/g1pu9uXWtz9NDQ2bxpgWRcmL8gONxOiisOgwm7+gkSZKWEG9RWvjVAvfHzDVMTUsS1tileXs13hpOvWyYjC1N7FMpiFy4dCf7nkECxM6jnJodje4t6a3/oBJ36Y0wJ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556560641; 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:ARC-Authentication-Results; bh=0XmPnxg81LV/Hg51hX/dJoR9Oe6SLwfEyMcbcUIOQwA=; b=mijI2XITaPp/Y9/3y/U2cSfSBI4PmNu2K6+manawl/0+fkdF2zdmmT959K7dUr6ISvXZsdHuaYWRhXUDLVraNFWi24oMsJVVu8woeLeufE90xQBAZbUZG1xcYx5OIESQURCG/fFtVeaShazlWzTt9ih0cdHrEFGXLXVgWr2jOBM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1556560641920900.0176218017746; Mon, 29 Apr 2019 10:57:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BD9C03199397; Mon, 29 Apr 2019 17:57:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2CC9987CC; Mon, 29 Apr 2019 17:57:00 +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 CC2C818089CA; Mon, 29 Apr 2019 17:56:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3THujWL024886 for ; Mon, 29 Apr 2019 13:56:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id C38649087; Mon, 29 Apr 2019 17:56:45 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BD2E29068 for ; Mon, 29 Apr 2019 17:56:43 +0000 (UTC) Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B1A03086237 for ; Mon, 29 Apr 2019 17:56:42 +0000 (UTC) Received: by mail-lf1-f68.google.com with SMTP id t30so8582929lfd.8 for ; Mon, 29 Apr 2019 10:56:42 -0700 (PDT) Received: from localhost.localdomain ([5.107.102.243]) by smtp.googlemail.com with ESMTPSA id a2sm7521683lfi.13.2019.04.29.10.56.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Apr 2019 10:56:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=W3YWI4f/ngHbkaY+hXZqW3mS4kvGFxmz2W6K+EkOuH0=; b=vgwI3oUcF9LqgoRvVXjNZAPN70/6mdKI2ohY7g00N06XHwdJcZdZwwqvxjSNglq6fz 0+/EEtqk/cGBV77f5ggARiOEg4rItYXf4Zxx4yFwccbjMVT/8ZuZBsDyvkDPh9Vu9ves EIgE186XCNQZ2/0SB+pkQaptXf17lwEoNVHR19oMPa6E/NoSLoJVGj8ciuweqwqPCtY0 iQ8e31X1Lk8u489Jk9ndeND5gWd/aE95cC6RBVCp9MVemzsrgjKJSIFy6vAcvkIR1Yu4 bkKIQvlULtfibhqam7b1YSpT//hgqmuOpdTqpnKaYCpxJNlIMarDSw77eGflGSUqg+5M wrag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=W3YWI4f/ngHbkaY+hXZqW3mS4kvGFxmz2W6K+EkOuH0=; b=axDguF4Ah6X/dfWKoQ60kRYziGs0qCbKFThBEWgKWRFY3PTbLGuS7lcTpJcE7AyMf1 D9pL2o6EjXBlqPgvdfiyCNUK3zXlgKuOvNI9ECVJKnx9gfIoQQWKojEagaAHf31ZnWm3 EnWXrEooGNcVXXJWJw/Pmf4nB0+MiMhtZi2MzO0Bn7Q7D5+VGiGKymrtuai3myr/4W7H Hke2cuXfwAdRl/z/fBi0gLs/cQmjH77oRXcQXz7nB6dCzm5b7g6DSbMeqb5IyTdqiZHh k6VjcGaRY/3aR9CtjRCVAwqICzHDn1ADTEghw54sshaQlk22pT592PD1mTwf8gZDk9Ab K8Dw== X-Gm-Message-State: APjAAAVCvL6oshA1vSMR1JvttMve8+6hmj/gX3SWgwyyU6IA1OdYhQQ/ OwExGeF0u0qJ2v3souqRwHPsDO4JMfs= X-Google-Smtp-Source: APXvYqyD0wHGICaR8IzbUqtCylqNPrM56KJq1n3nzv4V0OWYeX4G5Bjz6SZNoupX+gSXtECVVPZZOw== X-Received: by 2002:a19:a417:: with SMTP id q23mr32874542lfc.110.1556560600543; Mon, 29 Apr 2019 10:56:40 -0700 (PDT) From: Syed Humaid To: libvir-list@redhat.com Date: Mon, 29 Apr 2019 21:56:26 +0400 Message-Id: <20190429175627.376-1-syedhumaidbinharoon@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 29 Apr 2019 17:56:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 29 Apr 2019 17:56:42 +0000 (UTC) for IP:'209.85.167.68' DOMAIN:'mail-lf1-f68.google.com' HELO:'mail-lf1-f68.google.com' FROM:'syedhumaidbinharoon@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.167.68 mail-lf1-f68.google.com 209.85.167.68 mail-lf1-f68.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Syed Humaid Subject: [libvirt] [PATCH v1] qemu: migration: Convert to virErrorRestore/virErrorPreserveLast 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 29 Apr 2019 17:57:20 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Replaced usages of virSaveLastError and virSetError/virFreeError with virErrorPreserveLast and virErrorRestore respectively. Signed-off-by: Syed Humaid --- src/qemu/qemu_migration.c | 75 +++++++++++++-------------------------- 1 file changed, 24 insertions(+), 51 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index e3ad4e52a7..b1fe79aed9 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -722,7 +722,7 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver, if (rv !=3D 0) { if (rv < 0) { if (!err) - err =3D virSaveLastError(); + virErrorPreserveLast(&err); failed =3D true; } qemuBlockJobSyncEnd(vm, job, asyncJob); @@ -747,7 +747,7 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver, } =20 if (failed && !err) - err =3D virSaveLastError(); + virErrorPreserveLast(&err); =20 if (virDomainObjWait(vm) < 0) goto cleanup; @@ -769,10 +769,7 @@ qemuMigrationSrcNBDCopyCancel(virQEMUDriverPtr driver, ret =3D failed ? -1 : 0; =20 cleanup: - if (err) { - virSetError(err); - virFreeError(err); - } + virErrorRestore(&err); return ret; } =20 @@ -3189,16 +3186,13 @@ static void qemuMigrationSrcIOFunc(void *arg) return; =20 abrt: - err =3D virSaveLastError(); + virErrorPreserveLast(&err);=20 if (err && err->code =3D=3D VIR_ERR_OK) { virFreeError(err); err =3D NULL; } virStreamAbort(data->st); - if (err) { - virSetError(err); - virFreeError(err); - } + virErrorRestore(&err); =20 error: /* Let the source qemu know that the transfer cant continue anymore. @@ -3685,15 +3679,12 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, if (events) priv->signalIOError =3D false; =20 - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); =20 return ret; =20 error: - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err);=20 =20 if (virDomainObjIsActive(vm)) { if (cancel && @@ -3948,7 +3939,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr dr= iver, virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("domainMigratePrepare2 did not set uri")); cancelled =3D true; - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); goto finish; } =20 @@ -3971,7 +3962,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr dr= iver, =20 /* Perform failed. Make sure Finish doesn't overwrite the error */ if (ret < 0) - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); =20 /* If Perform returns < 0, then we need to cancel the VM * startup on the destination @@ -4004,10 +3995,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr d= river, =20 virObjectUnref(st); =20 - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); VIR_FREE(uri_out); VIR_FREE(cookie); =20 @@ -4181,13 +4169,13 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr = driver, if (useParams && virTypedParamsReplaceString(¶ms, &nparams, VIR_MIGRATE_PARAM_URI, uri_out) < = 0) { - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); goto finish; } } else if (!uri && !(flags & VIR_MIGRATE_TUNNELLED)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("domainMigratePrepare3 did not set uri")); - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); goto finish; } =20 @@ -4220,7 +4208,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr dr= iver, =20 /* Perform failed. Make sure Finish doesn't overwrite the error */ if (ret < 0) { - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); } else { qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM3_DONE); @@ -4312,7 +4300,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr dr= iver, * one we need to preserve it in case confirm3 overwrites */ if (!orig_err) - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); =20 /* * If cancelled, then src VM will be restarted, else @@ -4344,10 +4332,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr d= river, =20 virObjectUnref(st); =20 - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); VIR_FREE(uri_out); VIR_FREE(cookiein); VIR_FREE(cookieout); @@ -4523,15 +4508,12 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr d= river, } =20 cleanup: - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); qemuDomainObjEnterRemote(vm); virConnectUnregisterCloseCallback(dconn, qemuMigrationSrcConnectionClo= sed); virObjectUnref(dconn); ignore_value(qemuDomainObjExitRemote(vm, false)); - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); virObjectUnref(cfg); return ret; } @@ -4619,7 +4601,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver, =20 endjob: if (ret < 0) - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); =20 /* v2 proto has no confirm phase so we need to reset migration paramet= ers * here @@ -4639,10 +4621,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver, qemuDomainRemoveInactiveJob(driver, vm); } =20 - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); =20 cleanup: virObjectEventStateQueue(driver->domainEventState, event); @@ -5052,7 +5031,7 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver, /* Need to save the current error, in case shutting * down the process overwrites it */ - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); =20 /* * In v3 protocol, the source VM is still available to @@ -5181,10 +5160,7 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver, VIR_FREE(priv->origname); virDomainObjEndAPI(&vm); qemuMigrationCookieFree(mig); - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); virObjectUnref(cfg); =20 /* Set a special error if Finish is expected to return NULL as a resul= t of @@ -5289,7 +5265,7 @@ qemuMigrationSrcToFile(virQEMUDriverPtr driver, virDo= mainObjPtr vm, =20 if (rc < 0) { if (rc =3D=3D -2) { - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); virCommandAbort(cmd); if (virDomainObjIsActive(vm) && qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) =3D= =3D 0) { @@ -5308,7 +5284,7 @@ qemuMigrationSrcToFile(virQEMUDriverPtr driver, virDo= mainObjPtr vm, =20 cleanup: if (ret < 0 && !orig_err) - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); =20 /* Restore max migration bandwidth */ if (virDomainObjIsActive(vm) && @@ -5326,10 +5302,7 @@ qemuMigrationSrcToFile(virQEMUDriverPtr driver, virD= omainObjPtr vm, virCommandFree(cmd); } =20 - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); =20 return ret; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list