]> git.proxmox.com Git - qemu-server.git/blobdiff - PVE/QemuMigrate.pm
cloudinit: hide password on the api
[qemu-server.git] / PVE / QemuMigrate.pm
index 39b94910312e6b744984255b335953638f41f3c8..27cf7e36eb3706d3cc73cadad0f0ea436a7fa4dc 100644 (file)
@@ -318,6 +318,7 @@ sub sync_disks {
            my ($volid, $attr) = @_;
 
            if ($volid =~ m|^/|) {
+               return if $attr->{shared};
                $local_volumes->{$volid}->{ref} = 'config';
                die "local file/device\n";
            }
@@ -599,8 +600,9 @@ sub phase2 {
 
     die "unable to detect remote migration address\n" if !$raddr;
 
+    $self->log('info', "start remote tunnel");
+
     if ($migration_type eq 'secure') {
-       $self->log('info', "start remote tunnel");
 
        if ($ruri =~ /^unix:/) {
            unlink $raddr;
@@ -633,6 +635,9 @@ sub phase2 {
        } else {
            die "unsupported protocol in migration URI: $ruri\n";
        }
+    } else {
+       #fork tunnel for insecure migration, to send faster commands like resume
+       $self->{tunnel} = $self->fork_tunnel();
     }
 
     my $start = time();
@@ -646,7 +651,7 @@ sub phase2 {
            if (scalar(keys %{$self->{target_drive}}) != scalar @{$self->{online_local_volumes}});
        foreach my $drive (keys %{$self->{target_drive}}){
            my $nbd_uri = $self->{target_drive}->{$drive}->{nbd_uri};
-           $self->log('info', "$drive: start migration to to $nbd_uri");
+           $self->log('info', "$drive: start migration to $nbd_uri");
            PVE::QemuServer::qemu_drive_mirror($vmid, $drive, $nbd_uri, $vmid, undef, $self->{storage_migration_jobs}, 1);
        }
     }
@@ -687,6 +692,8 @@ sub phase2 {
     # set cachesize to 10% of the total memory
     my $memory =  $conf->{memory} || $defaults->{memory};
     my $cachesize = int($memory * 1048576 / 10);
+    $cachesize = round_powerof2($cachesize);
+
     $self->log('info', "set cachesize: $cachesize");
     eval {
        PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate-set-cache-size", value => int($cachesize));
@@ -1027,4 +1034,9 @@ sub final_cleanup {
     # nothing to do
 }
 
+sub round_powerof2 {
+    return 1 if $_[0] < 2;
+    return 2 << int(log($_[0]-1)/log(2));
+}
+
 1;