[pve-devel] [RFC/PATCH v2 container 5/5] vmstatus: make lock property optional again

Fabian Ebner f.ebner at proxmox.com
Thu Mar 11 11:26:50 CET 2021


Commit d02262048cbbe91ca8b12f98e3dc7bbab28e4c64 made the property de-facto
non-optional. Partially revert this and instead adapt the printing, making the
behavior match the API description again. The conditional assignment is
already there further down the vmstatus function.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

New in v2.

Alternatively, the property description should be updated, but this patch makes
it in line with what we do for VMs and is preferable IMHO.

 src/PVE/CLI/pct.pm | 3 ++-
 src/PVE/LXC.pm     | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 856d5a5..69faf8d 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -810,7 +810,8 @@ our $cmddef = {
 	my $format = "%-10s %-10s %-12s %-20s\n";
 	printf($format, 'VMID', 'Status', 'Lock', 'Name');
 	foreach my $d (sort {$a->{vmid} <=> $b->{vmid} } @$res) {
-	    printf($format, $d->{vmid}, $d->{status}, $d->{lock}, $d->{name});
+	    my $lock = $d->{lock} || '';
+	    printf($format, $d->{vmid}, $d->{status}, $lock, $d->{name});
 	}
     }],
     config => [ "PVE::API2::LXC::Config", 'vm_config', ['vmid'], 
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 082cab8..7a52196 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -203,7 +203,6 @@ sub vmstatus {
 	$d->{cpus} = $conf->{cores} || $conf->{cpulimit};
 	$d->{cpus} = $cpucount if !$d->{cpus};
 
-	$d->{lock} = $conf->{lock} || '';
 	$d->{tags} = $conf->{tags} if defined($conf->{tags});
 
 	if ($d->{pid}) {
-- 
2.20.1






More information about the pve-devel mailing list