From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 52FD37DE63 for ; Tue, 9 Nov 2021 17:52:53 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 483E111392 for ; Tue, 9 Nov 2021 17:52:23 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 291D511387 for ; Tue, 9 Nov 2021 17:52:22 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id ED2A345DA6 for ; Tue, 9 Nov 2021 17:52:21 +0100 (CET) Date: Tue, 09 Nov 2021 17:52:14 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20211109145540.1422104-1-a.lauterer@proxmox.com> In-Reply-To: <20211109145540.1422104-1-a.lauterer@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Message-Id: <1636476683.04zlsszb3q.astroid@nora.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.287 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qm.pm, lvmplugin.pm, lxc.pm, rbdplugin.pm, storage.pm, lvmthinplugin.pm, proxmox.com, qemu.pm, pct.pm, drive.pm, plugin.pm, config.pm, zfspoolplugin.pm] Subject: [pve-devel] applied-series: [PATCH v5 storage qemu-server container 0/9] move disk or volume to other guests X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2021 16:52:53 -0000 with a small fixup for the ApiChangelog conflicts, and a more detailed=20 explanation in the pve-storage commit message. I'll likely do a few more=20 style follow-ups tomorrow ;) On November 9, 2021 3:55 pm, Aaron Lauterer wrote: > This version 5 came to be after Fabian did notice that exposing the > 'find_free_volname' could cause some troubles down the line since it > could be seen as an incompatible change in the storage API, especially > of other parts will start using it as well. >=20 > We discussed it off list and the current version is the result of that. > We drop all of find_free_volname for now and change the parameters given > to the rename functions which now take the source volid, target vmid and > target volname. The latter two are either or optional. If the target > vmid is not given, it will be set to the source vmid. If no target > volname is given, the rename function will request the next free one > itself within the storage plugin (find_free_diskname). >=20 > This makes it possible to keep our storage api compatible and we can > continue working on making it possible to give disk images a more custom > name. The raname functions as implemented should be able to deal with > this situation already (only did light testing on this). >=20 > If, in the future it is necessary to have something like > find_free_volname as part of the storage api, we can add it again at the > right time, where a storage api version bump is okay. >=20 > We will have to discuss if we want to use v5 or are okay with v4. >=20 > Additionally I split up adding valid unused volume keys in the > LXC/Config.pm into its own patch as it is on the Qemu side. >=20 > Previous cover letter follows: > ------------------------------ >=20 > This is the continuation of 'disk-reassign' but instead of a separate > API endpoint we now follow the approach to make it part of the > 'move-disk' and 'move-volume' endpoints for VMs and containers. >=20 > The main idea is to make it easy to move a disk/volume to another guest. > Currently this is a manual and error prone process that requires > knowledge of how PVE handles disks/volumes and the mapping which guest > they belong to. >=20 > With this, the 'qm move-disk' and 'pct move-volume' are changed in the > way that the storage parameter is optional as well as the new > target-vmid and target-{disk,volume}. This will keep old calls to move th= e > disk/volume to another storage working. To move to another guest, the > storage needs to be omitted. >=20 > The following storage types are implemented at the moment: > * dir based ones > * ZFS > * (thin) LVM > * Ceph RBD >=20 > Most parts of the disk-reassign code has been taken and moved into the > 'move_disk' and 'move_volume' endpoints with conditional checking if the > reassign code or the move to other storage code is meant to run > depending on the given parameters. >=20 > Changes since v4: > * remove find_free_volname completely > * change rename functions to take either target_vmid or target_volname > as parameter. The target_volname as parameter makes it possible to > easily implement custom renaming in the future. If no target_volname > is given, it will use find_free_diskname to find the next free one. > * removed calls to find_free_volname in the container und qemu APIs >=20 > Changes since v3: > * added check if $vmid exists in $vmlist > * added check if volume if part of a snapshot (containers, qemu already > had it) > * added section in storage/ApiChangeLog > * code style issues >=20 > Changes since v2: > * fixed base image handling > * fixed code style issues >=20 > Changes since v1 [2] (thx @ Fabian_E for the reviews!): > * drop exposed 'find_free_diskname' method > * drop 'wants_fmt_suffix' method (not needed anymore) > * introduce 'find_free_volname' which decides if only the diskname is > needed or the longer path for directory based storages > * use $source_volname instead of $source_volid -> avoids some extra > calls to get to $source_volname again > * make --target-{disk,volume} optional and fall back to source key > * smaller fixes in code quality and using existing functions like > 'parse_volname' instead of a custom regex (possible with the new > changes) >=20 >=20 > Changes since the RFC [1]: > * added check if target guest is replicated and fail if storage does not > support replication > * only pass minimum of needed parameters to the storage layer and infer > other needed information from that > * lock storage and check if the volume aready exists (handling a > possible race condition between calling find_free_disk and the actual > renaming) > * use a helper method to determine if the plugin needs the fmt suffix > in the volume name > * getting format of the source and pass it to find_free_disk > * style fixes (long lines, multiline post-if, ...) >=20 > [1] https://lists.proxmox.com/pipermail/pve-devel/2021-June/048400.html > [2] https://lists.proxmox.com/pipermail/pve-devel/2021-July/049445.html >=20 > storage: Aaron Lauterer (1): > add disk rename feature >=20 > ApiChangeLog | 10 ++++++++++ > PVE/Storage.pm | 25 ++++++++++++++++++++++-- > PVE/Storage/LVMPlugin.pm | 34 ++++++++++++++++++++++++++++++++ > PVE/Storage/LvmThinPlugin.pm | 1 + > PVE/Storage/Plugin.pm | 38 ++++++++++++++++++++++++++++++++++++ > PVE/Storage/RBDPlugin.pm | 34 ++++++++++++++++++++++++++++++++ > PVE/Storage/ZFSPoolPlugin.pm | 31 +++++++++++++++++++++++++++++ > 7 files changed, 171 insertions(+), 2 deletions(-) >=20 >=20 > qemu-server: Aaron Lauterer (4): > cli: qm: change move_disk to move-disk > Drive: add valid_drive_names_with_unused > api: move-disk: add move to other VM > api: move-disk: cleanup very long lines >=20 > PVE/API2/Qemu.pm | 227 ++++++++++++++++++++++++++++++++++++++-- > PVE/CLI/qm.pm | 3 +- > PVE/QemuServer/Drive.pm | 4 + > 3 files changed, 223 insertions(+), 11 deletions(-) >=20 > container: Aaron Lauterer (4): > cli: pct: change move_volume to move-volume > Config: add valid_volume_keys_with_unused > api: move-volume: add move to another container > api: move-volume: cleanup very long lines >=20 > src/PVE/API2/LXC.pm | 302 ++++++++++++++++++++++++++++++++++++++---- > src/PVE/CLI/pct.pm | 3 +- > src/PVE/LXC/Config.pm | 9 ++ > 3 files changed, 285 insertions(+), 29 deletions(-) >=20 >=20 > --=20 > 2.30.2 >=20 >=20 >=20 > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel >=20 >=20 >=20