|
15 | 15 | open API
|
16 | 16 | open OUnit
|
17 | 17 |
|
| 18 | +(** Utility functions *) |
18 | 19 | let skip str = skip_if true str
|
| 20 | +let make_uuid () = Uuid.string_of_uuid (Uuid.make_uuid ()) |
19 | 21 |
|
20 | 22 | (** Make a simple in-memory database containing a single host and dom0 VM record. *)
|
21 | 23 | let make_test_database () =
|
@@ -63,7 +65,7 @@ let make_vm ~__context ?(name_label="name_label") ?(name_description="descriptio
|
63 | 65 | ~ha_always_run ~ha_restart_priority ~tags ~blocked_operations ~protection_policy
|
64 | 66 | ~is_snapshot_from_vmpp ~appliance ~start_delay ~shutdown_delay ~order ~suspend_SR ~version
|
65 | 67 |
|
66 |
| -let make_host ~__context ?(uuid=Uuid.string_of_uuid (Uuid.make_uuid ())) ?(name_label="host") |
| 68 | +let make_host ~__context ?(uuid=make_uuid ()) ?(name_label="host") |
67 | 69 | ?(name_description="description") ?(hostname="localhost") ?(address="127.0.0.1")
|
68 | 70 | ?(external_auth_type="") ?(external_auth_service_name="") ?(external_auth_configuration=[])
|
69 | 71 | ?(license_params=[]) ?(edition="free") ?(license_server=[]) ?(local_cache_sr=Ref.null) ?(chipset_info=[]) () =
|
@@ -95,11 +97,49 @@ let make_pool ~__context ~master ?(name_label="") ?(name_description="")
|
95 | 97 | ?(other_config=[Xapi_globs.memory_ratio_hvm; Xapi_globs.memory_ratio_pv]) () =
|
96 | 98 | let pool_ref = Ref.make () in
|
97 | 99 | Db.Pool.create ~__context ~ref:pool_ref
|
98 |
| - ~uuid:(Uuid.to_string (Uuid.make_uuid ())) ~name_label ~name_description |
| 100 | + ~uuid:(make_uuid ()) ~name_label ~name_description |
99 | 101 | ~master ~default_SR ~suspend_image_SR ~crash_dump_SR ~ha_enabled
|
100 | 102 | ~ha_configuration ~ha_statefiles ~ha_host_failures_to_tolerate
|
101 | 103 | ~ha_plan_exists_for ~ha_allow_overcommit ~ha_overcommitted ~blobs ~tags
|
102 | 104 | ~gui_config ~wlb_url ~wlb_username ~wlb_password ~wlb_enabled
|
103 | 105 | ~wlb_verify_cert ~redo_log_enabled ~redo_log_vdi ~vswitch_controller
|
104 | 106 | ~restrictions ~other_config;
|
105 | 107 | pool_ref
|
| 108 | + |
| 109 | +let make_sr ~__context ~ref ?(uuid=make_uuid ()) ?(name_label="") ?(name_description="") ?(allowed_operations=[]) |
| 110 | + ?(current_operations=[]) ?(virtual_allocation=0L) ?(physical_utilisation=0L) ?(physical_size=0L) ?(_type="") |
| 111 | + ?(content_type="") ?(shared=true) ?(other_config=[]) ?(tags=[]) ?(default_vdi_visibility=true) |
| 112 | + ?(sm_config=[]) ?(blobs=[]) ?(local_cache_enabled=false) ?(introduced_by=Ref.make ()) () = |
| 113 | + Db.SR.create ~__context ~ref ~uuid ~name_label ~name_description ~allowed_operations |
| 114 | + ~current_operations ~virtual_allocation ~physical_utilisation ~physical_size ~_type |
| 115 | + ~content_type ~shared ~other_config ~tags ~default_vdi_visibility ~sm_config ~blobs |
| 116 | + ~local_cache_enabled ~introduced_by |
| 117 | + |
| 118 | +let make_pbd ~__context ~ref ?(uuid=make_uuid ()) ?(host=Ref.make ()) ?(sR=Ref.make ()) |
| 119 | + ?(device_config=[]) ?(currently_attached=true) ?(other_config=[]) () = |
| 120 | + Db.PBD.create ~__context ~ref ~uuid ~host ~sR ~device_config ~currently_attached ~other_config |
| 121 | + |
| 122 | +let make_vbd ~__context ?(ref=Ref.make ()) ?(uuid=make_uuid ()) ?(allowed_operations=[]) |
| 123 | + ?(current_operations=[]) ?(vM=Ref.make ()) ?(vDI=Ref.make ()) ?(device="") |
| 124 | + ?(userdevice="") ?(bootable=true) ?(mode=`RW) ?(_type=`Disk) |
| 125 | + ?(unpluggable=false) ?(storage_lock=false) ?(empty=false) |
| 126 | + ?(reserved=false) ?(other_config=[]) ?(currently_attached=false) |
| 127 | + ?(status_code=0L) ?(status_detail="") ?(runtime_properties=[]) |
| 128 | + ?(qos_algorithm_type="") ?(qos_algorithm_params=[]) ?(qos_supported_algorithms=[]) |
| 129 | + ?(metrics = Ref.make ()) () = |
| 130 | + Db.VBD.create ~__context ~ref ~uuid ~allowed_operations ~current_operations ~vM ~vDI ~device |
| 131 | + ~userdevice ~bootable ~mode ~_type ~unpluggable ~storage_lock ~empty ~reserved ~other_config |
| 132 | + ~currently_attached ~status_code ~status_detail ~runtime_properties ~qos_algorithm_type |
| 133 | + ~qos_algorithm_params ~qos_supported_algorithms ~metrics |
| 134 | + |
| 135 | +let make_vdi ~__context ?(ref=Ref.make ()) ?(uuid=make_uuid ()) ?(name_label="") |
| 136 | + ?(name_description="") ?(allowed_operations=[]) ?(current_operations=[]) ?(sR=Ref.make ()) |
| 137 | + ?(virtual_size=0L) ?(physical_utilisation=0L) ?(_type=`user) ?(sharable=true) ?(read_only=false) |
| 138 | + ?(other_config=[]) ?(storage_lock=false) ?(location="") ?(managed=false) ?(missing=false) |
| 139 | + ?(parent=Ref.null) ?(xenstore_data=[]) ?(sm_config=[]) ?(is_a_snapshot=false) |
| 140 | + ?(snapshot_of=Ref.null) ?(snapshot_time=API.Date.never) ?(tags=[]) ?(allow_caching=true) |
| 141 | + ?(on_boot=`persist) ?(metadata_of_pool=Ref.make ()) ?(metadata_latest=true) () = |
| 142 | + Db.VDI.create ~__context ~ref ~uuid ~name_label ~name_description ~allowed_operations |
| 143 | + ~current_operations ~sR ~virtual_size ~physical_utilisation ~_type ~sharable ~read_only ~other_config |
| 144 | + ~storage_lock ~location ~managed ~missing ~parent ~xenstore_data ~sm_config ~is_a_snapshot ~snapshot_of |
| 145 | + ~snapshot_time ~tags ~allow_caching ~on_boot ~metadata_of_pool ~metadata_latest |
0 commit comments