blockdev: delete/replace: re-use detach() helper
Re-using the detach() helper has the side effect of avoiding logging errors to syslog for automatically removed child nodes. This should be the case for all file nodes here. None are explicitly added via blockdev-add and thus QEMU already auto-removes them. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> Link: https://lore.proxmox.com/all/20250812115652.79330-4-f.ebner@proxmox.com
This commit is contained in:
parent
d2f055b03a
commit
e7cf7c0056
1 changed files with 4 additions and 6 deletions
|
|
@ -873,9 +873,8 @@ sub blockdev_external_snapshot {
|
|||
sub blockdev_delete {
|
||||
my ($storecfg, $vmid, $drive, $file_blockdev, $fmt_blockdev, $snap) = @_;
|
||||
|
||||
#add eval as reopen is auto removing the old nodename automatically only if it was created at vm start in command line argument
|
||||
eval { mon_cmd($vmid, 'blockdev-del', 'node-name' => $fmt_blockdev->{'node-name'}) };
|
||||
eval { mon_cmd($vmid, 'blockdev-del', 'node-name' => $file_blockdev->{'node-name'}) };
|
||||
eval { detach($vmid, $fmt_blockdev->{'node-name'}); };
|
||||
warn "detaching block node for $file_blockdev->{filename} failed - $@" if $@;
|
||||
|
||||
#delete the file (don't use vdisk_free as we don't want to delete all snapshot chain)
|
||||
print "delete old $file_blockdev->{filename}\n";
|
||||
|
|
@ -982,9 +981,8 @@ sub blockdev_replace {
|
|||
}
|
||||
|
||||
# delete old file|fmt nodes
|
||||
# add eval as reopen is auto removing the old nodename automatically only if it was created at vm start in command line argument
|
||||
eval { mon_cmd($vmid, 'blockdev-del', 'node-name' => $src_fmt_blockdev_name) };
|
||||
eval { mon_cmd($vmid, 'blockdev-del', 'node-name' => $src_file_blockdev_name) };
|
||||
eval { detach($vmid, $src_fmt_blockdev_name); };
|
||||
warn "detaching block node for $src_snap failed - $@" if $@;
|
||||
}
|
||||
|
||||
sub blockdev_commit {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue