Skip to content

Commit 453869c

Browse files
authored
Merge pull request xapi-project#247 from robhoes/ely-bugfix
CA-234358: add version to pool_update
2 parents 16d7487 + 2e69142 commit 453869c

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

ocaml/idl/datamodel.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4122,6 +4122,7 @@ let pool_update =
41224122
~contents:
41234123
[ uid ~in_oss_since:None _pool_update;
41244124
namespace ~name:"name" ~contents:(names None StaticRO) ();
4125+
field ~in_product_since:rel_ely ~default_value:(Some (VString "")) ~in_oss_since:None ~qualifier:StaticRO ~ty:String "version" "Update version number";
41254126
field ~in_product_since:rel_ely ~default_value:(Some (VInt Int64.zero)) ~in_oss_since:None ~qualifier:StaticRO ~ty:Int "installation_size" "Size of the update in bytes";
41264127
field ~in_product_since:rel_ely ~default_value:(Some (VString "")) ~in_oss_since:None ~qualifier:StaticRO ~ty:String "key" "GPG key of the update";
41274128
field ~in_product_since:rel_ely ~default_value:(Some (VSet [])) ~in_oss_since:None ~qualifier:StaticRO ~ty:(Set pool_update_after_apply_guidance) "after_apply_guidance" "What the client should do after this update has been applied.";

ocaml/test/test_common.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ let make_pvs_cache_storage ~__context ?(ref=Ref.make ()) ?(uuid=make_uuid ())
351351
ref
352352

353353
let make_pool_update ~__context ?(ref=Ref.make ()) ?(uuid=make_uuid ())
354-
?(name_label="") ?(name_description="") ?(installation_size=0L) ?(key="")
354+
?(name_label="") ?(name_description="") ?(version="") ?(installation_size=0L) ?(key="")
355355
?(after_apply_guidance=[]) ?(vdi=Ref.null) () =
356-
let update_info = Xapi_pool_update.{uuid; name_label; name_description; key; installation_size; after_apply_guidance} in
356+
let update_info = Xapi_pool_update.{uuid; name_label; name_description; version; key; installation_size; after_apply_guidance} in
357357
Xapi_pool_update.create_update_record ~__context ~update:ref ~update_info ~vdi;
358358
ref

ocaml/xapi/xapi_pool_update.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type update_info = {
4040
uuid: string;
4141
name_label: string;
4242
name_description: string;
43+
version: string;
4344
key: string;
4445
installation_size: int64;
4546
after_apply_guidance: API.after_apply_guidance list;
@@ -240,6 +241,9 @@ let parse_update_info xml =
240241
let name_label = try List.assoc "name-label" attr
241242
with _ -> raise (Api_errors.Server_error(Api_errors.invalid_update, ["missing <name-label> in update.xml"]))
242243
in
244+
let version = try List.assoc "version" attr
245+
with _ -> raise (Api_errors.Server_error(Api_errors.invalid_update, ["missing <version> in update.xml"]))
246+
in
243247
let installation_size =
244248
try
245249
Int64.of_string (List.assoc "installation-size" attr)
@@ -266,6 +270,7 @@ let parse_update_info xml =
266270
uuid = uuid;
267271
name_label = name_label;
268272
name_description = name_description;
273+
version = version;
269274
key = Filename.basename key;
270275
installation_size = installation_size;
271276
after_apply_guidance = guidance;
@@ -346,7 +351,7 @@ let create_update_record ~__context ~update ~update_info ~vdi =
346351
~ref:patch_ref ~uuid:(patch_uuid_of_update_uuid update_info.uuid)
347352
~name_label:update_info.name_label
348353
~name_description:update_info.name_description
349-
~version:"0"
354+
~version:update_info.version
350355
~filename:""
351356
~size:update_info.installation_size
352357
~pool_applied:false
@@ -358,6 +363,7 @@ let create_update_record ~__context ~update ~update_info ~vdi =
358363
~uuid:update_info.uuid
359364
~name_label:update_info.name_label
360365
~name_description:update_info.name_description
366+
~version:update_info.version
361367
~installation_size:update_info.installation_size
362368
~key:update_info.key
363369
~after_apply_guidance:update_info.after_apply_guidance

0 commit comments

Comments
 (0)