if (my $err = $@) {
eval {
my $conffile = PVE::QemuConfig->config_file($vmid);
- unlink($conffile)
- or die "failed to remove config file: $@\n";
+ unlink($conffile) or die "failed to remove config file: $!\n";
};
warn $@ if $@;
die $err;
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]);
+ },
+ }),
},
},
returns => {
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}) {
(undef, $family) = PVE::Cluster::remote_node_ip($node);
my $sshinfo = PVE::Cluster::get_ssh_info($node);
# NOTE: kvm VNC traffic is already TLS encrypted or is known unsecure
- $remcmd = PVE::Cluster::ssh_info_to_command($sshinfo, '-T');
+ $remcmd = PVE::Cluster::ssh_info_to_command($sshinfo, $use_serial ? '-t' : '-T');
} else {
$family = PVE::Tools::get_host_address_family($node);
}