Add disk_types sub-properties to CloudConfig schema

This commit is contained in:
Kris De Volder
2017-08-09 15:53:40 -07:00
parent 263b6067cf
commit ec1dbc5e9f
6 changed files with 68 additions and 5 deletions

View File

@@ -41,7 +41,9 @@ public class BoshCloudConfigSchema extends SchemaSupport implements YamlSchema {
private final YType t_vm_type_ref;
private final YType t_vm_type_def;
private final YType t_network_ref;
private AbstractType t_network_def;
private final YType t_network_def;
private final YType t_disk_type_def;
private final YType t_disk_type_ref;
private Collection<YType> definitionTypes;
private final Lazy<Collection<Pair<YType, YType>>> defAndRefTypes = new Lazy<>();
private AbstractType t_any;
@@ -80,6 +82,11 @@ public class BoshCloudConfigSchema extends SchemaSupport implements YamlSchema {
t_ip_range = t_ne_string; //TODO? Syntax for ip ranges like 10.10.0.0/22 ?
t_ip_address_or_range = t_ne_string; //TODO?
t_disk_type_def = f.yatomic("DiskTypeName").parseWith(ValueParsers.NE_STRING);
t_disk_type_ref = f.yenumFromDynamicValues("DiskTypeName",(dc) -> PartialCollection.compute(() ->
models.astTypes.getDefinedNames(dc, t_disk_type_def)
));
YType t_network = createNetworkBlockSchema(models);
YBeanType t_az = f.ybean("AZ");
@@ -97,12 +104,17 @@ public class BoshCloudConfigSchema extends SchemaSupport implements YamlSchema {
addProp(t_vm_type, "name", t_vm_type_def).isPrimary(true);
addProp(t_vm_type, "cloud_properties", t_params);
YBeanType t_disk_type = f.ybean("DiskType");
addProp(t_disk_type, "name", t_disk_type_def).isPrimary(true);
addProp(t_disk_type, "disk_size", t_pos_integer).isRequired(true);
addProp(t_disk_type, "cloud_properties", t_params);
this.toplevelType = f.ybean("CloudConfig");
addProp(toplevelType, "azs", f.yseq(t_az)).isRequired(true);
addProp(toplevelType, "networks", f.yseq(t_network)).isRequired(true);
addProp(toplevelType, "vm_types", f.yseq(t_vm_type)).isRequired(true);
addProp(toplevelType, "vm_extensions", t_any);
addProp(toplevelType, "disk_types", t_any).isRequired(true);
addProp(toplevelType, "vm_extensions", f.yseq(t_any));
addProp(toplevelType, "disk_types", f.yseq(t_disk_type)).isRequired(true);
addProp(toplevelType, "compilation", t_compilation).isRequired(true);
ASTTypeCache astTypes = models.astTypes;
@@ -186,7 +198,8 @@ public class BoshCloudConfigSchema extends SchemaSupport implements YamlSchema {
return defAndRefTypes.load(() -> ImmutableList.of(
Pair.of(t_vm_type_def, t_vm_type_ref),
Pair.of(t_network_def, t_network_ref),
Pair.of(t_az_def, t_az_ref)
Pair.of(t_az_def, t_az_ref),
Pair.of(t_disk_type_def, t_disk_type_ref)
));
}

View File

@@ -0,0 +1,11 @@
Describes any IaaS-specific properties needed to create disks. Examples: `type`, `iops`. Default is `{}` (empty Hash).
CPI Specific `cloud_properties`
- See [AWS CPI disk type cloud properties](https://bosh.io/docs/aws-cpi.html#disk-pools)
- See [Azure CPI disk type cloud properties](https://bosh.io/docs/azure-cpi.html#disk-pools)
- See [OpenStack CPI disk type cloud properties](https://bosh.io/docs/openstack-cpi.html#disk-pools)
- See [Softlayer CPI disk type cloud properties](https://bosh.io/docs/softlayer-cpi.html#disk-pools)
- See [Google Cloud Platform CPI disk type cloud properties](https://bosh.io/docs/google-cpi.html#disk-pools)
- See [vSphere CPI disk type cloud properties](https://bosh.io/docs/vsphere-cpi.html#disk-pools)
- See [vCloud CPI disk type cloud properties](https://bosh.io/docs/vcloud-cpi.html#disk-pools)

View File

@@ -0,0 +1 @@
*Require*. Specifies the disk size. `disk_size` must be a positive integer. BOSH creates a [persistent disk](https://bosh.io/docs/persistent-disks.html) of that size in megabytes and attaches it to each job instance VM.

View File

@@ -0,0 +1 @@
*Required*. A unique name used to identify and reference the disk type