VMware Cloud Community
thanhdoan
Contributor
Contributor

How can make blueprint with additional HDD

Hi All,

I want to make a blueprint on vra8 with vSphere infrastructure. I want User can add more HDD when they take a request.

I tries to use count properties but not effect.

  Cloud_vSphere_Disk_1:

    type: Cloud.vSphere.Disk

    properties:

      capacityGb: '${input.SizeHDD}'

      dataStore: '${input.DataStore}'

      count: '${input.HDDDisk}'

Thanks and Have a nice day

  Cloud_vSphere_Disk_1:
    type: Cloud.vSphere.Disk
    properties:
      capacityGb: '${input.DungLuongHDD}'
      dataStore: '${input.DataStore}'
      count: '${input.SoLuongHDD}'
17 Replies
thegrumpyengine
Enthusiast
Enthusiast

Below is my working example which adds multiple disks to the VM - note the attachedDisks line against the machine.

  demo-machine:

   type: Cloud.vSphere.Machine

   properties:

   name: demo-machine

   cpuCount: '${input.cpu}'

   totalMemoryMB: '${input.memory}'

   image: '${input.image}'

   customizationSpec: Linux_Custom_Spec

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

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

   tags:

   - key: Backup

   value: '${input.backupLevel}'

  Cloud_vSphere_Disk_1:

   type: Cloud.vSphere.Disk

   properties:

   capacityGb: '${input.additionalDiskSize}'

   count: '${input.additionalDiskCount}'

   name: Diskxxx

   provisioningType: thin

Reply
0 Kudos
thanhdoan
Contributor
Contributor

Hi

I tried your code but not work.

And I have another question: Can user set "Name of Windows" when they make a request?

Thanks.

Reply
0 Kudos
stevedrummond
Hot Shot
Hot Shot

What do you mean "it didn't work"? What exactly is happening that makes you think the count property for disks does not work? Is the blueprint failing to deploy? Is it failing to add disks and how are you verifying this?

Are you trying to provision one compute with multiple disks or multiple compute each with multiple disks?

What do you mean by "Name of Windows"? If you're asking what image to build from (2012 or 2016 for example) you use Image Mappings. If you mean can you name the machine there are many posts showing how to set your resourceNames (using EBS or vRA project nameTemplates).

Reply
0 Kudos
thanhdoan
Contributor
Contributor

Dear stevedrummond,

Have a nice day.

"What do you mean "it didn't work"? What exactly is happening that makes you think the count property for disks does not work? Is the blueprint failing to deploy? Is it failing to add disks and how are you verifying this?

Are you trying to provision one compute with multiple disks or multiple compute each with multiple disks?"

==> I tried provision one compute with mutiple disk but, testing and  deploying can not complete(Validation Request timed out. Please try again later.). I setup Request Timeout 1 day.

What do you mean by "Name of Windows"? If you're asking what image to build from (2012 or 2016 for example) you use Image Mappings. If you mean can you name the machine there are many posts showing how to set your resourceNames (using EBS or vRA project nameTemplates).

==> I want to user can input Windows Name of Windows OS when they make a request.

Thanks.

Reply
0 Kudos
dbis7575
Enthusiast
Enthusiast

The "count" property is functional for me, but I can only add one disk to a machine using this. This means all the additional disks would have to be the same size which doesn't meet the usual requirements, I would appreciate any solution for this as well.

As far as setting your name within windows, there are two ways to do this. You will have to set the name of the machine within the yaml file, but in order to get this updated within the OS you either need to reference a vCenter customizationspec that sets the name to the VM Name or use cloudbase-init to set the VM name in the OS.

Reply
0 Kudos
thanhdoan
Contributor
Contributor

HI dbis7575,

The "count" property is functional for me, but I can only add one disk to a machine using this. This means all the additional disks would have to be the same size which doesn't meet the usual requirements, I would appreciate any solution for this as well.

===> With Count = 1. My Blueprint work normaly.

"As far as setting your name within windows, there are two ways to do this. You will have to set the name of the machine within the yaml file, but in order to get this updated within the OS you either need to reference a vCenter customizationspec that sets the name to the VM Name or use cloudbase-init to set the VM name in the OS."

====> Can you please give me example or intruction? I tried hostname properties with cloudbase-init but not thing happen with my VM after deploy complete.

Thanks

Reply
0 Kudos
dbis7575
Enthusiast
Enthusiast

On the additional HDD with the count, please make sure of the following:

- You are running patch level 8.0.1

- Create the disk object and add the count property before linking it to your machine (reference doesn't always get updated properly if you link it first and then add the count property).

For cloudbase-init and setting the hostname, make sure you follow the steps in this article: Windows guest initialization with Cloudbase-Init in vCenter - VMware Cloud Management

It takes you through preparing your template (note that you need to install a beta version of cloudbase-init which is likely not acceptable for production environments). You also should not be using a customization template if you are cloudbase-init. If you have followed these steps and still have issues you will need to look at the logs. If you are still having issues with this then you will need to look at the logs. Unless you change the location, the default location is:

logdir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\

logfile=cloudbase-init.log

logfile=cloudbase-init-unattend.log

pizzle85
Expert
Expert

I'm with dbis7575, id like to be able to create and attach multiple disks to a VM while being able to choose the size and datastore of each disk. Ideally there would be an array input that the user can use to add X number of disks with unique configurations for each, then map that object onto the Cloud_vSphere_Disk_1 resource for each count iteration.

Reply
0 Kudos
thanhdoan
Contributor
Contributor

Dear dbis7575,

"You are running patch level 8.0.1. Create the disk object and add the count property before linking it to your machine (reference doesn't always get updated properly if you link it first and then add the count property)" ==> I'm running patc level 8.0.1. And I did exactly what you wrote add count property before linking it to machine but nothing happen with count=2.

"For cloudbase-init and setting the hostname, make sure you follow the steps in this article: Windows guest initialization with Cloudbase-Init in vCenter - VMware Cloud Management"

I following post above but not effect with me. Can you please see my Cloud-init config and log.

Reply
0 Kudos
dbis7575
Enthusiast
Enthusiast

The way I understand that it works is that vRA will create and mount an ISO with the metadata for cloudbase-init to process, your logs show that it is not able to find this metadata.

Unless there is something in your image that prevents the ISO from being mounted, I expect that there is an issue with the "cloudconfig" section in the yaml code to where vRA does not process is correctly.

I have just started working with cloudbase-init as well, so I would recommend that you reach out to support.

Reply
0 Kudos
stevedrummond
Hot Shot
Hot Shot

That is not how vRAC/vRA 8 blueprints work.

Each of those disks you are talking about is a unique disk object, so it should be represented on the blueprint as such. This way you can configure each disk individually with properties, constraints, tags, etc.

dbis7575
Enthusiast
Enthusiast

You can either add multiple disks to a blueprint each with it's own properties. You can also add a disk object with a "count" property, so you can control the number of additional disks with input parameters.... but then they all have the same properties. If you have a disk object with a count property, then you can only have one of those objects linked to your machine.

The idea is to have a single blueprint in which you can specify how many additional drives you want and what size of each of those drives should be. Right now you would need multuiple blueprints to accomplish this. I have been working with VMWare for a while now and they have not come up with a solution either.

I am now thinking I am just going to create a blueprint with "X" additional drives, for drives that are not needed I will build them as 1GB and then run an ABX action to remove the drives that are not needed after the machine has been provisioned. Not a pretty solution, but it should work until the product matures.

thanhdoan
Contributor
Contributor

Thanks your response.

Now I need do set Hostname of Windows OS. But all instruction did not work for me.

Thanks

Reply
0 Kudos
stevedrummond
Hot Shot
Hot Shot

If you have a disk object with a count property, then you can only have one of those objects linked to your machine

Is this true if you set the count to 0 or 1? You can always have multiple disks on the blueprint and set the count to 0 if it's not required.

The idea is to have a single blueprint in which you can specify how many additional drives you want and what size of each of those drives should be.

I have the same requirement as I need to offer "generic single IaaS" for the lowest consumer. However, to be fair to the product (unusual for me) its blueprints are not designed for that. A blueprint should represent the defined topology of each application or service, not a willy nilly decide at the time by the user. It supports scale out/in of those predefined components but not a total topology change. Bespoke requests can be handled by using the IaaS API directly or programmatically creating, deploying and destroying blueprints.

Reply
0 Kudos
dbis7575
Enthusiast
Enthusiast

The value of the count property does not matter, if you add a "count" property you can only link one disk object to your machine. You cannot even add disk objects without the "count" property, if you already have one with a "count" property. My initial plan was to just have several disk with a count property and then set it to either 0 or 1 depending if it was needed.

In my use case I will have some end-users requesting deployments through service broker, but most requests will be made using API calls from another automation system. I dont want to provide  a ton of blueprints I have to manage (and perform version control over all of them) just to accommodate different disk configurations in which their system would have to call different blueprints.

As it is simple IaaS I am providing and not PaaS I am trying to use vRA8 for this use case instead of vRA7, but it certainly is challenging right now with the limitations.

Reply
0 Kudos
pizzle85
Expert
Expert

I haven't gotten very far in vRA 8 yet so bare with me if im way off base... in vRA 7 i had an array of object type that the user could continually add "disk" objects to. in vRO i would iterate over the array of objects and transver the data to the disk properties of the VM (VirtualMachine.DiskN.Size, etc). Is there a way to do something like this through ABX or vRO where you push 'YAML' or properties or something back up to the object to include N number of 'disk objects' post request.

Reply
0 Kudos
stevedrummond
Hot Shot
Hot Shot

No you can't do it with extensibility.

You have to wrap your intended "blueprint" with a different catalog item. That catalog item will create the blueprint with the desired config, import the blueprint, deploy the blueprint, and then destroy the blueprint.

Reply
0 Kudos