mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-29 18:34:50 +00:00
do not allow to migrate VM which uses local resources
But add a --force parameter to overwrite
This commit is contained in:
parent
34978be308
commit
669963ffbe
13
qmigrate
13
qmigrate
@ -71,6 +71,11 @@ __PACKAGE__->register_method({
|
|||||||
description => "Use online/live migration.",
|
description => "Use online/live migration.",
|
||||||
optional => 1,
|
optional => 1,
|
||||||
},
|
},
|
||||||
|
force => {
|
||||||
|
type => 'boolean',
|
||||||
|
description => "Allow to migrate VMs which use local devices.",
|
||||||
|
optional => 1,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
returns => { type => 'null'},
|
returns => { type => 'null'},
|
||||||
@ -111,7 +116,7 @@ __PACKAGE__->register_method({
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $rhash = {};
|
my $rhash = {};
|
||||||
eval_int (sub { phase1($conf, $rhash, $running); });
|
eval_int (sub { phase1($conf, $rhash, $running, $param->{force}); });
|
||||||
my $err = $@;
|
my $err = $@;
|
||||||
|
|
||||||
if ($err) {
|
if ($err) {
|
||||||
@ -278,8 +283,6 @@ sub sync_disks {
|
|||||||
|
|
||||||
my $res = [];
|
my $res = [];
|
||||||
|
|
||||||
die "implement me";
|
|
||||||
|
|
||||||
eval {
|
eval {
|
||||||
|
|
||||||
my $volhash = {};
|
my $volhash = {};
|
||||||
@ -471,12 +474,12 @@ sub finish_tunnel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub phase1 {
|
sub phase1 {
|
||||||
my ($conf, $rhash, $running) = @_;
|
my ($conf, $rhash, $running, $force) = @_;
|
||||||
|
|
||||||
logmsg('info', "starting migration of VM $vmid to node '$node' ($nodeip)");
|
logmsg('info', "starting migration of VM $vmid to node '$node' ($nodeip)");
|
||||||
|
|
||||||
if (my $loc_res = PVE::QemuServer::check_local_resources($conf, 1)) {
|
if (my $loc_res = PVE::QemuServer::check_local_resources($conf, 1)) {
|
||||||
if ($running) {
|
if ($running || !$force) {
|
||||||
die "can't migrate VM which uses local devices\n";
|
die "can't migrate VM which uses local devices\n";
|
||||||
} else {
|
} else {
|
||||||
logmsg('info', "migrating VM which uses local devices");
|
logmsg('info', "migrating VM which uses local devices");
|
||||||
|
Loading…
Reference in New Issue
Block a user