mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-10-04 21:14:21 +00:00
Improve handling and description of migrate with --online
Thanks to Stefan and Thomas for the suggestions.
Changes from v1:
* update parameter description
* warn instead of die
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
(cherry picked from commit 1373938627
)
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
This commit is contained in:
parent
2fb78e6cd2
commit
2afc3515c7
@ -3162,7 +3162,7 @@ __PACKAGE__->register_method({
|
|||||||
}),
|
}),
|
||||||
online => {
|
online => {
|
||||||
type => 'boolean',
|
type => 'boolean',
|
||||||
description => "Use online/live migration.",
|
description => "Use online/live migration if VM is running. Ignored if VM is stopped.",
|
||||||
optional => 1,
|
optional => 1,
|
||||||
},
|
},
|
||||||
force => {
|
force => {
|
||||||
@ -3224,9 +3224,6 @@ __PACKAGE__->register_method({
|
|||||||
|
|
||||||
my $vmid = extract_param($param, 'vmid');
|
my $vmid = extract_param($param, 'vmid');
|
||||||
|
|
||||||
raise_param_exc({ targetstorage => "Live storage migration can only be done online." })
|
|
||||||
if !$param->{online} && $param->{targetstorage};
|
|
||||||
|
|
||||||
raise_param_exc({ force => "Only root may use this option." })
|
raise_param_exc({ force => "Only root may use this option." })
|
||||||
if $param->{force} && $authuser ne 'root@pam';
|
if $param->{force} && $authuser ne 'root@pam';
|
||||||
|
|
||||||
@ -3247,8 +3244,14 @@ __PACKAGE__->register_method({
|
|||||||
if (PVE::QemuServer::check_running($vmid)) {
|
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};
|
if !$param->{online};
|
||||||
|
} else {
|
||||||
|
warn "VM isn't running. Doing offline migration instead." if $param->{online};
|
||||||
|
$param->{online} = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
raise_param_exc({ targetstorage => "Live storage migration can only be done online." })
|
||||||
|
if !$param->{online} && $param->{targetstorage};
|
||||||
|
|
||||||
my $storecfg = PVE::Storage::config();
|
my $storecfg = PVE::Storage::config();
|
||||||
|
|
||||||
if( $param->{targetstorage}) {
|
if( $param->{targetstorage}) {
|
||||||
|
Loading…
Reference in New Issue
Block a user