public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu/qemu-server] fix #4119: allow namespaces for live-restore
@ 2022-06-22 12:57 Dominik Csapak
  2022-06-22 12:57 ` [pve-devel] [PATCH qemu 1/1] add 'namespace' to BlockdevOptionsPbs Dominik Csapak
  2022-06-22 12:57 ` [pve-devel] [PATCH qemu-server 1/1] fix #4119: give namespace parameter to live-restore Dominik Csapak
  0 siblings, 2 replies; 5+ messages in thread
From: Dominik Csapak @ 2022-06-22 12:57 UTC (permalink / raw)
  To: pve-devel

we forgot to add the namespace there, so add it.
for it to work, qemu-server depends on new pve-qemu, but if that's not
available, it errors out (but probably better than restoring the
potentially wrong snapshot).

also, i squashed the changes into the 'pbs-namespace' patch instead
of adding a new one, since there is only a single new line changed.
hope that's ok

pve-qemu:

Dominik Csapak (1):
  add 'namespace' to BlockdevOptionsPbs

 .../patches/pve/0052-pbs-namespace-support.patch | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

qemu-server:

Dominik Csapak (1):
  fix #4119: give namespace parameter to live-restore

 PVE/QemuServer.pm | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

-- 
2.30.2





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

* [pve-devel] [PATCH qemu 1/1] add 'namespace' to BlockdevOptionsPbs
  2022-06-22 12:57 [pve-devel] [PATCH qemu/qemu-server] fix #4119: allow namespaces for live-restore Dominik Csapak
@ 2022-06-22 12:57 ` Dominik Csapak
  2022-06-22 13:11   ` [pve-devel] applied: " Thomas Lamprecht
  2022-06-22 12:57 ` [pve-devel] [PATCH qemu-server 1/1] fix #4119: give namespace parameter to live-restore Dominik Csapak
  1 sibling, 1 reply; 5+ messages in thread
From: Dominik Csapak @ 2022-06-22 12:57 UTC (permalink / raw)
  To: pve-devel

so that we can use it for the -blockdev options (used for live-restore)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 .../patches/pve/0052-pbs-namespace-support.patch | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/debian/patches/pve/0052-pbs-namespace-support.patch b/debian/patches/pve/0052-pbs-namespace-support.patch
index b65da90..74c0a87 100644
--- a/debian/patches/pve/0052-pbs-namespace-support.patch
+++ b/debian/patches/pve/0052-pbs-namespace-support.patch
@@ -9,8 +9,8 @@ Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
  block/pbs.c                    | 25 +++++++++++++++++++++----
  pbs-restore.c                  | 19 ++++++++++++++++---
  pve-backup.c                   |  6 +++++-
- qapi/block-core.json           |  3 +++
- 5 files changed, 46 insertions(+), 8 deletions(-)
+ qapi/block-core.json           |  5 ++++-
+ 5 files changed, 47 insertions(+), 9 deletions(-)
 
 diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
 index 52ddbf95ad..69c868887a 100644
@@ -222,3 +222,15 @@ index c5023710f5..619e13b9b1 100644
                                      '*backup-id': 'str',
                                      '*backup-time': 'int',
                                      '*use-dirty-bitmap': 'bool',
+@@ -3236,7 +3239,7 @@
+ { 'struct': 'BlockdevOptionsPbs',
+   'data': { 'repository': 'str', 'snapshot': 'str', 'archive': 'str',
+             '*keyfile': 'str', '*password': 'str', '*fingerprint': 'str',
+-            '*key_password': 'str' } }
++            '*key_password': 'str', '*namespace': 'str' } }
+ 
+ ##
+ # @BlockdevOptionsNVMe:
+-- 
+2.30.2
+
-- 
2.30.2





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

* [pve-devel] [PATCH qemu-server 1/1] fix #4119: give namespace parameter to live-restore
  2022-06-22 12:57 [pve-devel] [PATCH qemu/qemu-server] fix #4119: allow namespaces for live-restore Dominik Csapak
  2022-06-22 12:57 ` [pve-devel] [PATCH qemu 1/1] add 'namespace' to BlockdevOptionsPbs Dominik Csapak
@ 2022-06-22 12:57 ` Dominik Csapak
  2022-06-29 12:02   ` [pve-devel] applied: " Wolfgang Bumiller
  1 sibling, 1 reply; 5+ messages in thread
From: Dominik Csapak @ 2022-06-22 12:57 UTC (permalink / raw)
  To: pve-devel

we forgot to give the namespace parameter here, so do that.
while we're at it, give the pbs options as a hash instead of adding
another parameter.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 PVE/QemuServer.pm | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index b3964bc..09c0df4 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1717,6 +1717,7 @@ sub print_pbs_blockdev {
     my ($pbs_conf, $pbs_name) = @_;
     my $blockdev = "driver=pbs,node-name=$pbs_name,read-only=on";
     $blockdev .= ",repository=$pbs_conf->{repository}";
+    $blockdev .= ",namespace=$pbs_conf->{namespace}" if $pbs_conf->{namespace};
     $blockdev .= ",snapshot=$pbs_conf->{snapshot}";
     $blockdev .= ",archive=$pbs_conf->{archive}";
     $blockdev .= ",keyfile=$pbs_conf->{keyfile}" if $pbs_conf->{keyfile};
@@ -6652,6 +6653,7 @@ sub restore_proxmox_backup_archive {
     my $keyfile = PVE::Storage::PBSPlugin::pbs_encryption_key_file_name($storecfg, $storeid);
 
     my $repo = PVE::PBSClient::get_repository($scfg);
+    my $namespace = $scfg->{namespace};
 
     # This is only used for `pbs-restore` and the QEMU PBS driver (live-restore)
     my $password = PVE::Storage::PBSPlugin::pbs_get_password($scfg, $storeid);
@@ -6842,28 +6844,36 @@ sub restore_proxmox_backup_archive {
 	# these special drives are already restored before start
 	delete $devinfo->{'drive-efidisk0'};
 	delete $devinfo->{'drive-tpmstate0-backup'};
-	pbs_live_restore($vmid, $conf, $storecfg, $devinfo, $repo, $keyfile, $pbs_backup_name);
+
+	my $pbs_opts = {
+	    repo => $repo,
+	    keyfile => $keyfile,
+	    snapshot => $pbs_backup_name,
+	    namespace => $namespace,
+	};
+	pbs_live_restore($vmid, $conf, $storecfg, $devinfo, $pbs_opts);
 
 	PVE::QemuConfig->remove_lock($vmid, "create");
     }
 }
 
 sub pbs_live_restore {
-    my ($vmid, $conf, $storecfg, $restored_disks, $repo, $keyfile, $snap) = @_;
+    my ($vmid, $conf, $storecfg, $restored_disks, $opts) = @_;
 
     print "starting VM for live-restore\n";
-    print "repository: '$repo', snapshot: '$snap'\n";
+    print "repository: '$opts->{repo}', snapshot: '$opts->{snapshot}'\n";
 
     my $pbs_backing = {};
     for my $ds (keys %$restored_disks) {
 	$ds =~ m/^drive-(.*)$/;
 	my $confname = $1;
 	$pbs_backing->{$confname} = {
-	    repository => $repo,
-	    snapshot => $snap,
+	    repository => $opts->{repo},
+	    snapshot => $opts->{snapshot},
 	    archive => "$ds.img.fidx",
 	};
-	$pbs_backing->{$confname}->{keyfile} = $keyfile if -e $keyfile;
+	$pbs_backing->{$confname}->{keyfile} = $opts->{keyfile} if -e $opts->{keyfile};
+	$pbs_backing->{$confname}->{namespace} = $opts->{namespace} if defined($opts->{namespace});
 
 	my $drive = parse_drive($confname, $conf->{$confname});
 	print "restoring '$ds' to '$drive->{file}'\n";
-- 
2.30.2





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

* [pve-devel] applied: [PATCH qemu 1/1] add 'namespace' to BlockdevOptionsPbs
  2022-06-22 12:57 ` [pve-devel] [PATCH qemu 1/1] add 'namespace' to BlockdevOptionsPbs Dominik Csapak
@ 2022-06-22 13:11   ` Thomas Lamprecht
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2022-06-22 13:11 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Am 22/06/2022 um 14:57 schrieb Dominik Csapak:
> so that we can use it for the -blockdev options (used for live-restore)
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  .../patches/pve/0052-pbs-namespace-support.patch | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
>

applied, thanks!




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

* [pve-devel] applied: [PATCH qemu-server 1/1] fix #4119: give namespace parameter to live-restore
  2022-06-22 12:57 ` [pve-devel] [PATCH qemu-server 1/1] fix #4119: give namespace parameter to live-restore Dominik Csapak
@ 2022-06-29 12:02   ` Wolfgang Bumiller
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Bumiller @ 2022-06-29 12:02 UTC (permalink / raw)
  To: Dominik Csapak; +Cc: pve-devel

just ran into this again and noticed this patch was still missing

applied

On Wed, Jun 22, 2022 at 02:57:35PM +0200, Dominik Csapak wrote:
> we forgot to give the namespace parameter here, so do that.
> while we're at it, give the pbs options as a hash instead of adding
> another parameter.
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  PVE/QemuServer.pm | 22 ++++++++++++++++------
>  1 file changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index b3964bc..09c0df4 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -1717,6 +1717,7 @@ sub print_pbs_blockdev {
>      my ($pbs_conf, $pbs_name) = @_;
>      my $blockdev = "driver=pbs,node-name=$pbs_name,read-only=on";
>      $blockdev .= ",repository=$pbs_conf->{repository}";
> +    $blockdev .= ",namespace=$pbs_conf->{namespace}" if $pbs_conf->{namespace};
>      $blockdev .= ",snapshot=$pbs_conf->{snapshot}";
>      $blockdev .= ",archive=$pbs_conf->{archive}";
>      $blockdev .= ",keyfile=$pbs_conf->{keyfile}" if $pbs_conf->{keyfile};
> @@ -6652,6 +6653,7 @@ sub restore_proxmox_backup_archive {
>      my $keyfile = PVE::Storage::PBSPlugin::pbs_encryption_key_file_name($storecfg, $storeid);
>  
>      my $repo = PVE::PBSClient::get_repository($scfg);
> +    my $namespace = $scfg->{namespace};
>  
>      # This is only used for `pbs-restore` and the QEMU PBS driver (live-restore)
>      my $password = PVE::Storage::PBSPlugin::pbs_get_password($scfg, $storeid);
> @@ -6842,28 +6844,36 @@ sub restore_proxmox_backup_archive {
>  	# these special drives are already restored before start
>  	delete $devinfo->{'drive-efidisk0'};
>  	delete $devinfo->{'drive-tpmstate0-backup'};
> -	pbs_live_restore($vmid, $conf, $storecfg, $devinfo, $repo, $keyfile, $pbs_backup_name);
> +
> +	my $pbs_opts = {
> +	    repo => $repo,
> +	    keyfile => $keyfile,
> +	    snapshot => $pbs_backup_name,
> +	    namespace => $namespace,
> +	};
> +	pbs_live_restore($vmid, $conf, $storecfg, $devinfo, $pbs_opts);
>  
>  	PVE::QemuConfig->remove_lock($vmid, "create");
>      }
>  }
>  
>  sub pbs_live_restore {
> -    my ($vmid, $conf, $storecfg, $restored_disks, $repo, $keyfile, $snap) = @_;
> +    my ($vmid, $conf, $storecfg, $restored_disks, $opts) = @_;
>  
>      print "starting VM for live-restore\n";
> -    print "repository: '$repo', snapshot: '$snap'\n";
> +    print "repository: '$opts->{repo}', snapshot: '$opts->{snapshot}'\n";
>  
>      my $pbs_backing = {};
>      for my $ds (keys %$restored_disks) {
>  	$ds =~ m/^drive-(.*)$/;
>  	my $confname = $1;
>  	$pbs_backing->{$confname} = {
> -	    repository => $repo,
> -	    snapshot => $snap,
> +	    repository => $opts->{repo},
> +	    snapshot => $opts->{snapshot},
>  	    archive => "$ds.img.fidx",
>  	};
> -	$pbs_backing->{$confname}->{keyfile} = $keyfile if -e $keyfile;
> +	$pbs_backing->{$confname}->{keyfile} = $opts->{keyfile} if -e $opts->{keyfile};
> +	$pbs_backing->{$confname}->{namespace} = $opts->{namespace} if defined($opts->{namespace});
>  
>  	my $drive = parse_drive($confname, $conf->{$confname});
>  	print "restoring '$ds' to '$drive->{file}'\n";
> -- 
> 2.30.2




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

end of thread, other threads:[~2022-06-29 12:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22 12:57 [pve-devel] [PATCH qemu/qemu-server] fix #4119: allow namespaces for live-restore Dominik Csapak
2022-06-22 12:57 ` [pve-devel] [PATCH qemu 1/1] add 'namespace' to BlockdevOptionsPbs Dominik Csapak
2022-06-22 13:11   ` [pve-devel] applied: " Thomas Lamprecht
2022-06-22 12:57 ` [pve-devel] [PATCH qemu-server 1/1] fix #4119: give namespace parameter to live-restore Dominik Csapak
2022-06-29 12:02   ` [pve-devel] applied: " 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