The qm CLI command offer the config and showcmd functions. Both of those
outputs may vary with respect to a given snapshot. This adds a switch
that shows the corresponding snapshot's config and command line.
The code needs a newer libpve-guest-common-perl, thus bumping the
dependency.
Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
default => 0,
type => 'boolean',
},
default => 0,
type => 'boolean',
},
+ snapshot => get_standard_option('pve-snapshot-name', {
+ description => "Fetch config values from given snapshot.",
+ optional => 1,
+ completion => sub {
+ my ($cmd, $pname, $cur, $args) = @_;
+ PVE::QemuConfig->snapshot_list($args->[0]);
+ },
+ }),
my $conf = PVE::QemuConfig->load_config($param->{vmid});
my $conf = PVE::QemuConfig->load_config($param->{vmid});
+ my $snapname = $param->{snapshot};
+ if ($snapname) {
+ my $snapshot = $conf->{snapshots}->{$snapname};
+ die "snapshot '$snapname' does not exist\n"
+ if !defined($snapshot);
+
+ # we need the digest of the file
+ $snapshot->{digest} = $conf->{digest};
+ $conf = $snapshot;
+ }
+
delete $conf->{snapshots};
if (!$param->{current}) {
delete $conf->{snapshots};
if (!$param->{current}) {
type => 'boolean',
optional => 1,
default => 0,
type => 'boolean',
optional => 1,
default => 0,
+ },
+ snapshot => get_standard_option('pve-snapshot-name', {
+ description => "Fetch config values from given snapshot.",
+ optional => 1,
+ completion => sub {
+ my ($cmd, $pname, $cur, $args) = @_;
+ PVE::QemuConfig->snapshot_list($args->[0]);
+ }
+ }),
},
},
returns => { type => 'null'},
},
},
returns => { type => 'null'},
my ($param) = @_;
my $storecfg = PVE::Storage::config();
my ($param) = @_;
my $storecfg = PVE::Storage::config();
- my $cmdline = PVE::QemuServer::vm_commandline($storecfg, $param->{vmid});
+ my $cmdline = PVE::QemuServer::vm_commandline($storecfg, $param->{vmid}, $param->{snapshot});
$cmdline =~ s/ -/ \\\n -/g if $param->{pretty};
$cmdline =~ s/ -/ \\\n -/g if $param->{pretty};
- my ($storecfg, $vmid) = @_;
+ my ($storecfg, $vmid, $snapname) = @_;
my $conf = PVE::QemuConfig->load_config($vmid);
my $conf = PVE::QemuConfig->load_config($vmid);
+ if ($snapname) {
+ my $snapshot = $conf->{snapshots}->{$snapname};
+ die "snapshot '$snapname' does not exist\n"
+ if !defined($snapshot);
+ my $digest = $conf->{digest};
+
+ # we need the digest of the file
+ $snapshot->{digest} = $conf->{digest};
+ $conf = $snapshot;
+ }
+
my $defaults = load_defaults();
my $cmd = config_to_command($storecfg, $vmid, $conf, $defaults);
my $defaults = load_defaults();
my $cmd = config_to_command($storecfg, $vmid, $conf, $defaults);
libio-multiplex-perl,
libjson-c-dev,
libpve-common-perl (>= 5.0-42),
libio-multiplex-perl,
libjson-c-dev,
libpve-common-perl (>= 5.0-42),
- libpve-guest-common-perl (>= 2.0-18),
+ libpve-guest-common-perl (>= 2.0-19),
libpve-storage-perl,
libtest-mockmodule-perl,
libxml-libxml-perl,
libpve-storage-perl,
libtest-mockmodule-perl,
libxml-libxml-perl,