]> git.proxmox.com Git - qemu-server.git/commitdiff
Add 'runningmachine' support to vm_commandline
authorStefan Reiter <s.reiter@proxmox.com>
Wed, 20 Nov 2019 12:24:56 +0000 (13:24 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 20 Nov 2019 15:11:44 +0000 (16:11 +0100)
to allow 'qm showcmd --snapshot ...' to show the correct machine type.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
PVE/QemuServer.pm

index 2a3d6df6bbb0a0ff7a6c74a14949b5b1f3dc2bc4..c28e7b43b4ef702713e5a6ae08a1d0ed8d54232a 100644 (file)
@@ -5626,11 +5626,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;
@@ -5638,7 +5642,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);
 }