keyboard => {
optional => 1,
type => 'string',
- description => "Keybord layout for vnc server. Default is read from the '/etc/pve/datacenter.conf' configuration file.",
+ description => "Keybord layout for vnc server. Default is read from the '/etc/pve/datacenter.conf' configuration file.".
+ "It should not be necessary to set it.",
enum => PVE::Tools::kvmkeymaplist(),
- default => 'en-us',
+ default => undef,
},
name => {
optional => 1,
w2k8;; Microsoft Windows 2008
wvista;; Microsoft Windows Vista
win7;; Microsoft Windows 7
-win8;; Microsoft Windows 8/2012
+win8;; Microsoft Windows 8/2012/2012r2
+win10;; Microsoft Windows 10/2016
l24;; Linux 2.4 Kernel
l26;; Linux 2.6/3.X Kernel
solaris;; Solaris/OpenSolaris/OpenIndiania kernel
my $storecfg = PVE::Storage::config();
my $list = vzlist();
+ my $defaults = load_defaults();
+
my ($uptime) = PVE::ProcFSTools::read_proc_uptime(1);
my $cpucount = $cpuinfo->{cpus} || 1;
$d->{maxdisk} = 0;
}
- $d->{cpus} = ($conf->{sockets} || 1) * ($conf->{cores} || 1);
+ $d->{cpus} = ($conf->{sockets} || $defaults->{sockets})
+ * ($conf->{cores} || $defaults->{cores});
$d->{cpus} = $cpucount if $d->{cpus} > $cpucount;
$d->{cpus} = $conf->{vcpus} if $conf->{vcpus};
$d->{name} = $conf->{name} || "VM $vmid";
- $d->{maxmem} = $conf->{memory} ? $conf->{memory}*(1024*1024) : 0;
+ $d->{maxmem} = $conf->{memory} ? $conf->{memory}*(1024*1024)
+ : $defaults->{memory}*(1024*1024);
if ($conf->{balloon}) {
$d->{balloon_min} = $conf->{balloon}*(1024*1024);
- $d->{shares} = defined($conf->{shares}) ? $conf->{shares} : 1000;
+ $d->{shares} = defined($conf->{shares}) ? $conf->{shares}
+ : $defaults->{shares};
}
$d->{uptime} = 0;
my $changes;
- my $used = {};
+ # used and unused disks
+ my $referenced = {};
# Note: it is allowed to define multiple storages with same path (alias), so
# we need to check both 'volid' and real 'path' (two different volid can point
# to the same path).
- my $usedpath = {};
+ my $referencedpath = {};
# update size info
foreach my $opt (keys %$conf) {
my $volid = $drive->{file};
next if !$volid;
- $used->{$volid} = 1;
+ $referenced->{$volid} = 1;
if ($volid_hash->{$volid} &&
(my $path = $volid_hash->{$volid}->{path})) {
- $usedpath->{$path} = 1;
+ $referencedpath->{$path} = 1;
}
next if drive_is_cdrom($drive);
next if $opt !~ m/^unused\d+$/;
my $volid = $conf->{$opt};
my $path = $volid_hash->{$volid}->{path} if $volid_hash->{$volid};
- if ($used->{$volid} || ($path && $usedpath->{$path})) {
+ if ($referenced->{$volid} || ($path && $referencedpath->{$path})) {
$changes = 1;
delete $conf->{$opt};
}
+
+ $referenced->{$volid} = 1;
+ $referencedpath->{$path} = 1 if $path;
}
foreach my $volid (sort keys %$volid_hash) {
next if $volid =~ m/vm-$vmid-state-/;
- next if $used->{$volid};
+ next if $referenced->{$volid};
my $path = $volid_hash->{$volid}->{path};
next if !$path; # just to be sure
- next if $usedpath->{$path};
+ next if $referencedpath->{$path};
$changes = 1;
PVE::QemuConfig->add_unused_volume($conf, $volid);
- $usedpath->{$path} = 1; # avoid to add more than once (aliases)
+ $referencedpath->{$path} = 1; # avoid to add more than once (aliases)
}
return $changes;
eval { vm_mon_cmd($vmid, "guest-ping", timeout => 3); };
if ($@) {
- warn "Qemu Guest Agent are not running - $@";
+ warn "Qemu Guest Agent is not running - $@";
return 0;
}
return 1;
last if $skipcomplete; #do the complete later
if ($vmiddst && $vmiddst != $vmid) {
- if ($qga) {
+ my $agent_running = $qga && qga_check_running($vmid);
+ if ($agent_running) {
print "freeze filesystem\n";
eval { PVE::QemuServer::vm_mon_cmd($vmid, "guest-fsfreeze-freeze"); };
} else {
# if we clone a disk for a new target vm, we don't switch the disk
PVE::QemuServer::qemu_blockjobs_cancel($vmid, $jobs);
- if ($qga) {
+ if ($agent_running) {
print "unfreeze filesystem\n";
eval { PVE::QemuServer::vm_mon_cmd($vmid, "guest-fsfreeze-thaw"); };
} else {