From: "Dominic Jäger" <d.jaeger@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Aaron Lauterer <a.lauterer@proxmox.com>
Subject: Re: [pve-devel] [PATCH v6 storage 1/1] add disk reassign feature
Date: Tue, 13 Apr 2021 09:53:49 +0200 [thread overview]
Message-ID: <20210413075349.GA18977@mala> (raw)
In-Reply-To: <20210402101923.13050-2-a.lauterer@proxmox.com>
Needs a rebase since the rbd patches
On Fri, Apr 02, 2021 at 12:19:19PM +0200, Aaron Lauterer wrote:
> +sub reassign_volume {
> + my ($class, $scfg, $storeid, $volname, $target_vmid) = @_;
> +
> + my $base;;
> + (undef, $volname, undef, $base) = $class->parse_volname($volname);
> +
> + if ($base) {
> + $base = $base . '/';
> + } else {
> + $base = '';
> + }
> +
> + $class->cluster_lock_storage($storeid, $scfg->{shared}, undef, sub {
> + my $target_volname = $class->find_free_diskname($storeid, $scfg, $target_vmid);
> + return $class->rename_volume($scfg, $storeid, $volname, $target_volname, $target_vmid, $base);
> + });
> +}
> +
> +sub rename_volume {
> + my ($class, $scfg, $storeid, $source_volname, $target_volname, $vmid, $base) = @_;
> +
> + $class->zfs_request($scfg, 5, 'rename', "$scfg->{pool}/$source_volname", "$scfg->{pool}/$target_volname");
> + return "${storeid}:${base}${target_volname}";
> +}
1. imo a ternary would not decrease readability much here and it is only one line
> $base = $base ? "$base/" : "";
2. We could maybe move the if to rename_volume. As far as I see, it is not used
in reassign_volume and we could avoid silently guaranteeing properties of $base
across subs.
And there is a double ;; somewhere
next prev parent reply other threads:[~2021-04-13 7:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-02 10:19 [pve-devel] [PATCH v6 series 0/5] disk reassign: add new feature Aaron Lauterer
2021-04-02 10:19 ` [pve-devel] [PATCH v6 storage 1/1] add disk reassign feature Aaron Lauterer
2021-04-13 7:53 ` Dominic Jäger [this message]
2021-04-15 11:07 ` Fabian Ebner
2021-04-15 11:31 ` Fabian Ebner
2021-04-15 11:53 ` Aaron Lauterer
2021-04-15 12:09 ` Fabian Ebner
2021-04-15 12:21 ` Thomas Lamprecht
2021-04-15 12:20 ` Thomas Lamprecht
2021-04-02 10:19 ` [pve-devel] [PATCH v6 qemu-server 2/5] disk reassign: add API endpoint Aaron Lauterer
2021-04-15 11:52 ` Fabian Ebner
2021-04-19 9:26 ` Aaron Lauterer
2021-04-18 15:24 ` Thomas Lamprecht
2021-04-19 9:25 ` Aaron Lauterer
2021-04-02 10:19 ` [pve-devel] [PATCH v6 qemu-server 3/5] cli: disk reassign: add reassign_disk to qm command Aaron Lauterer
2021-04-18 14:50 ` Thomas Lamprecht
2021-04-02 10:19 ` [pve-devel] [PATCH v6 guest-common 4/5] Replication: mention disk reassign in comment of possible reasons Aaron Lauterer
2021-04-02 10:19 ` [pve-devel] [PATCH v6 manager 5/5] ui: tasks: add qmreassign task description Aaron Lauterer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210413075349.GA18977@mala \
--to=d.jaeger@proxmox.com \
--cc=a.lauterer@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal