From nobody Thu May 15 22:48:08 2025 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; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1503580174432962.180726371298; Thu, 24 Aug 2017 06:09:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E8F1461479; Thu, 24 Aug 2017 13:09:31 +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 C0CDA7F5DB; Thu, 24 Aug 2017 13:09:31 +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 785F9185735D; Thu, 24 Aug 2017 13:09:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v7OD9FPj027826 for ; Thu, 24 Aug 2017 09:09:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3C3EE7B8D4; Thu, 24 Aug 2017 13:09:15 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-123-165.rdu2.redhat.com [10.10.123.165]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C5807B9C9 for ; Thu, 24 Aug 2017 13:09:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E8F1461479 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: John Ferlan To: libvir-list@redhat.com Date: Thu, 24 Aug 2017 09:09:02 -0400 Message-Id: <20170824130905.5199-10-jferlan@redhat.com> In-Reply-To: <20170824130905.5199-1-jferlan@redhat.com> References: <20170824130905.5199-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 09/12] storage: Use virStoragePoolObj{Is|Set}Autostart 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: , MIME-Version: 1.0 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 24 Aug 2017 13:09:32 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use the new accessor APIs for storage_driver and test_driver. Signed-off-by: John Ferlan --- src/storage/storage_driver.c | 20 +++++++++----------- src/test/test_driver.c | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 89eaee9..c9156e6 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -196,7 +196,7 @@ storageDriverAutostart(void) continue; } =20 - if (obj->autostart && + if (virStoragePoolObjIsAutostart(obj) && !virStoragePoolObjIsActive(obj)) { if (backend->startPool && backend->startPool(conn, obj) < 0) { @@ -1249,11 +1249,7 @@ storagePoolGetAutostart(virStoragePoolPtr pool, if (virStoragePoolGetAutostartEnsureACL(pool->conn, obj->def) < 0) goto cleanup; =20 - if (!virStoragePoolObjGetConfigFile(obj)) { - *autostart =3D 0; - } else { - *autostart =3D obj->autostart; - } + *autostart =3D virStoragePoolObjIsAutostart(obj) ? 1 : 0; =20 ret =3D 0; =20 @@ -1269,6 +1265,8 @@ storagePoolSetAutostart(virStoragePoolPtr pool, virStoragePoolObjPtr obj; const char *configFile; const char *autostartLink; + bool new_autostart; + bool cur_autostart; int ret =3D -1; =20 storageDriverLock(); @@ -1286,10 +1284,10 @@ storagePoolSetAutostart(virStoragePoolPtr pool, =20 autostartLink =3D virStoragePoolObjGetAutostartLink(obj); =20 - autostart =3D (autostart !=3D 0); - - if (obj->autostart !=3D autostart) { - if (autostart) { + new_autostart =3D (autostart !=3D 0); + cur_autostart =3D virStoragePoolObjIsAutostart(obj); + if (cur_autostart !=3D new_autostart) { + if (new_autostart) { if (virFileMakePath(driver->autostartDir) < 0) { virReportSystemError(errno, _("cannot create autostart directory = %s"), @@ -1312,7 +1310,7 @@ storagePoolSetAutostart(virStoragePoolPtr pool, goto cleanup; } } - obj->autostart =3D autostart; + virStoragePoolObjSetAutostart(obj, autostart); } =20 ret =3D 0; diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 33ce9e4..b793187 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4748,7 +4748,7 @@ testStoragePoolGetAutostart(virStoragePoolPtr pool, if (!virStoragePoolObjGetConfigFile(obj)) *autostart =3D 0; else - *autostart =3D obj->autostart; + *autostart =3D virStoragePoolObjIsAutostart(obj) ? 1 : 0; =20 virStoragePoolObjUnlock(obj); return 0; @@ -4773,7 +4773,7 @@ testStoragePoolSetAutostart(virStoragePoolPtr pool, } =20 autostart =3D (autostart !=3D 0); - obj->autostart =3D autostart; + virStoragePoolObjSetAutostart(obj, autostart); ret =3D 0; =20 cleanup: --=20 2.9.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list