VMware Cloud Community
dbis7575
Enthusiast
Enthusiast

vRA8 disk and nic count

I am trying to create a vRA8 blueprint in which I can select either (1 or 2) NIC's and have the option to add additional drives to a blueprint.  Requests will be consumed through the API, not through Service Broker.

I was hoping the "count" property for the disks or network cards could help, but I get errors during deployment if I try to use them.

Is there another way to add a NIC or drive through an ABX action prior to allocation? Any recommendations are greatly appreciated.

9 Replies
thegrumpyengine
Enthusiast
Enthusiast

The count property does work within a blueprint. I have a couple of custom inputs where the user inputs the number and size of additional disks and it builds.

The key bits of the blueprint are as follows:

inputs:

  additionalDiskCount:

    type: integer

    title: Additional Disk Count

  additionalDiskSize:

    type: integer

    title: Additional Disk Size (GB))

resources:

  demo-machine:

    type: Cloud.vSphere.Machine

    properties:

      name: demo-machine

      customizationSpec: Linux_Custom_Spec

      count: '${input.instances}'

      resourceGroupName: '${"VRM/" + to_upper(env.projectName)}'

      attachedDisks: '${map_to_object(resource.Cloud_vSphere_Disk_1[*].id, "source")}'

      networks:

        - network: '${resource.Cloud_vSphere_Network_1.id}'

      tags:

        - key: Backup

          value: '${input.backupLevel}'

  Cloud_vSphere_Disk_1:

    type: Cloud.vSphere.Disk

    properties:

      capacityGb: '${input.additionalDiskSize}'

      count: '${input.additionalDiskCount}'

      name: Disk_XXX

      provisioningType: thin

Hope it helps!

dbis7575
Enthusiast
Enthusiast

This gets me a little bit further, but I want to get to the option where we have additional drives of different sizes and either 1 or 2 network interfaces on different networks.

A couple of things I notices:

1. I copied the syntax from your example and it did not work. If I first create a disk or network object and add the count parameter before linking it to the machine it works even tough the syntax is the same.

2. If I create multiple disk or network objects that have a count property, I am only able to link one of them through the canvas and have not been able to get any yaml code working to get around this.

okeedokee
Enthusiast
Enthusiast

  Cloud_vSphere_Disk_1:

    type: Cloud.vSphere.Disk

    properties:

      capacityGb: '${input.additionalDiskSize}'

      count: '${input.additionalDiskCount}'

      name: Disk_XXX

      provisioningType: thin

How do you get this to iterdate through the number of disks specified?

Disk_XXX

Reply
0 Kudos
dbis7575
Enthusiast
Enthusiast

I did get an answer from VMWare engineering that resolves this issue for the disk count. You would create your disks with a count property, but you do not link them through the canvas instead add the following to your machine properties (below example is for two additional drives):

attachedDisks: '${map_to_object(resource.Cloud_vSphere_Disk_1[*].id + resource.Cloud_vSphere_Disk_2[*].id, "source")}'

This syntax works fine with a count of 0 or 1 but not for counts larger, but this is all I need for my use case.

Similar syntax works for network resources with a count property, but it is not very useful as the following dos not work:

- Cannot apply a constraint tag to the network resource (no error if the constraint tags are the same on all resources, but the deployment will show an error that the resources are missing even tough the machine gets build correctly)

- Cannot specify network profile within the machine properties

- Cannot specify static assignment for the network resources within the machine properties.

Reply
0 Kudos
dbis7575
Enthusiast
Enthusiast

A little progress, the option to select networks is functional by using constraint tags. I was using networks from different network profiles and this is an issue listed in the 8.0.1 release notes. This means that if you have multiple networks on a machine, they all need to be part of the same network profile.

Still trying to get the static assignment to work using the integrated IPAM but haven't found any functional syntax yet.

In order to add multiple NICs with count property use the following syntax:

networks: '${map_to_object(resource.Cloud_vSphere_Network_1[*].id + resource.Cloud_vSphere_Network_2[*].id, "network")}'

itrudeau
Contributor
Contributor

Hello Dbis7575.

I have try the networks: '${map_to_object(resource.Cloud_vSphere_Network_1[*].id + resource.Cloud_vSphere_Network_2[*].id, "network")}' for dynamic network assignment.

The Yaml code seams to be fine but I got error at the deployment provisionning network layer.

Create Failed - com.vmware.xenon.common.ServiceHost$ServiceNotFoundException: Service not found: http://XX.XX.XX.XX:8282/provisioning/resources/compute-networks/3c148adf-556e-427f-ae19-7d8bdebe9db5

Here the code I have:

# Created by Quickstart wizard.

formatVersion: 1

inputs:

  netCount:

    type: integer

    default: 1

    minimum: 1

    maximum: 6

  network:

    type: string

    default: null

  network2:

    type: string

    default: null

  network3:

    type: string

    default: null

  network4:

    type: string

    default: null

resources:

Cloud_vSphere_Network_1:

    type: Cloud.vSphere.Network

    properties:

      networkType: existing

      constraints:

        - tag: 'vdsp:${input.network}'

      count: '${input.netCount >= 1 ? 1 : 0}'

Cloud_vSphere_Network_2:

    type: Cloud.vSphere.Network

    properties:

      networkType: existing

      count: '${input.netCount >= 2 ? 1 : 0}'

      constraints:

        - tag: 'vdsp:${input.network2}'

Cloud_vSphere_Network_3:

    type: Cloud.vSphere.Network

    properties:

      networkType: existing

      constraints:

        - tag: 'vdsp:${input.network3}'

      count: '${input.netCount >= 3 ? 1 : 0}'

Cloud_vSphere_Network_4:

    type: Cloud.vSphere.Network

    properties:

      networkType: existing

      count: '${input.netCount >= 4 ? 1 : 0}'

      constraints:

        - tag: 'vdsp:${input.network4}'

  vSphere_Machine:

    type: Cloud.vSphere.Machine

      networks: '${map_to_object(resource.Cloud_vSphere_Network_1[*].id + resource.Cloud_vSphere_Network_2[*].id, "network")}'

Do you got any idea what i am doing wrong ?

Regards.

Reply
0 Kudos
mmonkman
Enthusiast
Enthusiast

Any luck with the static IPAM assignment?

Reply
0 Kudos
nzdave
Contributor
Contributor

we had same issue with multiple NIC's and static IPAM assignment and found this works for mapping in the machine resource. It then dynamically maps 1 or 2 (or more) nics to the machine and adds the static assignment property to each.

      networks: '${map_by(resource.network_1[*].id + resource.network_2[*].id, id => {"network":id, "assignment":"static"})}'

Reply
0 Kudos
Czernobog
Expert
Expert

How do you get this to iterdate through the number of disks specified?

You don't, because count is not working as of now.

I managed to get support to open a feature request (not bugfix, mind you...) for this issue to get fixed, see this and also other threads on this topic:

vRA 8.1 - add multiple disks to vm via blueprint - array iteration issue with count.index

Reply
0 Kudos