[pve-devel] [PATCH qemu-server 1/2] Add 'runningmachine' support to vm_commandline

Stefan Reiter s.reiter at proxmox.com
Wed Nov 20 13:24:56 CET 2019


to allow 'qm showcmd --snapshot ...' to show the correct machine type.

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
 PVE/QemuServer.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 11e7169..e6369c1 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5639,11 +5639,15 @@ sub vm_commandline {
     my ($storecfg, $vmid, $snapname) = @_;
 
     my $conf = PVE::QemuConfig->load_config($vmid);
+    my $forcemachine;
 
     if ($snapname) {
 	my $snapshot = $conf->{snapshots}->{$snapname};
 	die "snapshot '$snapname' does not exist\n" if !defined($snapshot);
 
+	# check for a 'runningmachine' in snapshot
+	$forcemachine = $snapshot->{runningmachine} if $snapshot->{runningmachine};
+
 	$snapshot->{digest} = $conf->{digest}; # keep file digest for API
 
 	$conf = $snapshot;
@@ -5651,7 +5655,7 @@ sub vm_commandline {
 
     my $defaults = load_defaults();
 
-    my $cmd = config_to_command($storecfg, $vmid, $conf, $defaults);
+    my $cmd = config_to_command($storecfg, $vmid, $conf, $defaults, $forcemachine);
 
     return PVE::Tools::cmd2string($cmd);
 }
-- 
2.20.1





More information about the pve-devel mailing list