[pve-devel] [PATCH container 2/2] restore: add more informational messages

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Nov 25 15:07:50 CET 2020


to provide context for warnings/output created by various sub-operations.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 src/PVE/API2/LXC.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index a263104..824da40 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -354,6 +354,7 @@ __PACKAGE__->register_method({
 		    die "can't overwrite running container\n" if PVE::LXC::check_running($vmid);
 		    if ($is_root && $archive ne '-') {
 			my $orig_conf;
+			print "recovering backed-up configuration from '$archive'\n";
 			($orig_conf, $orig_mp_param) = PVE::LXC::Create::recover_config($storage_cfg, $archive, $vmid);
 			$was_template = delete $orig_conf->{template};
 			# When we're root call 'restore_configuration' with restricted=0,
@@ -366,6 +367,7 @@ __PACKAGE__->register_method({
 		if ($storage_only_mode) {
 		    if ($restore) {
 			if (!defined($orig_mp_param)) {
+			    print "recovering backed-up configuration from '$archive'\n";
 			    (undef, $orig_mp_param) = PVE::LXC::Create::recover_config($storage_cfg, $archive, $vmid);
 			}
 			$mp_param = $orig_mp_param;
@@ -414,9 +416,12 @@ __PACKAGE__->register_method({
 		eval {
 		    my $rootdir = PVE::LXC::mount_all($vmid, $storage_cfg, $conf, 1);
 		    $bwlimit = PVE::Storage::get_bandwidth_limit('restore', [keys %used_storages], $bwlimit);
+		    print "restoring '$archive' now..\n"
+			if $restore && $archive ne '-';
 		    PVE::LXC::Create::restore_archive($storage_cfg, $archive, $rootdir, $conf, $ignore_unpack_errors, $bwlimit);
 
 		    if ($restore) {
+			print "merging backed-up and given configuration..\n";
 			PVE::LXC::Create::restore_configuration($vmid, $storage_cfg, $archive, $rootdir, $conf, !$is_root, $unique, $skip_fw_config_restore);
 			my $lxc_setup = PVE::LXC::Setup->new($conf, $rootdir);
 			$lxc_setup->template_fixup($conf);
-- 
2.20.1






More information about the pve-devel mailing list