Comments inline
On 10/29/18 4:38 PM, Alexandre Derumier wrote:
qm migrate <vmid> <targetremotenode> --migration_type external [--targetstorage
monpoolceph_vm] --online
<targetremotenode> still has to obey the format rules of 'pve-node' so
no fqdn or ip possible. might need an additional change in pve-common
Allow to migrate to an external cluster node.
--targetstorage is optionnal, if not defined it's used same storagename than
source
---
PVE/API2/Qemu.pm | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 52f4a5f..64eaa0e 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -3046,7 +3046,7 @@ __PACKAGE__->register_method({
},
migration_type => {
type => 'string',
- enum => ['secure', 'insecure'],
+ enum => ['secure', 'insecure', 'external'],
this seems to conflate 2 different things. 'secure'/'insecure' describe
how something is transported (encrypted or not) while 'external'
specifies that it's outside of the cluster.
description => "Migration traffic is encrypted using an SSH tunnel
by default. On secure, completely private networks this can be disabled to increase
performance.",
optional => 1,
},
@@ -3085,7 +3085,7 @@ __PACKAGE__->register_method({
PVE::Cluster::check_cfs_quorum();
- PVE::Cluster::check_node_exists($target);
+ PVE::Cluster::check_node_exists($target) if $param->{migration_type} ne
'external';
my $targetip = PVE::Cluster::remote_node_ip($target);
@@ -3094,6 +3094,13 @@ __PACKAGE__->register_method({
raise_param_exc({ targetstorage => "Live storage migration can only be done
online." })
if !$param->{online} && $param->{targetstorage};
+ raise_param_exc({ migration_type => "external migration can only be done online." })
+ if !$param->{online} && $param->{migration_type} eq 'external';
+
+ raise_param_exc({ migration_type => "HA must be disable for external
migration." })
+ if PVE::HA::Config::vm_is_ha_managed($vmid) &&
$param->{migration_type} eq 'external';
+
+
raise_param_exc({ force => "Only root may use this option." })
if $param->{force} && $authuser ne 'root@pam';
@@ -3114,17 +3121,22 @@ __PACKAGE__->register_method({
if (PVE::QemuServer::check_running($vmid)) {
die "cant migrate running VM without --online\n"
if !$param->{online};
+ } else {
+ die "vm need to be online for external migration" if
$param->{migration_type} eq 'external';
missing '\n' at the end of the string
}
my $storecfg = PVE::Storage::config();
- if( $param->{targetstorage}) {
- PVE::Storage::storage_check_node($storecfg,
$param->{targetstorage}, $target);
- } else {
- PVE::QemuServer::check_storage_availability($storecfg, $conf,
$target);
+ if ($param->{migration_type} ne 'external') {
+
+ if( $param->{targetstorage} ) {
+ PVE::Storage::storage_check_node($storecfg,
$param->{targetstorage}, $target);
+ } else {
+ PVE::QemuServer::check_storage_availability($storecfg, $conf,
$target);
+ }
}
- if (PVE::HA::Config::vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha') {
+ if (PVE::HA::Config::vm_is_ha_managed($vmid) && $rpcenv->{type} ne 'ha' &&
$param->{migration_type} ne 'external') {
my $hacmd = sub {
my $upid = shift;
_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel