public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH-SERIES container/storage] migration fixes for containers
@ 2022-03-03 12:31 Fabian Ebner
  2022-03-03 12:31 ` [pve-devel] [PATCH container 1/2] migrate: also set targetsid for unreferenced disks Fabian Ebner
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Fabian Ebner @ 2022-03-03 12:31 UTC (permalink / raw)
  To: pve-devel

The recent changes to support setting target storage and allow
renaming led to two problems with unused and unreferenced disks, as
well as exposing a bug in ZFSPoolPlugin.pm's volume_import.


container:

Fabian Ebner (2):
  migrate: also set targetsid for unreferenced disks
  config: print volume: support printing unused volume

 src/PVE/LXC/Config.pm  | 9 +++++++++
 src/PVE/LXC/Migrate.pm | 1 +
 2 files changed, 10 insertions(+)


storage:

Fabian Ebner (1):
  zfs: volume import: use correct format for renaming

 PVE/Storage/ZFSPoolPlugin.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH container 1/2] migrate: also set targetsid for unreferenced disks
  2022-03-03 12:31 [pve-devel] [PATCH-SERIES container/storage] migration fixes for containers Fabian Ebner
@ 2022-03-03 12:31 ` Fabian Ebner
  2022-03-03 12:31 ` [pve-devel] [PATCH container 2/2] config: print volume: support printing unused volume Fabian Ebner
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Fabian Ebner @ 2022-03-03 12:31 UTC (permalink / raw)
  To: pve-devel

It's expected to be set further below. Reported in the community
forum: https://forum.proxmox.com/threads/105685

Fixes: e90ddc4 ("fix #1532: add target-storage support to migration")
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 src/PVE/LXC/Migrate.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/PVE/LXC/Migrate.pm b/src/PVE/LXC/Migrate.pm
index 64bdd38..2ef1cce 100644
--- a/src/PVE/LXC/Migrate.pm
+++ b/src/PVE/LXC/Migrate.pm
@@ -220,6 +220,7 @@ sub phase1 {
 	    my ($volid, $sid, $volname) = @_;
 
 	    $volhash->{$volid}->{ref} = 'storage';
+	    $volhash->{$volid}->{targetsid} = $targetsid;
 	});
     }
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH container 2/2] config: print volume: support printing unused volume
  2022-03-03 12:31 [pve-devel] [PATCH-SERIES container/storage] migration fixes for containers Fabian Ebner
  2022-03-03 12:31 ` [pve-devel] [PATCH container 1/2] migrate: also set targetsid for unreferenced disks Fabian Ebner
@ 2022-03-03 12:31 ` Fabian Ebner
  2022-03-03 12:31 ` [pve-devel] [PATCH storage 1/1] zfs: volume import: use correct format for renaming Fabian Ebner
  2022-03-03 13:40 ` [pve-devel] applied series: [PATCH-SERIES container/storage] migration fixes for containers Wolfgang Bumiller
  3 siblings, 0 replies; 5+ messages in thread
From: Fabian Ebner @ 2022-03-03 12:31 UTC (permalink / raw)
  To: pve-devel

In particular, fixes migration with an unused disk, where calling
update_volume_ids() failed previously.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 src/PVE/LXC/Config.pm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 0ed7bd2..d5b49d3 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1207,6 +1207,13 @@ sub print_ct_mountpoint {
     return PVE::JSONSchema::print_property_string($info, $mp_desc, $skip);
 }
 
+sub print_ct_unused {
+    my ($class, $info) = @_;
+
+    my $skip = [ 'type' ];
+    return PVE::JSONSchema::print_property_string($info, $unused_desc, $skip);
+}
+
 sub parse_volume {
     my ($class, $key, $volume_string, $noerr) = @_;
 
@@ -1228,6 +1235,8 @@ sub parse_volume {
 sub print_volume {
     my ($class, $key, $volume) = @_;
 
+    return $class->print_ct_unused($volume) if $key =~ m/^unused(\d+)$/;
+
     return $class->print_ct_mountpoint($volume, $key eq 'rootfs');
 }
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH storage 1/1] zfs: volume import: use correct format for renaming
  2022-03-03 12:31 [pve-devel] [PATCH-SERIES container/storage] migration fixes for containers Fabian Ebner
  2022-03-03 12:31 ` [pve-devel] [PATCH container 1/2] migrate: also set targetsid for unreferenced disks Fabian Ebner
  2022-03-03 12:31 ` [pve-devel] [PATCH container 2/2] config: print volume: support printing unused volume Fabian Ebner
@ 2022-03-03 12:31 ` Fabian Ebner
  2022-03-03 13:40 ` [pve-devel] applied series: [PATCH-SERIES container/storage] migration fixes for containers Wolfgang Bumiller
  3 siblings, 0 replies; 5+ messages in thread
From: Fabian Ebner @ 2022-03-03 12:31 UTC (permalink / raw)
  To: pve-devel

Previously, the transport format (which currently is always 'zfs') was
passed in, resulting in subvol-disks not to be renamed correctly.

Fixes: a97d3ee ("Introduce allow_rename parameter for pvesm import and storage_migrate")
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 PVE/Storage/ZFSPoolPlugin.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index e952a5c..343f833 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -770,7 +770,9 @@ sub volume_import {
     die "internal error: invalid file handle for volume_import\n"
 	if !defined($fd);
 
-    my (undef, $dataset, $vmid) = $class->parse_volname($volname);
+    my (undef, $dataset, $vmid, undef, undef, undef, $volume_format) =
+	$class->parse_volname($volname);
+
     my $zfspath = "$scfg->{pool}/$dataset";
     my $suffix = defined($base_snapshot) ? "\@$base_snapshot" : '';
     my $exists = 0 == run_command(['zfs', 'get', '-H', 'name', $zfspath.$suffix],
@@ -780,7 +782,7 @@ sub volume_import {
     } elsif ($exists) {
 	die "volume '$zfspath' already exists\n" if !$allow_rename;
 	warn "volume '$zfspath' already exists - importing with a different name\n";
-	$dataset = $class->find_free_diskname($storeid, $scfg, $vmid, $format);
+	$dataset = $class->find_free_diskname($storeid, $scfg, $vmid, $volume_format);
 	$zfspath = "$scfg->{pool}/$dataset";
     }
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] applied series: [PATCH-SERIES container/storage] migration fixes for containers
  2022-03-03 12:31 [pve-devel] [PATCH-SERIES container/storage] migration fixes for containers Fabian Ebner
                   ` (2 preceding siblings ...)
  2022-03-03 12:31 ` [pve-devel] [PATCH storage 1/1] zfs: volume import: use correct format for renaming Fabian Ebner
@ 2022-03-03 13:40 ` Wolfgang Bumiller
  3 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Bumiller @ 2022-03-03 13:40 UTC (permalink / raw)
  To: Fabian Ebner; +Cc: pve-devel

applied, thanks

On Thu, Mar 03, 2022 at 01:31:18PM +0100, Fabian Ebner wrote:
> The recent changes to support setting target storage and allow
> renaming led to two problems with unused and unreferenced disks, as
> well as exposing a bug in ZFSPoolPlugin.pm's volume_import.
> 
> 
> container:
> 
> Fabian Ebner (2):
>   migrate: also set targetsid for unreferenced disks
>   config: print volume: support printing unused volume
> 
>  src/PVE/LXC/Config.pm  | 9 +++++++++
>  src/PVE/LXC/Migrate.pm | 1 +
>  2 files changed, 10 insertions(+)
> 
> 
> storage:
> 
> Fabian Ebner (1):
>   zfs: volume import: use correct format for renaming
> 
>  PVE/Storage/ZFSPoolPlugin.pm | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> -- 
> 2.30.2




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-03 13:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 12:31 [pve-devel] [PATCH-SERIES container/storage] migration fixes for containers Fabian Ebner
2022-03-03 12:31 ` [pve-devel] [PATCH container 1/2] migrate: also set targetsid for unreferenced disks Fabian Ebner
2022-03-03 12:31 ` [pve-devel] [PATCH container 2/2] config: print volume: support printing unused volume Fabian Ebner
2022-03-03 12:31 ` [pve-devel] [PATCH storage 1/1] zfs: volume import: use correct format for renaming Fabian Ebner
2022-03-03 13:40 ` [pve-devel] applied series: [PATCH-SERIES container/storage] migration fixes for containers Wolfgang Bumiller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal