-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CP-47304: [Toolstack] - Add data model for anti-affinity group
CP-47655: [Toolstack] - Associate/disassociate VM to/from anti-affinity group Signed-off-by: Bengang Yuan <[email protected]>
- Loading branch information
Showing
19 changed files
with
328 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
(* | ||
* Copyright (c) Cloud Software Group, Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation; version 2.1 only. with the special | ||
* exception on linking described in file LICENSE. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
*) | ||
|
||
open Datamodel_types | ||
open Datamodel_common | ||
open Datamodel_roles | ||
|
||
let placement_type = | ||
Enum | ||
( "vm_placement_type" | ||
, [ | ||
("anti_affinity", "VM anti-affinity group") | ||
; ("normal", "Normal type group") | ||
] | ||
) | ||
|
||
let create = | ||
call ~name:"create" ~in_oss_since:None ~lifecycle:[] | ||
~doc:"Create a new VM group" | ||
~params: | ||
[ | ||
(String, "name_label", "The name of the VM group") | ||
; (String, "name_description", "The description of the VM group") | ||
; (placement_type, "placement", "The placement type of the VM group") | ||
] | ||
~result:(Ref _vm_group, "The ref of the created VM group record") | ||
~allowed_roles:_R_VM_ADMIN () | ||
|
||
let destroy = | ||
call ~name:"destroy" ~in_oss_since:None ~lifecycle:[] | ||
~doc:"Remove the VM group record from the database" | ||
~params: | ||
[ | ||
( Ref _vm_group | ||
, "self" | ||
, "The Ref of the VM group to be removed from the database" | ||
) | ||
] | ||
~allowed_roles:_R_VM_ADMIN () | ||
|
||
let t = | ||
create_obj ~name:_vm_group ~descr:"A VM group" ~doccomments:[] | ||
~gen_constructor_destructor:false ~gen_events:true ~in_db:true ~lifecycle:[] | ||
~persist:PersistEverything ~in_oss_since:None | ||
~messages_default_allowed_roles:_R_VM_ADMIN ~messages:[create; destroy] | ||
~contents: | ||
[ | ||
uid _vm_group | ||
; namespace ~name:"name" ~contents:(names None RW) () | ||
; field ~qualifier:StaticRO ~lifecycle:[] ~ty:placement_type "placement" | ||
~default_value:(Some (VEnum "normal")) | ||
"The placement type of the VM group" | ||
; field ~qualifier:DynamicRO ~lifecycle:[] ~ty:(Set (Ref _vm)) "VMs" | ||
"The list of VMs currently associated with the group" | ||
] | ||
() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.