Skip to content

Commit 9208528

Browse files
committed
CA-67536: Remove unplug_force from vif_operations
The unplug_force operation was recently added to the vif_operations enum. However, this causes problems during rolling pool upgrade, while the master has been upgraded, but some of the slaves have not. Operations such as Db.VIF.get_record on running VMs were be broken by this, which broke live migrations between un-upgraded hosts. After this patch, the "unplug" operation is used for both "unplug" as well as "unplug_force" in VIF.allowed_operations, which is fine, since they are always allowed at the same time. Signed-off-by: Rob Hoes <[email protected]>
1 parent 47c13ac commit 9208528

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

ocaml/idl/datamodel.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4813,7 +4813,6 @@ let vif_operations =
48134813
[ "attach", "Attempting to attach this VIF to a VM";
48144814
"plug", "Attempting to hotplug this VIF";
48154815
"unplug", "Attempting to hot unplug this VIF";
4816-
"unplug_force", "Attempting to forcibly unplug this VIF";
48174816
])
48184817

48194818
let vif_locking_mode =

ocaml/xapi/message_forwarding.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2618,7 +2618,7 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct
26182618
forward_vif_op ~local_fn ~__context ~self (fun session_id rpc -> Client.VIF.plug rpc session_id self))
26192619

26202620
let unplug_common ~__context ~self ~force =
2621-
let op = if force then `unplug_force else `unplug in
2621+
let op = `unplug in
26222622
let name = "VIF." ^ (Record_util.vif_operation_to_string op) in
26232623
info "%s: VIF = '%s'" name (vif_uuid ~__context self);
26242624
let local_fn, remote_fn =

ocaml/xapi/xapi_vif_helpers.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ open D
2222

2323
open Record_util
2424

25-
let all_ops : API.vif_operations_set = [ `attach; `plug; `unplug; `unplug_force ]
25+
let all_ops : API.vif_operations_set = [ `attach; `plug; `unplug ]
2626

2727
type table = (API.vif_operations, ((string * (string list)) option)) Hashtbl.t
2828

@@ -61,18 +61,18 @@ let valid_operations ~__context record _ref' : table =
6161
let plugged = record.Db_actions.vIF_currently_attached || record.Db_actions.vIF_reserved in
6262
(match power_state, plugged with
6363
| `Running, true -> set_errors Api_errors.device_already_attached [ _ref ] [ `plug ]
64-
| `Running, false -> set_errors Api_errors.device_already_detached [ _ref ] [ `unplug; `unplug_force ]
64+
| `Running, false -> set_errors Api_errors.device_already_detached [ _ref ] [ `unplug ]
6565
| _, _ ->
6666
let actual = Record_util.power_to_string power_state in
6767
let expected = Record_util.power_to_string `Running in
68-
set_errors Api_errors.vm_bad_power_state [ Ref.string_of vm; expected; actual ] [ `plug; `unplug; `unplug_force ]);
68+
set_errors Api_errors.vm_bad_power_state [ Ref.string_of vm; expected; actual ] [ `plug; `unplug ]);
6969

7070
(* HVM guests only support plug/unplug IF they have recent PV drivers *)
7171
let vm_gm = Db.VM.get_guest_metrics ~__context ~self:vm in
7272
let vm_gmr = try Some (Db.VM_guest_metrics.get_record_internal ~__context ~self:vm_gm) with _ -> None in
7373
if power_state = `Running && Helpers.has_booted_hvm ~__context ~self:vm
7474
then (match Xapi_pv_driver_version.make_error_opt (Xapi_pv_driver_version.of_guest_metrics vm_gmr) vm vm_gm with
75-
| Some(code, params) -> set_errors code params [ `plug; `unplug; `unplug_force ]
75+
| Some(code, params) -> set_errors code params [ `plug; `unplug ]
7676
| None -> ());
7777

7878
table

0 commit comments

Comments
 (0)