[pve-devel] [PATCH container] fix #1078: accept arch parameter

Dominik Csapak d.csapak at proxmox.com
Thu Aug 11 11:12:52 CEST 2016


we now accept the arch parameter,
when value is valid according to the JSONSchema
and skip detection on creation/restoration when we
explicitly set one

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/PVE/LXC/Config.pm | 2 +-
 src/PVE/LXC/Create.pm | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index cfe952f..1efb178 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -865,7 +865,7 @@ sub update_pct_config {
     foreach my $opt (keys %$param) {
 	my $value = $param->{$opt};
 	my $check_protection_msg = "can't update CT $vmid drive '$opt'";
-	if ($opt eq 'hostname') {
+	if ($opt eq 'hostname' || $opt eq 'arch') {
 	    $conf->{$opt} = $value;
 	} elsif ($opt eq 'onboot') {
 	    $conf->{$opt} = $value ? 1 : 0;
diff --git a/src/PVE/LXC/Create.pm b/src/PVE/LXC/Create.pm
index 98a799f..aea6ad3 100644
--- a/src/PVE/LXC/Create.pm
+++ b/src/PVE/LXC/Create.pm
@@ -49,7 +49,10 @@ sub restore_archive {
 	eval { PVE::Tools::run_command($cmd); };
     }
     die $@ if $@ && !$no_unpack_error;
-    
+
+    # if arch is set, we do not try to autodetect it
+    return if defined($conf->{arch});
+
     # determine file type of /usr/bin/file itself to get guests' architecture
     $cmd = [@$userns_cmd, '/usr/bin/file', '-b', '-L', "$rootdir/bin/sh"];
     PVE::Tools::run_command($cmd, outfunc => sub {
-- 
2.1.4





More information about the pve-devel mailing list