* [pve-devel] [PATCH qemu-server 1/2] fix VM clone from snapshot with cloudinit disk
@ 2020-09-25 8:51 Mira Limbeck
2020-09-25 8:51 ` [pve-devel] [PATCH qemu-server 2/2] fix volume_size_info failing for nonexistent " Mira Limbeck
0 siblings, 1 reply; 3+ messages in thread
From: Mira Limbeck @ 2020-09-25 8:51 UTC (permalink / raw)
To: pve-devel
All volumes contained in $vollist are activated. In this case a snapshot
of the volume. For cloudinit disks no snapshots are created so don't add
it to the list of volumes to activate as it otherwise fails with no
logical volume found.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
---
PVE/API2/Qemu.pm | 1 +
1 file changed, 1 insertion(+)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 8da616a..8e1bbc2 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -3000,6 +3000,7 @@ __PACKAGE__->register_method({
if !PVE::Storage::volume_has_feature($storecfg, 'clone', $drive->{file}, $snapname, $running);
}
$drives->{$opt} = $drive;
+ next if PVE::QemuServer::drive_is_cloudinit($drive);
push @$vollist, $drive->{file};
}
} else {
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] [PATCH qemu-server 2/2] fix volume_size_info failing for nonexistent cloudinit disk
2020-09-25 8:51 [pve-devel] [PATCH qemu-server 1/2] fix VM clone from snapshot with cloudinit disk Mira Limbeck
@ 2020-09-25 8:51 ` Mira Limbeck
2020-09-25 9:40 ` Mira Limbeck
0 siblings, 1 reply; 3+ messages in thread
From: Mira Limbeck @ 2020-09-25 8:51 UTC (permalink / raw)
To: pve-devel
After migration or a rollback the cloudinit disk might not be allocated, so
volume_size_info() fails. As we override the value anyway for cloudinit
and efi disks simply move the volume_size_info() call into the 'else'
branch.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
---
PVE/QemuServer.pm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 2747c66..49765b7 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6895,10 +6895,10 @@ sub clone_disk {
$storeid = $storage if $storage;
my $dst_format = resolve_dst_disk_format($storecfg, $storeid, $volname, $format);
- my ($size) = PVE::Storage::volume_size_info($storecfg, $drive->{file}, 3);
print "create full clone of drive $drivename ($drive->{file})\n";
my $name = undef;
+ my $size = undef;
if (drive_is_cloudinit($drive)) {
$name = "vm-$newvmid-cloudinit";
$name .= ".$dst_format" if $dst_format ne 'raw';
@@ -6906,6 +6906,8 @@ sub clone_disk {
$size = PVE::QemuServer::Cloudinit::CLOUDINIT_DISK_SIZE;
} elsif ($drivename eq 'efidisk0') {
$size = get_efivars_size($conf);
+ } else {
+ ($size) = PVE::Storage::volume_size_info($storecfg, $drive->{file}, 3);
}
$size /= 1024;
$newvolid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $newvmid, $dst_format, $name, $size);
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pve-devel] [PATCH qemu-server 2/2] fix volume_size_info failing for nonexistent cloudinit disk
2020-09-25 8:51 ` [pve-devel] [PATCH qemu-server 2/2] fix volume_size_info failing for nonexistent " Mira Limbeck
@ 2020-09-25 9:40 ` Mira Limbeck
0 siblings, 0 replies; 3+ messages in thread
From: Mira Limbeck @ 2020-09-25 9:40 UTC (permalink / raw)
To: pve-devel
The subject should probably be 'fix clone_disk failing for nonexistent
cloudinit disk'. Want me to send a v2?
On 9/25/20 10:51 AM, Mira Limbeck wrote:
> After migration or a rollback the cloudinit disk might not be allocated, so
> volume_size_info() fails. As we override the value anyway for cloudinit
> and efi disks simply move the volume_size_info() call into the 'else'
> branch.
>
> Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
> ---
> PVE/QemuServer.pm | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 2747c66..49765b7 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -6895,10 +6895,10 @@ sub clone_disk {
> $storeid = $storage if $storage;
>
> my $dst_format = resolve_dst_disk_format($storecfg, $storeid, $volname, $format);
> - my ($size) = PVE::Storage::volume_size_info($storecfg, $drive->{file}, 3);
>
> print "create full clone of drive $drivename ($drive->{file})\n";
> my $name = undef;
> + my $size = undef;
> if (drive_is_cloudinit($drive)) {
> $name = "vm-$newvmid-cloudinit";
> $name .= ".$dst_format" if $dst_format ne 'raw';
> @@ -6906,6 +6906,8 @@ sub clone_disk {
> $size = PVE::QemuServer::Cloudinit::CLOUDINIT_DISK_SIZE;
> } elsif ($drivename eq 'efidisk0') {
> $size = get_efivars_size($conf);
> + } else {
> + ($size) = PVE::Storage::volume_size_info($storecfg, $drive->{file}, 3);
> }
> $size /= 1024;
> $newvolid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $newvmid, $dst_format, $name, $size);
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-25 9:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25 8:51 [pve-devel] [PATCH qemu-server 1/2] fix VM clone from snapshot with cloudinit disk Mira Limbeck
2020-09-25 8:51 ` [pve-devel] [PATCH qemu-server 2/2] fix volume_size_info failing for nonexistent " Mira Limbeck
2020-09-25 9:40 ` Mira Limbeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox