};
__PACKAGE__->register_method({
- name => 'vmlist',
- path => '',
+ name => 'vmlist',
+ path => '',
method => 'GET',
description => "Virtual machine index (per node).",
proxyto => 'node',
}});
__PACKAGE__->register_method({
- name => 'create_vm',
- path => '',
+ name => 'create_vm',
+ path => '',
method => 'POST',
description => "Create or restore a virtual machine.",
protected => 1,
optional => 1,
}),
force => {
- optional => 1,
+ optional => 1,
type => 'boolean',
description => "Allow to overwrite existing VM.",
requires => 'archive',
},
unique => {
- optional => 1,
+ optional => 1,
type => 'boolean',
description => "Assign a unique random ethernet address.",
requires => 'archive',
},
}),
},
- returns => {
+ returns => {
type => 'string',
},
code => sub {
my $unique = extract_param($param, 'unique');
my $filename = PVE::QemuServer::config_file($vmid);
-
- my $storecfg = PVE::Storage::config();
+
+ my $storecfg = PVE::Storage::config();
PVE::Cluster::check_cfs_quorum();
- if (!$archive) {
+ if (!$archive) {
&$resolve_cdrom_alias($param);
foreach my $opt (keys %$param) {
if (PVE::QemuServer::valid_drivename($opt)) {
my $drive = PVE::QemuServer::parse_drive($opt, $param->{$opt});
raise_param_exc({ $opt => "unable to parse drive options" }) if !$drive;
-
+
PVE::QemuServer::cleanup_drive_path($opt, $storecfg, $drive);
$param->{$opt} = PVE::QemuServer::print_drive($vmid, $drive);
}
raise_param_exc({ archive => "option conflicts with other options ($keystr)"}) if $keystr;
if ($archive eq '-') {
- die "pipe requires cli environment\n"
+ die "pipe requires cli environment\n"
&& $rpcenv->{type} ne 'cli';
} else {
my $path;
if (PVE::Storage::parse_volume_id($archive, 1)) {
$path = PVE::Storage::path($storecfg, $archive);
} else {
- raise_param_exc({ archive => "Only root can pass arbitrary paths." })
+ raise_param_exc({ archive => "Only root can pass arbitrary paths." })
if $user ne 'root@pam';
$path = abs_path($archive);
my $restorefn = sub {
if (-f $filename) {
- die "unable to restore vm $vmid: config file already exists\n"
+ die "unable to restore vm $vmid: config file already exists\n"
if !$force;
- die "unable to restore vm $vmid: vm is running\n"
+ die "unable to restore vm $vmid: vm is running\n"
if PVE::QemuServer::check_running($vmid);
# destroy existing data - keep empty config
}
my $realcmd = sub {
- PVE::QemuServer::restore_archive($archive, $vmid, {
+ PVE::QemuServer::restore_archive($archive, $vmid, {
storage => $storage,
unique => $unique });
};
my $createfn = sub {
# second test (after locking test is accurate)
- die "unable to create vm $vmid: config file already exists\n"
+ die "unable to create vm $vmid: config file already exists\n"
if -f $filename;
my $realcmd = sub {
}
if (!$param->{bootdisk} && $firstdisk) {
- $param->{bootdisk} = $firstdisk;
+ $param->{bootdisk} = $firstdisk;
}
PVE::QemuServer::create_conf_nolock($vmid, $param);
__PACKAGE__->register_method({
name => 'vmdiridx',
- path => '{vmid}',
+ path => '{vmid}',
method => 'GET',
proxyto => 'node',
description => "Directory index",
{ subdir => 'rrddata' },
{ subdir => 'monitor' },
];
-
+
return $res;
}});
__PACKAGE__->register_method({
- name => 'rrd',
- path => '{vmid}/rrd',
+ name => 'rrd',
+ path => '{vmid}/rrd',
method => 'GET',
protected => 1, # fixme: can we avoid that?
permissions => {
- path => '/vms/{vmid}',
- privs => [ 'VM.Audit' ],
+ check => ['perm', '/vms/{vmid}', [ 'VM.Audit' ]],
},
description => "Read VM RRD statistics (returns PNG)",
parameters => {
my ($param) = @_;
return PVE::Cluster::create_rrd_graph(
- "pve2-vm/$param->{vmid}", $param->{timeframe},
+ "pve2-vm/$param->{vmid}", $param->{timeframe},
$param->{ds}, $param->{cf});
-
+
}});
__PACKAGE__->register_method({
- name => 'rrddata',
- path => '{vmid}/rrddata',
+ name => 'rrddata',
+ path => '{vmid}/rrddata',
method => 'GET',
protected => 1, # fixme: can we avoid that?
permissions => {
- path => '/vms/{vmid}',
- privs => [ 'VM.Audit' ],
+ check => ['perm', '/vms/{vmid}', [ 'VM.Audit' ]],
},
description => "Read VM RRD statistics",
parameters => {
__PACKAGE__->register_method({
- name => 'vm_config',
- path => '{vmid}/config',
+ name => 'vm_config',
+ path => '{vmid}/config',
method => 'GET',
proxyto => 'node',
description => "Get virtual machine configuration.",
vmid => get_standard_option('pve-vmid'),
},
},
- returns => {
+ returns => {
type => "object",
properties => {
digest => {
}});
__PACKAGE__->register_method({
- name => 'update_vm',
- path => '{vmid}/config',
+ name => 'update_vm',
+ path => '{vmid}/config',
method => 'PUT',
protected => 1,
proxyto => 'node',
type => 'string',
description => 'Prevent changes if current configuration file has different SHA1 digest. This can be used to prevent concurrent modifications.',
maxLength => 40,
- optional => 1,
+ optional => 1,
}
}),
},
}
my $skiplock = extract_param($param, 'skiplock');
- raise_param_exc({ skiplock => "Only root may use this option." })
+ raise_param_exc({ skiplock => "Only root may use this option." })
if $skiplock && $user ne 'root@pam';
my $delete = extract_param($param, 'delete');
die "no options specified\n" if !$delete && !scalar(keys %$param);
- my $storecfg = PVE::Storage::config();
+ my $storecfg = PVE::Storage::config();
&$resolve_cdrom_alias($param);
- my $eject = {};
- my $cdchange = {};
+ my $conf = PVE::QemuServer::load_config($vmid);
- foreach my $opt (keys %$param) {
- if (PVE::QemuServer::valid_drivename($opt)) {
- my $drive = PVE::QemuServer::parse_drive($opt, $param->{$opt});
- raise_param_exc({ $opt => "unable to parse drive options" }) if !$drive;
- if ($drive->{file} eq 'eject') {
- $eject->{$opt} = 1;
- delete $param->{$opt};
- next;
- }
+ die "checksum missmatch (file change by other user?)\n"
+ if $digest && $digest ne $conf->{digest};
- PVE::QemuServer::cleanup_drive_path($opt, $storecfg, $drive);
- $param->{$opt} = PVE::QemuServer::print_drive($vmid, $drive);
+ PVE::QemuServer::check_lock($conf) if !$skiplock;
- if (PVE::QemuServer::drive_is_cdrom($drive)) {
- $cdchange->{$opt} = PVE::QemuServer::get_iso_path($storecfg, $vmid, $drive->{file});
- }
- }
- }
+ PVE::Cluster::log_msg('info', $user, "update VM $vmid: " . join (' ', @paramarr));
+ #delete
foreach my $opt (PVE::Tools::split_list($delete)) {
+
$opt = 'ide2' if $opt eq 'cdrom';
die "you can't use '-$opt' and '-delete $opt' at the same time\n"
if defined($param->{$opt});
- }
-
- PVE::QemuServer::add_random_macs($param);
-
- my $vollist = [];
- my $updatefn = sub {
-
- my $conf = PVE::QemuServer::load_config($vmid);
-
- die "checksum missmatch (file change by other user?)\n"
- if $digest && $digest ne $conf->{digest};
-
- PVE::QemuServer::check_lock($conf) if !$skiplock;
-
- PVE::Cluster::log_msg('info', $user, "update VM $vmid: " . join (' ', @paramarr));
+ my $unset = {};
- foreach my $opt (keys %$eject) {
- if ($conf->{$opt}) {
- my $drive = PVE::QemuServer::parse_drive($opt, $conf->{$opt});
- $cdchange->{$opt} = undef if PVE::QemuServer::drive_is_cdrom($drive);
- } else {
- raise_param_exc({ $opt => "eject failed - drive does not exist." });
- }
+ if (!PVE::QemuServer::option_exists($opt)) {
+ raise_param_exc({ delete => "unknown option '$opt'" });
}
- foreach my $opt (keys %$param) {
- next if !PVE::QemuServer::valid_drivename($opt);
- next if !$conf->{$opt};
- my $old_drive = PVE::QemuServer::parse_drive($opt, $conf->{$opt});
- next if PVE::QemuServer::drive_is_cdrom($old_drive);
- my $new_drive = PVE::QemuServer::parse_drive($opt, $param->{$opt});
- if ($new_drive->{file} ne $old_drive->{file}) {
- my ($path, $owner);
- eval { ($path, $owner) = PVE::Storage::path($storecfg, $old_drive->{file}); };
- if ($owner && ($owner == $vmid)) {
- PVE::QemuServer::add_unused_volume($conf, $param, $old_drive->{file});
- }
- }
- }
+ next if !defined($conf->{$opt});
- my $unset = {};
+ die "error hot-unplug $opt" if !PVE::QemuServer::vm_deviceunplug($vmid, $conf, $opt);
- foreach my $opt (PVE::Tools::split_list($delete)) {
- $opt = 'ide2' if $opt eq 'cdrom';
- if (!PVE::QemuServer::option_exists($opt)) {
- raise_param_exc({ delete => "unknown option '$opt'" });
- }
- next if !defined($conf->{$opt});
- if (PVE::QemuServer::valid_drivename($opt)) {
- PVE::QemuServer::vm_devicedel($vmid, $conf, $opt);
- my $drive = PVE::QemuServer::parse_drive($opt, $conf->{$opt});
- if (PVE::QemuServer::drive_is_cdrom($drive)) {
- $cdchange->{$opt} = undef;
- } else {
- my $volid = $drive->{file};
-
- if ($volid !~ m|^/|) {
- my ($path, $owner);
- eval { ($path, $owner) = PVE::Storage::path($storecfg, $volid); };
- if ($owner && ($owner == $vmid)) {
- if ($force) {
- push @$vollist, $volid;
- } else {
- PVE::QemuServer::add_unused_volume($conf, $param, $volid);
- }
+ #drive
+ if (PVE::QemuServer::valid_drivename($opt)) {
+ my $drive = PVE::QemuServer::parse_drive($opt, $conf->{$opt});
+ #hdd
+ if (!PVE::QemuServer::drive_is_cdrom($drive)) {
+ my $volid = $drive->{file};
+
+ if ($volid !~ m|^/|) {
+ my ($path, $owner);
+ eval { ($path, $owner) = PVE::Storage::path($storecfg, $volid); };
+ if ($owner && ($owner == $vmid)) {
+ if ($force) {
+ eval { PVE::Storage::vdisk_free($storecfg, $volid); };
+ # fixme: log ?
+ warn $@ if $@;
+ } else {
+ PVE::QemuServer::add_unused_volume($conf, $volid, $vmid);
}
}
}
- } elsif ($opt =~ m/^unused/) {
- push @$vollist, $conf->{$opt};
- }
-
- $unset->{$opt} = 1;
+ }
+ } elsif ($opt =~ m/^unused/) {
+ my $drive = PVE::QemuServer::parse_drive($opt, $conf->{$opt});
+ my $volid = $drive->{file};
+ eval { PVE::Storage::vdisk_free($storecfg, $volid); };
+ # fixme: log ?
+ warn $@ if $@;
}
- PVE::QemuServer::create_disks($storecfg, $vmid, $param, $conf);
+ $unset->{$opt} = 1;
+ PVE::QemuServer::change_config_nolock($vmid, {}, $unset, 1);
+ }
- PVE::QemuServer::change_config_nolock($vmid, $param, $unset, 1);
- return if !PVE::QemuServer::check_running($vmid);
- foreach my $opt (keys %$cdchange) {
- my $qdn = PVE::QemuServer::qemu_drive_name($opt, 'cdrom');
- my $path = $cdchange->{$opt};
- PVE::QemuServer::vm_monitor_command($vmid, "eject $qdn", 0);
- PVE::QemuServer::vm_monitor_command($vmid, "change $qdn \"$path\"", 0) if $path;
- }
- };
+ #add
+ foreach my $opt (keys %$param) {
- PVE::QemuServer::lock_config($vmid, $updatefn);
+ #drives
+ if (PVE::QemuServer::valid_drivename($opt)) {
+ my $drive = PVE::QemuServer::parse_drive($opt, $param->{$opt});
+ raise_param_exc({ $opt => "unable to parse drive options" }) if !$drive;
- foreach my $volid (@$vollist) {
- eval { PVE::Storage::vdisk_free($storecfg, $volid); };
- # fixme: log ?
- warn $@ if $@;
+ PVE::QemuServer::cleanup_drive_path($opt, $storecfg, $drive);
+ $param->{$opt} = PVE::QemuServer::print_drive($vmid, $drive);
+
+ #cdrom
+ if (PVE::QemuServer::drive_is_cdrom($drive) && PVE::QemuServer::check_running($vmid)) {
+ if ($drive->{file} eq 'none') {
+ PVE::QemuServer::vm_monitor_command($vmid, "eject -f drive-$opt", 0);
+ #delete $param->{$opt};
+ }
+ else {
+ my $path = PVE::QemuServer::get_iso_path($storecfg, $vmid, $drive->{file});
+ PVE::QemuServer::vm_monitor_command($vmid, "eject -f drive-$opt", 0); #force eject if locked
+ PVE::QemuServer::vm_monitor_command($vmid, "change drive-$opt \"$path\"", 0) if $path;
+ }
+ }
+ #hdd
+ else {
+ #swap drive
+ if ($conf->{$opt}){
+ my $old_drive = PVE::QemuServer::parse_drive($opt, $conf->{$opt});
+ if ($drive->{file} ne $old_drive->{file} && !PVE::QemuServer::drive_is_cdrom($old_drive)) {
+
+ my ($path, $owner);
+ eval { ($path, $owner) = PVE::Storage::path($storecfg, $old_drive->{file}); };
+ if ($owner && ($owner == $vmid)) {
+ die "error hot-unplug $opt" if !PVE::QemuServer::vm_deviceunplug($vmid, $conf, $opt);
+ PVE::QemuServer::add_unused_volume($conf, $old_drive->{file}, $vmid);
+ }
+ }
+ }
+ my $settings = { $opt => $param->{$opt} };
+ PVE::QemuServer::create_disks($storecfg, $vmid, $settings, $conf);
+ $param->{$opt} = $settings->{$opt};
+ #hotplug disks
+ if(!PVE::QemuServer::vm_deviceplug($storecfg, $conf, $vmid, $opt, $drive)) {
+ PVE::QemuServer::add_unused_volume($conf,$drive->{file},$vmid);
+ PVE::QemuServer::change_config_nolock($vmid, {}, { $opt => 1 }, 1);
+ die "error hotplug $opt - put disk in unused";
+ }
+ }
+ }
+ #nics
+ if ($opt =~ m/^net(\d+)$/) {
+ my $net = PVE::QemuServer::parse_net($param->{$opt});
+ $param->{$opt} = PVE::QemuServer::print_net($net);
+ }
+
+ PVE::QemuServer::change_config_nolock($vmid, { $opt => $param->{$opt} }, {}, 1);
}
return undef;
__PACKAGE__->register_method({
- name => 'destroy_vm',
- path => '{vmid}',
+ name => 'destroy_vm',
+ path => '{vmid}',
method => 'DELETE',
protected => 1,
proxyto => 'node',
skiplock => get_standard_option('skiplock'),
},
},
- returns => {
+ returns => {
type => 'string',
},
code => sub {
my $vmid = $param->{vmid};
my $skiplock = $param->{skiplock};
- raise_param_exc({ skiplock => "Only root may use this option." })
+ raise_param_exc({ skiplock => "Only root may use this option." })
if $skiplock && $user ne 'root@pam';
# test if VM exists
my $conf = PVE::QemuServer::load_config($vmid);
- my $storecfg = PVE::Storage::config();
+ my $storecfg = PVE::Storage::config();
my $realcmd = sub {
my $upid = shift;
}});
__PACKAGE__->register_method({
- name => 'unlink',
- path => '{vmid}/unlink',
+ name => 'unlink',
+ path => '{vmid}/unlink',
method => 'PUT',
protected => 1,
proxyto => 'node',
my $sslcert;
__PACKAGE__->register_method({
- name => 'vncproxy',
- path => '{vmid}/vncproxy',
+ name => 'vncproxy',
+ path => '{vmid}/vncproxy',
method => 'POST',
protected => 1,
permissions => {
- path => '/vms/{vmid}',
- privs => [ 'VM.Console' ],
+ check => ['perm', '/vms/{vmid}', [ 'VM.Console' ]],
},
description => "Creates a TCP VNC proxy connections.",
parameters => {
vmid => get_standard_option('pve-vmid'),
},
},
- returns => {
+ returns => {
additionalProperties => 0,
properties => {
user => { type => 'string' },
my $rpcenv = PVE::RPCEnvironment::get();
my $user = $rpcenv->get_user();
- my $ticket = PVE::AccessControl::assemble_ticket($user);
my $vmid = $param->{vmid};
my $node = $param->{node};
+ my $authpath = "/vms/$vmid";
+
+ my $ticket = PVE::AccessControl::assemble_vnc_ticket($user, $authpath);
+
$sslcert = PVE::Tools::file_get_contents("/etc/pve/pve-root-ca.pem", 8192)
if !$sslcert;
my $port = PVE::Tools::next_vnc_port();
my $remip;
-
+
if ($node ne 'localhost' && $node ne PVE::INotify::nodename()) {
$remip = PVE::Cluster::remote_node_ip($node);
}
my $remcmd = $remip ? ['/usr/bin/ssh', '-T', '-o', 'BatchMode=yes',
'-c', 'blowfish-cbc', $remip] : [];
- my $timeout = 10;
+ my $timeout = 10;
my $realcmd = sub {
my $upid = shift;
return {
user => $user,
ticket => $ticket,
- port => $port,
- upid => $upid,
- cert => $sslcert,
+ port => $port,
+ upid => $upid,
+ cert => $sslcert,
};
}});
__PACKAGE__->register_method({
name => 'vmcmdidx',
- path => '{vmid}/status',
+ path => '{vmid}/status',
method => 'GET',
proxyto => 'node',
description => "Directory index",
{ subdir => 'start' },
{ subdir => 'stop' },
];
-
+
return $res;
}});
__PACKAGE__->register_method({
- name => 'vm_status',
+ name => 'vm_status',
path => '{vmid}/status/current',
method => 'GET',
proxyto => 'node',
}});
__PACKAGE__->register_method({
- name => 'vm_start',
+ name => 'vm_start',
path => '{vmid}/status/start',
method => 'POST',
protected => 1,
stateuri => get_standard_option('pve-qm-stateuri'),
},
},
- returns => {
+ returns => {
type => 'string',
},
code => sub {
my $vmid = extract_param($param, 'vmid');
my $stateuri = extract_param($param, 'stateuri');
- raise_param_exc({ stateuri => "Only root may use this option." })
+ raise_param_exc({ stateuri => "Only root may use this option." })
if $stateuri && $user ne 'root@pam';
my $skiplock = extract_param($param, 'skiplock');
- raise_param_exc({ skiplock => "Only root may use this option." })
+ raise_param_exc({ skiplock => "Only root may use this option." })
if $skiplock && $user ne 'root@pam';
- my $storecfg = PVE::Storage::config();
+ my $storecfg = PVE::Storage::config();
my $realcmd = sub {
my $upid = shift;
}});
__PACKAGE__->register_method({
- name => 'vm_stop',
+ name => 'vm_stop',
path => '{vmid}/status/stop',
method => 'POST',
protected => 1,
type => 'integer',
minimum => 0,
optional => 1,
+ },
+ keepActive => {
+ description => "Do not decativate storage volumes.",
+ type => 'boolean',
+ optional => 1,
+ default => 0,
}
},
},
- returns => {
+ returns => {
type => 'string',
},
code => sub {
my $vmid = extract_param($param, 'vmid');
my $skiplock = extract_param($param, 'skiplock');
- raise_param_exc({ skiplock => "Only root may use this option." })
+ raise_param_exc({ skiplock => "Only root may use this option." })
if $skiplock && $user ne 'root@pam';
+ my $keepActive = extract_param($param, 'keepActive');
+ raise_param_exc({ keepActive => "Only root may use this option." })
+ if $keepActive && $user ne 'root@pam';
+
my $storecfg = PVE::Storage::config();
my $realcmd = sub {
syslog('info', "stop VM $vmid: $upid\n");
- PVE::QemuServer::vm_stop($storecfg, $vmid, $skiplock, 0, $param->{timeout});
+ PVE::QemuServer::vm_stop($storecfg, $vmid, $skiplock, 0,
+ $param->{timeout}, 0, 1, $keepActive);
return;
};
}});
__PACKAGE__->register_method({
- name => 'vm_reset',
+ name => 'vm_reset',
path => '{vmid}/status/reset',
method => 'POST',
protected => 1,
skiplock => get_standard_option('skiplock'),
},
},
- returns => {
+ returns => {
type => 'string',
},
code => sub {
my $vmid = extract_param($param, 'vmid');
my $skiplock = extract_param($param, 'skiplock');
- raise_param_exc({ skiplock => "Only root may use this option." })
+ raise_param_exc({ skiplock => "Only root may use this option." })
if $skiplock && $user ne 'root@pam';
die "VM $vmid not running\n" if !PVE::QemuServer::check_running($vmid);
}});
__PACKAGE__->register_method({
- name => 'vm_shutdown',
+ name => 'vm_shutdown',
path => '{vmid}/status/shutdown',
method => 'POST',
protected => 1,
type => 'boolean',
optional => 1,
default => 0,
+ },
+ keepActive => {
+ description => "Do not decativate storage volumes.",
+ type => 'boolean',
+ optional => 1,
+ default => 0,
}
},
},
- returns => {
+ returns => {
type => 'string',
},
code => sub {
my $vmid = extract_param($param, 'vmid');
my $skiplock = extract_param($param, 'skiplock');
- raise_param_exc({ skiplock => "Only root may use this option." })
+ raise_param_exc({ skiplock => "Only root may use this option." })
if $skiplock && $user ne 'root@pam';
+ my $keepActive = extract_param($param, 'keepActive');
+ raise_param_exc({ keepActive => "Only root may use this option." })
+ if $keepActive && $user ne 'root@pam';
+
my $storecfg = PVE::Storage::config();
my $realcmd = sub {
syslog('info', "shutdown VM $vmid: $upid\n");
- PVE::QemuServer::vm_stop($storecfg, $vmid, $skiplock, 0,
- $param->{timeout}, 1, $param->{forceStop});
+ PVE::QemuServer::vm_stop($storecfg, $vmid, $skiplock, 0, $param->{timeout},
+ 1, $param->{forceStop}, $keepActive);
return;
};
}});
__PACKAGE__->register_method({
- name => 'vm_suspend',
+ name => 'vm_suspend',
path => '{vmid}/status/suspend',
method => 'POST',
protected => 1,
skiplock => get_standard_option('skiplock'),
},
},
- returns => {
+ returns => {
type => 'string',
},
code => sub {
my $vmid = extract_param($param, 'vmid');
my $skiplock = extract_param($param, 'skiplock');
- raise_param_exc({ skiplock => "Only root may use this option." })
+ raise_param_exc({ skiplock => "Only root may use this option." })
if $skiplock && $user ne 'root@pam';
die "VM $vmid not running\n" if !PVE::QemuServer::check_running($vmid);
}});
__PACKAGE__->register_method({
- name => 'vm_resume',
+ name => 'vm_resume',
path => '{vmid}/status/resume',
method => 'POST',
protected => 1,
skiplock => get_standard_option('skiplock'),
},
},
- returns => {
+ returns => {
type => 'string',
},
code => sub {
my $vmid = extract_param($param, 'vmid');
my $skiplock = extract_param($param, 'skiplock');
- raise_param_exc({ skiplock => "Only root may use this option." })
+ raise_param_exc({ skiplock => "Only root may use this option." })
if $skiplock && $user ne 'root@pam';
die "VM $vmid not running\n" if !PVE::QemuServer::check_running($vmid);
}});
__PACKAGE__->register_method({
- name => 'vm_sendkey',
+ name => 'vm_sendkey',
path => '{vmid}/sendkey',
method => 'PUT',
protected => 1,
my $vmid = extract_param($param, 'vmid');
my $skiplock = extract_param($param, 'skiplock');
- raise_param_exc({ skiplock => "Only root may use this option." })
+ raise_param_exc({ skiplock => "Only root may use this option." })
if $skiplock && $user ne 'root@pam';
PVE::QemuServer::vm_sendkey($vmid, $skiplock, $param->{key});
}});
__PACKAGE__->register_method({
- name => 'migrate_vm',
+ name => 'migrate_vm',
path => '{vmid}/migrate',
method => 'POST',
protected => 1,
},
},
},
- returns => {
+ returns => {
type => 'string',
description => "the task ID.",
},
my $vmid = extract_param($param, 'vmid');
- raise_param_exc({ force => "Only root may use this option." })
+ raise_param_exc({ force => "Only root may use this option." })
if $param->{force} && $user ne 'root@pam';
# test if VM exists
PVE::QemuServer::check_lock($conf);
if (PVE::QemuServer::check_running($vmid)) {
- die "cant migrate running VM without --online\n"
+ die "cant migrate running VM without --online\n"
if !$param->{online};
}
}});
__PACKAGE__->register_method({
- name => 'monitor',
- path => '{vmid}/monitor',
+ name => 'monitor',
+ path => '{vmid}/monitor',
method => 'POST',
protected => 1,
proxyto => 'node',