<div style="font-family: 'Calibri', 'sans-serif';"><div dir="ltr">Comments inline.</div><br><div id="htc_header">----- Rispondi al messaggio -----<br>Da: "Caspar Smit" <casparsmit@supernas.eu><br>A: "PVE development discussion" <pve-devel@pve.proxmox.com><br>Oggetto: [pve-devel] [PATCH v2 3/3] Allow migrate-all button on HA     enabled VMs<br>Data: gio, mar 17, 2016 11:55</div></div><br><div dir="ltr"><div dir="ltr">Hi all,<div dir="ltr"><br></div><div dir="ltr">During some more tests with this feature i (maybe) stumbled on a bug (or maybe this was by design).</div><div dir="ltr"><br></div><div dir="ltr">When I select the migrate-all button and set the "parallel jobs" option to 1 i noticed the HA managed VM's were migrated at the same time (so it looks like the parallel jobs option is ignored).</div><div dir="ltr">But i found out why this is:</div><div dir="ltr"><br></div><div dir="ltr">When a HA managed VM is migrated a "HA <vmid> - Migrate" task is spawned. This task returns an OK status way BEFORE the actual migration has taken place. The "HA <vmid> - Migrate" task spawns another task which does the actual migration called "VM <vmid> - Migrate".</div><div dir="ltr"><br></div><div dir="ltr">Now I remember from PVE 3.4 that the "HA <vmid> - Migrate" task did not return an OK until the actual "VM <vmid> - Migrate" returned an OK. Was this changed on purpose or is this a bug?</div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">This is by design. The HA stack consists out of the local resource manager and the Cluster resource mamager which work synced with each other but async from the cluster.</div><div dir="ltr"><br></div><div dir="ltr">You can limit the concurrent migrations by setting the max_worker setting in datacenter.cfg</div><div dir="ltr">Users should limit that if there setup cannot handle that much migrations parallel.</div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">The result here is that the migrate-all task receives an OK (from the HA task) and starts the next migration resulting in multiple HA migrations happen at once.</div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">This is expected.</div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div class="gmail_extra" dir="ltr"><div dir="ltr"><div class="gmail_signature" dir="ltr"><div dir="ltr">Kind regards,<br>Caspar<br></div><div dir="ltr"><br></div></div></div><div class="gmail_quote" dir="ltr">2016-03-14 12:07 GMT+01:00 Caspar Smit <span dir="ltr"><<a href="mailto:casparsmit@supernas.eu" target="_blank">casparsmit@supernas.eu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Caspar Smit <<a href="mailto:casparsmit@supernas.eu">casparsmit@supernas.eu</a>><br>
---<br>
 PVE/API2/Nodes.pm | 9 ++++++---<br>
 1 file changed, 6 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm<br>
index f1fb392..b2de907 100644<br>
--- a/PVE/API2/Nodes.pm<br>
+++ b/PVE/API2/Nodes.pm<br>
@@ -1208,9 +1208,6 @@ my $get_start_stop_list = sub {<br>
                $startup = { order => $bootorder };<br>
            }<br>
<br>
-           # skip ha managed VMs (started by pve-ha-manager)<br>
-           return if PVE::HA::Config::vm_is_ha_managed($vmid);<br>
-<br>
            $resList->{$startup->{order}}->{$vmid} = $startup;<br>
            $resList->{$startup->{order}}->{$vmid}->{type} = $d->{type};<br>
        };<br>
@@ -1283,6 +1280,9 @@ __PACKAGE__->register_method ({<br>
                        die "unknown VM type '$d->{type}'\n";<br>
                    }<br>
<br>
+                   # skip ha managed VMs (started by pve-ha-manager)<br>
+                   next if PVE::HA::Config::vm_is_ha_managed($vmid);<br>
+<br>
                    PVE::Cluster::check_cfs_quorum(); # abort when we loose quorum<br>
<br>
                    eval {<br>
@@ -1407,6 +1407,9 @@ __PACKAGE__->register_method ({<br>
                };<br>
<br>
                foreach my $vmid (sort {$b <=> $a} keys %$vmlist) {<br>
+                   # skip ha managed VMs (stopped by pve-ha-manager)<br>
+                   next if PVE::HA::Config::vm_is_ha_managed($vmid);<br>
+<br>
                    my $d = $vmlist->{$vmid};<br>
                    my $upid;<br>
                    eval { $upid = &$create_stop_worker($nodename, $d->{type}, $vmid, $d->{down}); };<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.1.4<br>
<br>
</font></span></blockquote></div><br></div></div>
</div>