From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: [pve-devel] applied: [PATCH qemu-server] disk reassign: add unused disks directly to config
Date: Thu, 11 Nov 2021 10:09:45 +0100 [thread overview]
Message-ID: <1636621768.bzbvwi68si.astroid@nora.none> (raw)
In-Reply-To: <20211110170013.1692360-1-a.lauterer@proxmox.com>
On November 10, 2021 6:00 pm, Aaron Lauterer wrote:
> Using $update_vm_api for unused disks will cause them to end up as a
> pending change if the VM is running.
>
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
> That case is already handled for containers but was missed for VMs.
>
> PVE/API2/Qemu.pm | 24 +++++++++++++++---------
> 1 file changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index 4404da9..24b1d2f 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -3607,15 +3607,21 @@ __PACKAGE__->register_method({
> PVE::QemuConfig->write_config($vmid, $source_conf);
>
> my $drive_string = PVE::QemuServer::print_drive($drive);
> - &$update_vm_api(
> - {
> - node => $node,
> - vmid => $target_vmid,
> - digest => $target_digest,
> - $target_disk => $drive_string,
> - },
> - 1,
> - );
> +
> + if ($target_disk =~ /^unused\d+$/) {
> + $target_conf->{$target_disk} = $drive_string;
> + PVE::QemuConfig->write_config($target_vmid, $target_conf);
> + } else {
> + &$update_vm_api(
> + {
> + node => $node,
> + vmid => $target_vmid,
> + digest => $target_digest,
> + $target_disk => $drive_string,
> + },
> + 1,
> + );
> + }
>
> # remove possible replication snapshots
> if (PVE::Storage::volume_has_feature(
> --
> 2.30.2
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
>
prev parent reply other threads:[~2021-11-11 9:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-10 17:00 [pve-devel] " Aaron Lauterer
2021-11-11 9:09 ` Fabian Grünbichler [this message]
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=1636621768.bzbvwi68si.astroid@nora.none \
--to=f.gruenbichler@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.