* [pve-devel] [PATCH qemu-server 1/3] qmrestore: add live-restore option
@ 2021-04-21 14:25 Stefan Reiter
2021-04-21 14:25 ` [pve-devel] [PATCH qemu-server 2/3] live-restore: don't remove VM on error Stefan Reiter
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stefan Reiter @ 2021-04-21 14:25 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
PVE/CLI/qmrestore.pm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/PVE/CLI/qmrestore.pm b/PVE/CLI/qmrestore.pm
index cb5c122..7c09814 100755
--- a/PVE/CLI/qmrestore.pm
+++ b/PVE/CLI/qmrestore.pm
@@ -58,7 +58,12 @@ __PACKAGE__->register_method({
optional => 1,
type => 'number',
minimum => '0',
- }
+ },
+ 'live-restore' => {
+ optional => 1,
+ type => 'boolean',
+ description => "Start the VM immediately from the backup and restore in background. PBS only.",
+ },
},
},
returns => {
--
2.20.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pve-devel] [PATCH qemu-server 2/3] live-restore: don't remove VM on error
2021-04-21 14:25 [pve-devel] [PATCH qemu-server 1/3] qmrestore: add live-restore option Stefan Reiter
@ 2021-04-21 14:25 ` Stefan Reiter
2021-04-21 14:25 ` [pve-devel] [PATCH qemu-server 3/3] live-restore: hold 'create' lock during operation Stefan Reiter
2021-04-21 15:56 ` [pve-devel] applied-series: [PATCH qemu-server 1/3] qmrestore: add live-restore option Thomas Lamprecht
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Reiter @ 2021-04-21 14:25 UTC (permalink / raw)
To: pve-devel
Potentially an admin can still recover some data, or wants to inspect
the state.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
The message printed in the task log already suggest as much.
PVE/QemuServer.pm | 29 +++++++++--------------------
1 file changed, 9 insertions(+), 20 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index fec2edb..d042a7e 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6386,28 +6386,17 @@ sub restore_proxmox_backup_archive {
PVE::AccessControl::add_vm_to_pool($vmid, $options->{pool}) if $options->{pool};
if ($options->{live}) {
- eval {
- # enable interrupts
- local $SIG{INT} =
- local $SIG{TERM} =
- local $SIG{QUIT} =
- local $SIG{HUP} =
- local $SIG{PIPE} = sub { die "got signal ($!) - abort\n"; };
+ # enable interrupts
+ local $SIG{INT} =
+ local $SIG{TERM} =
+ local $SIG{QUIT} =
+ local $SIG{HUP} =
+ local $SIG{PIPE} = sub { die "got signal ($!) - abort\n"; };
- my $conf = PVE::QemuConfig->load_config($vmid);
- die "cannot do live-restore for template\n" if PVE::QemuConfig->is_template($conf);
+ my $conf = PVE::QemuConfig->load_config($vmid);
+ die "cannot do live-restore for template\n" if PVE::QemuConfig->is_template($conf);
- pbs_live_restore($vmid, $conf, $storecfg, $devinfo, $repo, $keyfile, $pbs_backup_name);
- };
-
- $err = $@;
- if ($err) {
- warn "destroying partially live-restored VM, all temporary data will be lost!\n";
- $restore_deactivate_volumes->($storecfg, $devinfo);
- $restore_destroy_volumes->($storecfg, $devinfo);
- PVE::QemuConfig->destroy_config($vmid);
- die $err;
- }
+ pbs_live_restore($vmid, $conf, $storecfg, $devinfo, $repo, $keyfile, $pbs_backup_name);
}
}
--
2.20.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pve-devel] [PATCH qemu-server 3/3] live-restore: hold 'create' lock during operation
2021-04-21 14:25 [pve-devel] [PATCH qemu-server 1/3] qmrestore: add live-restore option Stefan Reiter
2021-04-21 14:25 ` [pve-devel] [PATCH qemu-server 2/3] live-restore: don't remove VM on error Stefan Reiter
@ 2021-04-21 14:25 ` Stefan Reiter
2021-04-21 15:56 ` [pve-devel] applied-series: [PATCH qemu-server 1/3] qmrestore: add live-restore option Thomas Lamprecht
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Reiter @ 2021-04-21 14:25 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
PVE/QemuServer.pm | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index d042a7e..8b9c40d 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6376,6 +6376,11 @@ sub restore_proxmox_backup_archive {
die $err;
}
+ if ($options->{live}) {
+ # keep lock during live-restore
+ $new_conf_raw .= "\nlock: create";
+ }
+
PVE::Tools::file_set_contents($conffile, $new_conf_raw);
PVE::Cluster::cfs_update(); # make sure we read new file
@@ -6397,6 +6402,8 @@ sub restore_proxmox_backup_archive {
die "cannot do live-restore for template\n" if PVE::QemuConfig->is_template($conf);
pbs_live_restore($vmid, $conf, $storecfg, $devinfo, $repo, $keyfile, $pbs_backup_name);
+
+ PVE::QemuConfig->remove_lock($vmid, "create");
}
}
--
2.20.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pve-devel] applied-series: [PATCH qemu-server 1/3] qmrestore: add live-restore option
2021-04-21 14:25 [pve-devel] [PATCH qemu-server 1/3] qmrestore: add live-restore option Stefan Reiter
2021-04-21 14:25 ` [pve-devel] [PATCH qemu-server 2/3] live-restore: don't remove VM on error Stefan Reiter
2021-04-21 14:25 ` [pve-devel] [PATCH qemu-server 3/3] live-restore: hold 'create' lock during operation Stefan Reiter
@ 2021-04-21 15:56 ` Thomas Lamprecht
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2021-04-21 15:56 UTC (permalink / raw)
To: Proxmox VE development discussion, Stefan Reiter
On 21.04.21 16:25, Stefan Reiter wrote:
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
> PVE/CLI/qmrestore.pm | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
>
applied all three patches, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-21 15:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 14:25 [pve-devel] [PATCH qemu-server 1/3] qmrestore: add live-restore option Stefan Reiter
2021-04-21 14:25 ` [pve-devel] [PATCH qemu-server 2/3] live-restore: don't remove VM on error Stefan Reiter
2021-04-21 14:25 ` [pve-devel] [PATCH qemu-server 3/3] live-restore: hold 'create' lock during operation Stefan Reiter
2021-04-21 15:56 ` [pve-devel] applied-series: [PATCH qemu-server 1/3] qmrestore: add live-restore option Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox