Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CP-4431: Remove VMPP CLI commands

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
  • Loading branch information...
commit a850759b8ee833596a88073b6a06704f61d4028a 1 parent c364fdc
@robhoes robhoes authored
View
8 ocaml/client_records/record_util.ml
@@ -434,14 +434,6 @@ let on_boot_to_string onboot =
let wrap f err x = try f x with _ -> err x
let generic_error x = raise (Record_failure ("Unknown value: "^x))
let rpc_to_string = function | Rpc.String s -> s | _ -> failwith "Bad RPC type in record_util"
-let backup_type_to_string t = rpc_to_string (API.rpc_of_vmpp_backup_type t)
-let string_to_backup_type = wrap (fun s -> API.vmpp_backup_type_of_rpc (Rpc.String s)) generic_error
-let backup_frequency_to_string t = rpc_to_string (API.rpc_of_vmpp_backup_frequency t)
-let string_to_backup_frequency = wrap (fun s -> API.vmpp_backup_frequency_of_rpc (Rpc.String s)) generic_error
-let archive_frequency_to_string t = rpc_to_string (API.rpc_of_vmpp_archive_frequency t)
-let string_to_archive_frequency = wrap (fun s -> API.vmpp_archive_frequency_of_rpc (Rpc.String s)) generic_error
-let archive_target_type_to_string t = rpc_to_string (API.rpc_of_vmpp_archive_target_type t)
-let string_to_archive_target_type = wrap (fun s -> API.vmpp_archive_target_type_of_rpc (Rpc.String s)) generic_error
(** Parse a string which might have a units suffix on the end *)
let bytes_of_string field x =
View
107 ocaml/client_records/records.ml
@@ -546,108 +546,6 @@ let role_record rpc session_id role =
(*make_field ~name:"is_basic" ~get:(fun () -> string_of_bool (x ()).API.role_is_basic) ();*)
]}
-let vmpp_record rpc session_id vmpp =
- let _ref = ref vmpp in
- let empty_record = ToGet (fun () -> Client.VMPP.get_record rpc session_id !_ref) in
- let record = ref empty_record in
- let x () = lzy_get record in
- { setref=(fun r -> _ref := r; record := empty_record );
- setrefrec=(fun (a,b) -> _ref := a; record := Got b);
- record=x;
- getref=(fun () -> !_ref);
- fields =
-[
- make_field ~name:"uuid"
- ~get:(fun () -> (x ()).API.vMPP_uuid)
- ();
- make_field ~name:"name-label"
- ~get:(fun () -> (x ()).API.vMPP_name_label)
- ~set:(fun x -> Client.VMPP.set_name_label rpc session_id vmpp x)
- ();
- make_field ~name:"name-description"
- ~get:(fun () -> (x ()).API.vMPP_name_description)
- ~set:(fun x -> Client.VMPP.set_name_description rpc session_id vmpp x)
- ();
- make_field ~name:"is-policy-enabled"
- ~get:(fun () -> string_of_bool (x ()).API.vMPP_is_policy_enabled)
- ~set:(fun x -> Client.VMPP.set_is_policy_enabled rpc session_id vmpp (safe_bool_of_string "is-policy-enabled" x))
- ();
- make_field ~name:"backup-type"
- ~get:(fun () -> Record_util.backup_type_to_string (x ()).API.vMPP_backup_type)
- ~set:(fun x -> Client.VMPP.set_backup_type rpc session_id vmpp (Record_util.string_to_backup_type x))
- ();
- make_field ~name:"backup-retention-value"
- ~get:(fun () -> string_of_int (Int64.to_int (x ()).API.vMPP_backup_retention_value))
- ~set:(fun x -> Client.VMPP.set_backup_retention_value rpc session_id vmpp (safe_i64_of_string "backup-retention-value" x))
- ();
- make_field ~name:"backup-frequency"
- ~get:(fun () -> Record_util.backup_frequency_to_string (x ()).API.vMPP_backup_frequency)
- ~set:(fun x -> Client.VMPP.set_backup_frequency rpc session_id vmpp (Record_util.string_to_backup_frequency x))
- ();
- make_field ~name:"backup-schedule"
- ~get:(fun () -> Record_util.s2sm_to_string "; " (x ()).API.vMPP_backup_schedule)
- ~get_map:(fun () -> (x ()).API.vMPP_backup_schedule)
- ~add_to_map:(fun k v -> Client.VMPP.add_to_backup_schedule rpc session_id vmpp k v)
- ~remove_from_map:(fun k -> Client.VMPP.remove_from_backup_schedule rpc session_id vmpp k)
- ();
- make_field ~name:"is-backup-running"
- ~get:(fun () -> string_of_bool (x ()).API.vMPP_is_backup_running)
- ();
- make_field ~name:"backup-last-run-time"
- ~get:(fun () -> Date.to_string (x ()).API.vMPP_backup_last_run_time)
- ();
- make_field ~name:"archive-target-type"
- ~get:(fun () -> Record_util.archive_target_type_to_string (x ()).API.vMPP_archive_target_type)
- ~set:(fun x -> Client.VMPP.set_archive_target_type rpc session_id vmpp (Record_util.string_to_archive_target_type x))
- ();
- make_field ~name:"archive-target-config"
- ~get:(fun () -> Record_util.s2sm_to_string "; " (x ()).API.vMPP_archive_target_config)
- ~get_map:(fun () -> (x ()).API.vMPP_archive_target_config)
- ~add_to_map:(fun k v -> Client.VMPP.add_to_archive_target_config rpc session_id vmpp k v)
- ~remove_from_map:(fun k ->
- Client.VMPP.remove_from_archive_target_config rpc session_id vmpp k)
- ();
- make_field ~name:"archive-frequency"
- ~get:(fun () -> Record_util.archive_frequency_to_string (x ()).API.vMPP_archive_frequency)
- ~set:(fun x -> Client.VMPP.set_archive_frequency rpc session_id vmpp (Record_util.string_to_archive_frequency x))
- ();
- make_field ~name:"archive-schedule" ~get:(fun () -> Record_util.s2sm_to_string "; " (x ()).API.vMPP_archive_schedule)
- ~get_map:(fun () -> (x ()).API.vMPP_archive_schedule)
- ~add_to_map:(fun k v -> Client.VMPP.add_to_archive_schedule rpc session_id vmpp k v)
- ~remove_from_map:(fun k ->
- Client.VMPP.remove_from_archive_schedule rpc session_id vmpp k)
- ();
- make_field ~name:"is-archive-running"
- ~get:(fun () -> string_of_bool (x ()).API.vMPP_is_archive_running)
- ();
- make_field ~name:"archive-last-run-time" ~get:(fun () -> Date.to_string (x ()).API.vMPP_archive_last_run_time)
- ();
- make_field ~name:"is-alarm-enabled"
- ~get:(fun () -> string_of_bool (x ()).API.vMPP_is_alarm_enabled)
- ~set:(fun x -> Client.VMPP.set_is_alarm_enabled rpc session_id vmpp (safe_bool_of_string "is-alarm-enabled" x))
- ();
- make_field ~name:"alarm-config" ~get:(fun () -> Record_util.s2sm_to_string "; " (x ()).API.vMPP_alarm_config)
- ~get_map:(fun () -> (x ()).API.vMPP_alarm_config)
- ~add_to_map:(fun k v -> Client.VMPP.add_to_alarm_config rpc session_id vmpp k v)
- ~remove_from_map:(fun k ->
- Client.VMPP.remove_from_alarm_config rpc session_id vmpp k)
- ();
- make_field ~name:"VMs"
- ~get:(fun () -> String.concat "; "
- (try
- List.map
- (fun self -> try Client.VM.get_uuid rpc session_id self with _ -> nid)
- (Client.VMPP.get_VMs rpc session_id vmpp)
- with _ -> []
- )
- )
- ~expensive:false
- ~get_set:(fun () -> try List.map
- (fun self -> try Client.VM.get_uuid rpc session_id self with _ -> nid)
- (Client.VMPP.get_VMs rpc session_id vmpp) with _ -> [])
- ();
-]}
-
(*
let alert_record rpc session_id pool =
let _ref = ref pool in
@@ -943,11 +841,6 @@ let vm_record rpc session_id vm =
(* NB this can receive VM_IS_SNAPSHOT *)
~get:(fun () -> string_of_bool (try Client.VM.get_cooperative rpc session_id vm with _ -> true))
~expensive:true ~deprecated:true ();
- make_field ~name:"protection-policy"
- ~get:(fun () -> get_uuid_from_ref (x ()).API.vM_protection_policy)
- ~set:(fun x -> if x="" then Client.VM.set_protection_policy rpc session_id vm Ref.null else Client.VM.set_protection_policy rpc session_id vm (Client.VMPP.get_by_uuid rpc session_id x)) ();
- make_field ~name:"is-snapshot-from-vmpp"
- ~get:(fun () -> string_of_bool (x ()).API.vM_is_snapshot_from_vmpp) ();
make_field ~name:"tags"
~get:(fun () -> String.concat ", " (x ()).API.vM_tags)
~get_set:(fun () -> (x ()).API.vM_tags)
View
16 ocaml/xapi/cli_frontend.ml
@@ -2361,22 +2361,6 @@ add a mapping of 'path' -> '/tmp', the command line should contain the argument
; implementation = No_fd Cli_operations.secret_destroy
; flags = []
};
- "vmpp-create",
- {
- reqd=["name-label";"backup-type";"backup-frequency"];
- optn=["name-description";"is-policy-enabled";"backup-schedule:";"backup-retention-value";"archive-target-type";"archive-target-config:";"archive-frequency";"archive-schedule:";"is-alarm-enabled";"alarm-config:"];
- help="Create a new VM protection policy.";
- implementation=No_fd Cli_operations.vmpp_create;
- flags=[];
- };
- "vmpp-destroy",
- {
- reqd=["uuid"];
- optn=[];
- help="Destroy a VM protection policy.";
- implementation=No_fd Cli_operations.vmpp_destroy;
- flags=[];
- };
"appliance-create",
{
reqd=["name-label"];
View
44 ocaml/xapi/cli_operations.ml
@@ -768,7 +768,7 @@ let gen_cmds rpc session_id =
(make_param_funs (Client.Console.get_all) (Client.Console.get_all_records_where) (Client.Console.get_by_uuid) (console_record) "console" [] ["uuid";"vm-uuid";"vm-name-label";"protocol";"location"] rpc session_id) @
(make_param_funs (Client.VM.get_all) (Client.VM.get_all_records_where) (Client.VM.get_by_uuid) (vm_record) "vm" [("is-a-template","false")] ["name-label";"uuid";"power-state"] rpc session_id) @
(make_param_funs (Client.VM.get_all) (Client.VM.get_all_records_where) (Client.VM.get_by_uuid) (vm_record) "template" [("is-a-template","true");("is-a-snapshot","false")] ["name-label";"name-description";"uuid"] rpc session_id) @
- (make_param_funs (Client.VM.get_all) (Client.VM.get_all_records_where) (Client.VM.get_by_uuid) (vm_record) "snapshot" [("is-a-snapshot","true")] ["name-label";"name-description";"uuid";"snapshot_of"; "snapshot_time"; "is-snapshot-from-vmpp"] rpc session_id) @
+ (make_param_funs (Client.VM.get_all) (Client.VM.get_all_records_where) (Client.VM.get_by_uuid) (vm_record) "snapshot" [("is-a-snapshot","true")] ["name-label";"name-description";"uuid";"snapshot_of"; "snapshot_time"] rpc session_id) @
(make_param_funs (Client.Host.get_all) (Client.Host.get_all_records_where) (Client.Host.get_by_uuid) (host_record) "host" [] ["uuid";"name-label";"name-description"] rpc session_id) @
(make_param_funs (Client.Host_cpu.get_all) (Client.Host_cpu.get_all_records_where) (Client.Host_cpu.get_by_uuid) (host_cpu_record) "host-cpu" [] ["uuid";"number";"vendor";"speed";"utilisation"] rpc session_id) @
(make_param_funs (Client.Host_crashdump.get_all) (Client.Host_crashdump.get_all_records_where) (Client.Host_crashdump.get_by_uuid) (host_crashdump_record) "host-crashdump" [] ["uuid";"host";"timestamp";"size"] rpc session_id) @
@@ -782,7 +782,6 @@ let gen_cmds rpc session_id =
(make_param_funs (Client.Subject.get_all) (Client.Subject.get_all_records_where) (Client.Subject.get_by_uuid) (subject_record) "subject" [] ["uuid";"subject-identifier";"other-config";"roles"] rpc session_id) @
(make_param_funs (Client.Role.get_all) (fun ~rpc ~session_id ~expr -> Client.Role.get_all_records_where ~rpc ~session_id ~expr:Xapi_role.expr_no_permissions)
(Client.Role.get_by_uuid) (role_record) "role" [] ["uuid";"name";"description";"subroles"] rpc session_id) @
- (make_param_funs (Client.VMPP.get_all) (Client.VMPP.get_all_records_where) (Client.VMPP.get_by_uuid) (vmpp_record) "vmpp" [] ["uuid";"name-label";"name-description";"is-policy-enabled";"backup-type";"backup-retention-value";"backup-frequency";"backup-schedule";"is-backup-running";"backup-last-run-time";"archive-target-type";"archive-target-config";"archive-frequency";"archive-schedule";"is-archive-running";"archive-last-run-time";"is-alarm-enabled";"alarm-config";"VMs"] rpc session_id) @
(*
(make_param_funs (Client.Blob.get_all) (Client.Blob.get_all_records_where) (Client.Blob.get_by_uuid) (blob_record) "blob" [] ["uuid";"mime-type"] rpc session_id) @
*)
@@ -1617,7 +1616,6 @@ let event_wait_gen rpc session_id classname record_matches =
| "task" -> List.map (fun x -> (task_record rpc session_id x).fields) (Client.Task.get_all rpc session_id)
| "subject" -> List.map (fun x -> (subject_record rpc session_id x).fields) (Client.Subject.get_all rpc session_id)
| "role" -> List.map (fun x -> (role_record rpc session_id x).fields) (Client.Role.get_all rpc session_id)
- | "vmpp" -> List.map (fun x -> (vmpp_record rpc session_id x).fields) (Client.VMPP.get_all rpc session_id)
| "secret" -> List.map (fun x -> (secret_record rpc session_id x).fields) (Client.Secret.get_all rpc session_id)
(* | "alert" -> List.map (fun x -> (alert_record rpc session_id x).fields) (Client.Alert.get_all rpc session_id) *)
| _ -> failwith ("Cli listening for class '"^classname^"' not currently implemented")
@@ -1657,7 +1655,6 @@ let event_wait_gen rpc session_id classname record_matches =
| Event_helper.PBD (r,Some x) -> let record = pbd_record rpc session_id r in record.setrefrec (r,x); record.fields
| Event_helper.Pool (r,Some x) -> let record = pool_record rpc session_id r in record.setrefrec (r,x); record.fields
| Event_helper.Task (r,Some x) -> let record = task_record rpc session_id r in record.setrefrec (r,x); record.fields
- | Event_helper.VMPP (r,Some x) -> let record = vmpp_record rpc session_id r in record.setrefrec (r,x); record.fields
| Event_helper.Secret (r,Some x) -> let record = secret_record rpc session_id r in record.setrefrec (r,x); record.fields
| _ -> failwith ("Cli listening for class '"^classname^"' not currently implemented")
in
@@ -4235,45 +4232,6 @@ let secret_destroy printer rpc session_id params =
let ref = Client.Secret.get_by_uuid ~rpc ~session_id ~uuid in
Client.Secret.destroy ~rpc ~session_id ~self:ref
-let vmpp_create printer rpc session_id params =
- let get ?default param_name =
- if List.mem_assoc param_name params
- then List.assoc param_name params
- else match default with
- | Some default_value -> default_value
- | None -> failwith ("No default value for parameter "^param_name)
- in
- let map param_name ?default xmlrpc_to_type api_from_type =
- api_from_type param_name (xmlrpc_to_type (get ?default param_name))
- in
- let name_label = List.assoc "name-label" params in
- let backup_type = map "backup-type" XMLRPC.To.string API.Legacy.From.vmpp_backup_type in
- let backup_frequency = map "backup-frequency" XMLRPC.To.string API.Legacy.From.vmpp_backup_frequency in
- let backup_schedule = read_map_params "backup-schedule" params in
- (* optional parameters with default values *)
- let name_description = get "name-description" ~default:"" in
- let is_policy_enabled = Record_util.bool_of_string(get "is-policy-enabled" ~default:"true") in
- let backup_retention_value = map "backup-retention-value" ~default:"7" XMLRPC.To.string API.Legacy.From.int64 in
- let archive_frequency = map "archive-frequency" ~default:"never" XMLRPC.To.string API.Legacy.From.vmpp_archive_frequency in
- let archive_target_type = map "archive-target-type" ~default:"none" XMLRPC.To.string API.Legacy.From.vmpp_archive_target_type in
- let archive_target_config = read_map_params "archive-target-config" params in
- let archive_schedule = read_map_params "archive-schedule" params in
- let is_alarm_enabled = Record_util.bool_of_string(get "is-alarm-enabled" ~default:"false") in
- let alarm_config = read_map_params "alarm-config" params in
- let ref = Client.VMPP.create ~rpc ~session_id ~name_label ~name_description
- ~is_policy_enabled ~backup_type ~backup_retention_value ~backup_frequency
- ~backup_schedule ~archive_target_type
- ~archive_target_config ~archive_frequency ~archive_schedule
- ~is_alarm_enabled ~alarm_config
- in
- let uuid = Client.VMPP.get_uuid ~rpc ~session_id ~self:ref in
- printer (Cli_printer.PList [uuid])
-
-let vmpp_destroy printer rpc session_id params =
- let uuid = List.assoc "uuid" params in
- let ref = Client.VMPP.get_by_uuid ~rpc ~session_id ~uuid in
- Client.VMPP.destroy ~rpc ~session_id ~self:ref
-
let vm_appliance_create printer rpc session_id params =
let name_label = List.assoc "name-label" params in
let name_description =
Please sign in to comment.
Something went wrong with that request. Please try again.