Skip to content

Commit 20fa674

Browse files
committed
CP-14790: No licence check for VM.revert and import
Even when creation of Windows-Update VMs is not allowed by the licence, we want to allow it when it is done in the course of an import or revert-to-snapshot. In both cases, we avoid the check for the Windows-Update vendor-device licence feature by using the relevant helper function instead of calling Client.VM.create_from_record directly. Signed-off-by: Thomas Sanders <[email protected]>
1 parent 88b607f commit 20fa674

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ocaml/xapi/import.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,9 @@ module VM : HandlerTools = struct
423423
let vm = log_reraise
424424
("failed to create VM with name-label " ^ vm_record.API.vM_name_label)
425425
(fun value ->
426-
let vm = Client.VM.create_from_record rpc session_id value in
426+
let vm = Xapi_vm_helpers.create_from_record_without_checking_licence_feature_for_vendor_device
427+
~__context rpc session_id value
428+
in
427429
if config.full_restore then Db.VM.set_uuid ~__context ~self:vm ~value:value.API.vM_uuid;
428430
vm)
429431
vm_record in

ocaml/xapi/xapi_vm_snapshot.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,9 @@ let create_vm_from_snapshot ~__context ~snapshot =
475475
let snap_record = Db.VM.get_record ~__context ~self:snapshot in
476476

477477
Helpers.call_api_functions ~__context
478-
(fun rpc session_id ->
479-
let new_vm = Client.VM.create_from_record rpc session_id snap_record in
478+
(fun rpc session_id ->
479+
let new_vm = Xapi_vm_helpers.create_from_record_without_checking_licence_feature_for_vendor_device
480+
~__context rpc session_id snap_record in
480481
begin try
481482
Db.VM.set_uuid ~__context ~self:new_vm ~value:vm_uuid;
482483
copy_vm_fields ~__context ~metadata:snap_metadata ~dst:new_vm ~do_not_copy:do_not_copy ~default_values;

0 commit comments

Comments
 (0)