[pve-devel] [PATCH 3/3] Fix warning if restore from OpenVZ
Wolfgang Link
w.link at proxmox.com
Fri Jul 31 11:47:40 CEST 2015
---
src/PVE/API2/LXC.pm | 12 +++++++++---
src/PVE/LXCCreate.pm | 5 +++--
src/PVE/VZDump/ConvertOVZ.pm | 5 -----
3 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 3e4e862..3bde6c1 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -241,9 +241,10 @@ __PACKAGE__->register_method({
}
my $conf = {};
-
+ my $ovs;
+
if ($restore) {
- $conf = PVE::LXCCreate::recover_config($archive);
+ ($conf, $ovs) = PVE::LXCCreate::recover_config($archive);
PVE::LXC::lxc_config_change_vmid($conf, $vmid);
}
@@ -279,7 +280,12 @@ __PACKAGE__->register_method({
PVE::Cluster::check_cfs_quorum();
$param->{disk} = $conf->{'pve.disksize'} if !$param->{disk} && $restore;
-
+ if($ovs) {
+ print "###########################################################\n";
+ print "Converting OpenVZ configuration to LXC.\n";
+ print "Please check the configuration and reconfigure the network.\n";
+ print "###########################################################\n";
+ }
PVE::LXCCreate::create_rootfs($storage_cfg, $storage, $param->{disk}, $vmid, $conf,
$archive, $password, $restore);
};
diff --git a/src/PVE/LXCCreate.pm b/src/PVE/LXCCreate.pm
index ad5fcbc..3096008 100644
--- a/src/PVE/LXCCreate.pm
+++ b/src/PVE/LXCCreate.pm
@@ -106,6 +106,7 @@ sub recover_config {
my $conf_file = tar_archive_search_conf($archive);
+ my $ovs;
my $raw = '';
my $out = sub {
my $output = shift;
@@ -125,7 +126,7 @@ sub recover_config {
delete $conf->{snapshots};
} elsif ($conf_file =~ m/vps\.conf/) {
-
+ $ovs = 1;
$conf = PVE::VZDump::ConvertOVZ::convert_ovz($raw);
} else {
@@ -133,7 +134,7 @@ sub recover_config {
die "internal error";
}
- return $conf;
+ return $conf, $ovs;
}
sub restore_and_configure {
diff --git a/src/PVE/VZDump/ConvertOVZ.pm b/src/PVE/VZDump/ConvertOVZ.pm
index 3b078bf..85f747a 100644
--- a/src/PVE/VZDump/ConvertOVZ.pm
+++ b/src/PVE/VZDump/ConvertOVZ.pm
@@ -296,11 +296,6 @@ my $parse_ovz_config = sub {
sub convert_ovz {
my ($raw) = @_;
- print "###########################################################\n";
- print "Converting OpenVZ configuration to LXC.\n";
- print "Please check the configuration and reconfigure the network.\n";
- print "###########################################################\n";
-
my $conf = {};
my $ovz_conf = &$parse_ovz_config($raw);
--
2.1.4
More information about the pve-devel
mailing list