Skip to content

Commit 9de38ef

Browse files
authored
XSI-2025: Only abort HA host reenable for unpluggable PIFs (#6753)
Currently, abort_if_network_attached_to_protected_vms is used to abort unplugs and host reenables under HA when there are any unplugged PIFs. This isn't necessary for pluggable PIFs as it is a quick local operation to do so. The only time we should abort is for bond slave PIFs as these are not pluggable and should be blocked for VM agility.
2 parents 1178ed1 + 53d78f1 commit 9de38ef

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

ocaml/xapi/xapi_host.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,17 @@ let assert_safe_to_reenable ~__context ~self ~user_request =
109109
)
110110
unplugged_pbds ;
111111
let pifs = Db.Host.get_PIFs ~__context ~self in
112-
let unplugged_pifs =
112+
let non_pluggable_pifs =
113113
List.filter
114-
(fun pif -> not (Db.PIF.get_currently_attached ~__context ~self:pif))
114+
(fun pif -> not (Xapi_pif_helpers.is_pluggable ~__context pif))
115115
pifs
116116
in
117-
(* Make sure it is 'ok' to have these PIFs remain unplugged *)
117+
(* Make sure it is 'ok' that these PIFs cannot be plugged *)
118118
List.iter
119119
(fun self ->
120120
Xapi_pif.abort_if_network_attached_to_protected_vms ~__context ~self
121121
)
122-
unplugged_pifs
122+
non_pluggable_pifs
123123
)
124124

125125
(* The maximum pool size allowed must be restricted to 3 hosts for the pool which does not have Pool_size feature *)

ocaml/xapi/xapi_pif.ml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,9 +1044,6 @@ let rec unplug ~__context ~self =
10441044
assert_no_protection_enabled ~__context ~self ;
10451045
assert_not_management_pif ~__context ~self ;
10461046
let pif_rec = Db.PIF.get_record ~__context ~self in
1047-
let host = pif_rec.API.pIF_host in
1048-
if Db.Host.get_enabled ~__context ~self:host then
1049-
abort_if_network_attached_to_protected_vms ~__context ~self ;
10501047
let network = Db.PIF.get_network ~__context ~self in
10511048
Xapi_network_attach_helpers.assert_network_has_no_vifs_in_use_on_me ~__context
10521049
~host:(Helpers.get_localhost ~__context)

ocaml/xapi/xapi_pif_helpers.ml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,15 @@ let is_device_underneath_same_type ~__context pif1 pif2 =
246246
in
247247
get_device_info pif1 = get_device_info pif2
248248

249+
let is_pluggable ~__context pif_ref =
250+
let pif_rec = Db.PIF.get_record ~__context ~self:pif_ref in
251+
(* If the root pif is a bond slave, it is not pluggable *)
252+
match List.rev (get_pif_topo ~__context ~pif_rec) with
253+
| Physical pif_rec :: _ ->
254+
not (Db.is_valid_ref __context pif_rec.API.pIF_bond_slave_of)
255+
| _ ->
256+
true
257+
249258
let get_non_link_ipv6 ~__context ~pif =
250259
let valid_nonlink ipv6 =
251260
let open Ipaddr.V6 in

0 commit comments

Comments
 (0)