From nobody Sun Apr 28 06:38:35 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 209.132.183.28 is neither permitted nor denied by domain of redhat.com) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 209.132.183.28 is neither permitted nor denied by domain of redhat.com) 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 1504122988645451.0860824528173; Wed, 30 Aug 2017 12:56:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3C55381DE2; Wed, 30 Aug 2017 19:56:26 +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 C40845D722; Wed, 30 Aug 2017 19:56:25 +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 98B553FACE; Wed, 30 Aug 2017 19:56:24 +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 v7UHO0T7004447 for ; Wed, 30 Aug 2017 13:24:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 786C98F341; Wed, 30 Aug 2017 17:24:00 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 71C648D573 for ; Wed, 30 Aug 2017 17:23:58 +0000 (UTC) Received: from bulk.m3.smtp.beget.ru (bulk.m3.smtp.beget.ru [5.101.158.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 22CC6356D9 for ; Wed, 30 Aug 2017 17:23:56 +0000 (UTC) Received: from [5.101.159.150] (port=57164 helo=rin.office.beget.ru) by smtp.beget.ru with esmtpa (Exim 4.89-beget) (envelope-from ) id 1dn6iX-0001Jy-NK; Wed, 30 Aug 2017 20:23:53 +0300 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3C55381DE2 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=beget.ru Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3C55381DE2 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 22CC6356D9 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=beget.ru Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=apolyakov@beget.ru DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 22CC6356D9 From: apolyakov@beget.ru To: libvir-list@redhat.com Date: Wed, 30 Aug 2017 20:23:30 +0300 Message-Id: <20170830172330.6904-1-apolyakov@beget.ru> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 205 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 30 Aug 2017 17:23:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 30 Aug 2017 17:23:57 +0000 (UTC) for IP:'5.101.158.88' DOMAIN:'bulk.m3.smtp.beget.ru' HELO:'bulk.m3.smtp.beget.ru' FROM:'apolyakov@beget.ru' RCPT:'' X-RedHat-Spam-Score: 1.088 * (DKIM_ADSP_ALL, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS) 5.101.158.88 bulk.m3.smtp.beget.ru 5.101.158.88 bulk.m3.smtp.beget.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Wed, 30 Aug 2017 15:56:22 -0400 Cc: Alexander Polyakov Subject: [libvirt] [PATCH] Implement LVM volume resize via lvresize 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 30 Aug 2017 19:56:26 +0000 (UTC) X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Alexander Polyakov Signed-off-by: Alexander Polyakov --- m4/virt-storage-lvm.m4 | 4 ++++ src/storage/storage_backend_logical.c | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/m4/virt-storage-lvm.m4 b/m4/virt-storage-lvm.m4 index a0ccca7a0..0932995b4 100644 --- a/m4/virt-storage-lvm.m4 +++ b/m4/virt-storage-lvm.m4 @@ -30,6 +30,7 @@ AC_DEFUN([LIBVIRT_STORAGE_CHECK_LVM], [ AC_PATH_PROG([VGREMOVE], [vgremove], [], [$LIBVIRT_SBIN_PATH]) AC_PATH_PROG([LVREMOVE], [lvremove], [], [$LIBVIRT_SBIN_PATH]) AC_PATH_PROG([LVCHANGE], [lvchange], [], [$LIBVIRT_SBIN_PATH]) + AC_PATH_PROG([LVRESIZE], [lvresize], [], [$LIBVIRT_SBIN_PATH]) AC_PATH_PROG([VGCHANGE], [vgchange], [], [$LIBVIRT_SBIN_PATH]) AC_PATH_PROG([VGSCAN], [vgscan], [], [$LIBVIRT_SBIN_PATH]) AC_PATH_PROG([PVS], [pvs], [], [$LIBVIRT_SBIN_PATH]) @@ -44,6 +45,7 @@ AC_DEFUN([LIBVIRT_STORAGE_CHECK_LVM], [ if test -z "$VGREMOVE" ; then AC_MSG_ERROR([We need vgremove for LVM= storage driver]) ; fi if test -z "$LVREMOVE" ; then AC_MSG_ERROR([We need lvremove for LVM= storage driver]) ; fi if test -z "$LVCHANGE" ; then AC_MSG_ERROR([We need lvchange for LVM= storage driver]) ; fi + if test -z "$LVRESIZE" ; then AC_MSG_ERROR([We need lvresize for LVM= storage driver]) ; fi if test -z "$VGCHANGE" ; then AC_MSG_ERROR([We need vgchange for LVM= storage driver]) ; fi if test -z "$VGSCAN" ; then AC_MSG_ERROR([We need vgscan for LVM sto= rage driver]) ; fi if test -z "$PVS" ; then AC_MSG_ERROR([We need pvs for LVM storage d= river]) ; fi @@ -57,6 +59,7 @@ AC_DEFUN([LIBVIRT_STORAGE_CHECK_LVM], [ if test -z "$VGREMOVE" ; then with_storage_lvm=3Dno ; fi if test -z "$LVREMOVE" ; then with_storage_lvm=3Dno ; fi if test -z "$LVCHANGE" ; then with_storage_lvm=3Dno ; fi + if test -z "$LVRESIZE" ; then with_storage_lvm=3Dno ; fi if test -z "$VGCHANGE" ; then with_storage_lvm=3Dno ; fi if test -z "$VGSCAN" ; then with_storage_lvm=3Dno ; fi if test -z "$PVS" ; then with_storage_lvm=3Dno ; fi @@ -75,6 +78,7 @@ AC_DEFUN([LIBVIRT_STORAGE_CHECK_LVM], [ AC_DEFINE_UNQUOTED([VGREMOVE],["$VGREMOVE"],[Location of vgremove pr= ogram]) AC_DEFINE_UNQUOTED([LVREMOVE],["$LVREMOVE"],[Location of lvremove pr= ogram]) AC_DEFINE_UNQUOTED([LVCHANGE],["$LVCHANGE"],[Location of lvchange pr= ogram]) + AC_DEFINE_UNQUOTED([LVRESIZE],["$LVRESIZE"],[Location of lvresize pr= ogram]) AC_DEFINE_UNQUOTED([VGCHANGE],["$VGCHANGE"],[Location of vgchange pr= ogram]) AC_DEFINE_UNQUOTED([VGSCAN],["$VGSCAN"],[Location of vgscan program]) AC_DEFINE_UNQUOTED([PVS],["$PVS"],[Location of pvs program]) diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_ba= ckend_logical.c index 67f70e551..810e4ee88 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -1072,6 +1072,27 @@ virStorageBackendLogicalVolWipe(virConnectPtr conn, return -1; } =20 +static int +virStorageBackendLogicalResizeVol(virConnectPtr conn ATTRIBUTE_UNUSED, + virStoragePoolObjPtr pool, + virStorageVolDefPtr vol, + unsigned long long capacity, + unsigned int flags) +{ + + virCheckFlags(0, -1); + + (void)pool; + virCommandPtr cmd =3D virCommandNewArgList(LVRESIZE, "-L", NULL); + virCommandAddArgFormat(cmd, "%lluK", VIR_DIV_UP(capacity, 1024)); + virCommandAddArgFormat(cmd, "%s", vol->target.path); + int ret =3D virCommandRun(cmd, NULL); + + virCommandFree(cmd); + return ret; + +} + virStorageBackend virStorageBackendLogical =3D { .type =3D VIR_STORAGE_POOL_LOGICAL, =20 @@ -1089,6 +1110,7 @@ virStorageBackend virStorageBackendLogical =3D { .uploadVol =3D virStorageBackendVolUploadLocal, .downloadVol =3D virStorageBackendVolDownloadLocal, .wipeVol =3D virStorageBackendLogicalVolWipe, + .resizeVol =3D virStorageBackendLogicalResizeVol, }; =20 =20 --=20 2.13.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list