[pve-devel] [PATCH qemu-server 1/5] phase2 : add generate_migrate_start_cmd
Alexandre Derumier
aderumier at odiso.com
Thu Apr 25 09:22:49 CEST 2019
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/QemuMigrate.pm | 52 +++++++++++++++++++++++++++++-----------------------
1 file changed, 29 insertions(+), 23 deletions(-)
diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 4b5813c..b52b9d8 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -545,37 +545,15 @@ sub phase2 {
my $ruri; # the whole migration dst. URI (protocol:address[:port])
my $nodename = PVE::INotify::nodename();
- ## start on remote node
- my $cmd = [@{$self->{rem_ssh}}];
-
my $spice_ticket;
if (PVE::QemuServer::vga_conf_has_spice($conf->{vga})) {
my $res = PVE::QemuServer::vm_mon_cmd($vmid, 'query-spice');
$spice_ticket = $res->{ticket};
}
- push @$cmd , 'qm', 'start', $vmid, '--skiplock', '--migratedfrom', $nodename;
-
my $migration_type = $self->{opts}->{migration_type};
- push @$cmd, '--migration_type', $migration_type;
-
- push @$cmd, '--migration_network', $self->{opts}->{migration_network}
- if $self->{opts}->{migration_network};
-
- if ($migration_type eq 'insecure') {
- push @$cmd, '--stateuri', 'tcp';
- } else {
- push @$cmd, '--stateuri', 'unix';
- }
-
- if ($self->{forcemachine}) {
- push @$cmd, '--machine', $self->{forcemachine};
- }
-
- if ($self->{online_local_volumes}) {
- push @$cmd, '--targetstorage', ($self->{opts}->{targetstorage} // '1');
- }
+ my $cmd = generate_migrate_start_cmd($self, $vmid, $nodename, $migration_type);
my $spice_port;
@@ -1080,4 +1058,32 @@ sub round_powerof2 {
return 2 << int(log($_[0]-1)/log(2));
}
+sub generate_migrate_start_cmd {
+ my ($self, $vmid, $nodename, $migration_type) = @_;
+
+ my $cmd = [@{$self->{rem_ssh}}];
+
+ push @$cmd , 'qm', 'start', $vmid, '--skiplock', '--migratedfrom', $nodename;
+
+ push @$cmd, '--migration_type', $migration_type;
+
+ push @$cmd, '--migration_network', $self->{opts}->{migration_network}
+ if $self->{opts}->{migration_network};
+
+ if ($migration_type eq 'insecure') {
+ push @$cmd, '--stateuri', 'tcp';
+ } else {
+ push @$cmd, '--stateuri', 'unix';
+ }
+
+ if ($self->{forcemachine}) {
+ push @$cmd, '--machine', $self->{forcemachine};
+ }
+
+ if ($self->{online_local_volumes}) {
+ push @$cmd, '--targetstorage', ($self->{opts}->{targetstorage} // '1');
+ }
+ return $cmd;
+}
+
1;
--
2.11.0
More information about the pve-devel
mailing list