From nobody Tue Nov 26 13:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1574952513; cv=none; d=zohomail.com; s=zohoarc; b=WzD7FPWil28h3K3CoGKgg+D1i/FIgCMwRU1btVedMgQgJTNpueWMoPcmrbi7Sys0ECOY9FBNMEQQhAVA37d12C9rKTWXSLpmF2YpaABINGcbu6t6bzMTBM/ytHTY7+XuuPrIDX/Fjo9+hc7+piWWvXCIGWIw4qMhpm53Lvintpg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574952513; 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=UIb0YHbv/cy6usCFHED/3gIx6DGgo16VIXqIsvKHrZ0=; b=Q13/4w6l3qxZnORv2a/SJRv5JetYjPQpZW4UlHfd383t5raAtHfyvCMP1Et2XtXCfQ4urXRbHtWpAZ3I3eUYxQOOzhy90Wtd3FM5+gRpUhuoRYEuaDfsqSExKCph5aBSk5wd9nFYXARhKfWlNZEgR3LcpCa6sIaZ7BcrYxrmERA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1574952513501447.6637821195234; Thu, 28 Nov 2019 06:48:33 -0800 (PST) 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-405-RUvdAtGmNHixbH3OaBu3Ig-1; Thu, 28 Nov 2019 09:48:30 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A352C1800D52; Thu, 28 Nov 2019 14:48:24 +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 23F125C1B0; Thu, 28 Nov 2019 14:48:24 +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 932094BB5C; Thu, 28 Nov 2019 14:48:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xASEmKfm014192 for ; Thu, 28 Nov 2019 09:48:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0DF22608C2; Thu, 28 Nov 2019 14:48:20 +0000 (UTC) Received: from ridgehead.redhat.com (unknown [10.43.2.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63D9F608B9; Thu, 28 Nov 2019 14:48:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574952512; 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=UIb0YHbv/cy6usCFHED/3gIx6DGgo16VIXqIsvKHrZ0=; b=W0zwzoWYRKJhNxuMe6UyPKj91UmMZPrtaOo8Av2TfekZg/f7pPqva+KDV4+T9nPh1xje43 hcqQeP+gQKvCQDODk2SXWmdstlZKJ+cTU9/ei5jDHZX/mTByMs7eRFsnjwd40l4k+WUj+9 19a6wNXHfTYR8vgmDpMUcLREIDeyBQk= From: Erik Skultety To: libvir-list@redhat.com Date: Thu, 28 Nov 2019 15:48:16 +0100 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH] storage: backend_disk: Implement the deletePool function 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.79 on 10.5.11.16 X-MC-Unique: RUvdAtGmNHixbH3OaBu3Ig-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This is a very simple and straightforward implementation of the opposite what buildPool does for the disk backend. The background for this change comes from an existing test case in TCK which does use the delete method for a pool of type disk, but it truly could not have ever worked since the implementation simply wasn't there for the pool of type disk. Signed-off-by: Erik Skultety Reviewed-by: Michal Privoznik --- src/storage/storage_backend_disk.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backe= nd_disk.c index d971530cd8..45d1257f3d 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -531,6 +531,25 @@ virStorageBackendDiskBuildPool(virStoragePoolObjPtr po= ol, } =20 =20 +/** + * Wipe the existing partition table + */ +static int +virStorageBackendDiskDeletePool(virStoragePoolObjPtr pool, + unsigned int flags) +{ + virStoragePoolDefPtr def =3D virStoragePoolObjGetDef(pool); + + virCheckFlags(0, -1); + + if (virStorageBackendZeroPartitionTable(def->source.devices[0].path, + 1024 * 1024) < 0) + return -1; + + return 0; +} + + struct virStorageVolNumData { int count; }; @@ -954,6 +973,7 @@ virStorageBackend virStorageBackendDisk =3D { .startPool =3D virStorageBackendDiskStartPool, .buildPool =3D virStorageBackendDiskBuildPool, .refreshPool =3D virStorageBackendDiskRefreshPool, + .deletePool =3D virStorageBackendDiskDeletePool, =20 .createVol =3D virStorageBackendDiskCreateVol, .deleteVol =3D virStorageBackendDiskDeleteVol, --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list