New Disk with a SCSI adapter

Last week I spent some time working on using vRO to populate a new Disk with a SCSI adapter.

The request came in as any other typically does with a simple, hey is there any easy way to do this? I dug through what I thought would be a quick and simple set of workflows… Only to find out there isn’t a OOTB workflow to utilize and even worse if I try to add a disk to a new adapter the vRO workflow will fail because the SCSI adapter doesn’t exist. There also would be the vulnerability of losing the data, if not backed up with a standalone USB duplicator.

To me this was a bit perplexing considering the fact that when you walk through a vCenter add disk it prompts you which SCSI adapter and will create one if you choose one that doesn’t exist.

Needless to say this motivated me to jump in and automate it! There are a few other examples that Dan and Christophe have worked on out in the communities and forums, but when I wanted to automate them I found it to be a bit of challenge. So here we are the workflow and automated action to do this with vRA as a new action item.

This post will actually be broken down into 2 sections

  1. Deploy disk onto the next SCSI adapter using a resource action (i.e. day 2 operation)
  2. Deploy a disk onto the next SCSI adapter at provision time with a cool little slider for the consumer

Here’s the video walk through to match this post

and a link to the vRO package.

 

I’m assuming if you’re following along with my blog you have already downloaded the vRO package and imported it. In this first step we’ll look at the workflow that is “Create SCSI and Add Hard Disk”. As you can see it’s pretty simple four steps

  1. We pull in the selected VM properties and figure out what Datastore it’s on
  2. We create the reconfigure task to calculate what SCSI adapters exist and what the next possible one is
  3. We run the reconfigure task with the parameters from the scriptable task
  4. Add a hard disk to the VM

01-add-scsi-pt-1

 

Running the workflow will prompt you for the following settings.

02-add-scsi-pt-1

 

Watching the variables you will see the Datastore is found and passed for the selected VM object.

03-add-scsi-pt-1

 

If you review the logs of the running task you’ll see the SCSI controllers found and what the next one should be.

04-add-scsi-pt-1

Then check vCenter and you’ll see the task of reconfigure will have completed successfully.

05-add-scsi-pt-1

 

Here is an example of the VM that we just ran the workflow against. As you can see we deployed it using vRA and please notice the list of entitled actions.

06-add-scsi-pt-1

 

Now let’s go create the actual action item that will call the workflow we used earlier.

Go to Design -> Resource Actions -> New

07-add-scsi-pt-1

 

Expand the tree and select the Create SCSI and Add Hard Disk.

08-add-scsi-pt-1

 

The next step will just illustrate that you have a VM object in the workflow and it will automatically map to the VM in your vRA portal.

09-add-scsi-pt-1

 

Next we are presented with the Form Title and options. This is something that give you power to be selective about what you show and what conditions might need to be set in order for this to be displayed to the consumer. In this case we want it to hide the intro, and to be available for any VM object.

10-add-scsi-pt-1

 

Now we edit the form name. If you used the default it would give you Step as the form, instead I want to change to “Add a new disk and SCSI”.

11-add-scsi-pt-1

 

Then we’ll edit each of the options in the workflow. First the Disk size which we will set to a default value of 1 (if nothing is set it will fail).

12-add-scsi-pt-1

 

Then we  move to the Constraints tab, where we make sure

Required = Yes

Visible = Yes

Make sure to click apply after changing these settings!

13-add-scsi-pt-1

 

Moving on to Disk persistence mode and the Constraints tab

Required = Yes

Read only = Yes

Value = (your choice) I always use Persistent

Visible = No ( we want to hide this as the consumer won’t be able to change it from our settings)

Make sure to click apply after changing these settings!

14-add-scsi-pt-1

 

Moving on to Use thin provisioning and the Constraints tab

 

Visible = Yes

Make sure to click apply after changing these settings!

15-add-scsi-pt-1

 

Finally we’ll set the Adapter type and the Constraints tab

Required = Yes

Read only = Yes

Value = (your choice) I always use PARA but you can choose LSI, SAS, or BUS

Visible = No ( we want to hide this as the consumer won’t be able to change it from our settings)

Make sure to click apply after changing these settings!

16-add-scsi-pt-1

 

Then click to finish which will bring you back out to the Resource Actions page. Here you select and Publish, don’t forget this part!!

17-add-scsi-pt-1

 

Now let’s entitle the action to our consumers.

Go to Administration -> Entitlements -> Choose your entitlement (mine is Cloud Admins)

18-add-scsi-pt-1

 

Go to the Items & Approvals tab

Search for “create” in the Entitled actions and select the newly published offering.

19-add-scsi-pt-1

 

Now we go back to our provisioned item and look at the action list and you’ll see the option for our Add disk and SCSI.

21-add-scsi-pt-1

 

If you execute it you’ll see the following form and it will run the vRO workflow. 22-add-scsi-pt-1

 

And just to illustrate the request has been submitted, go to your Requests tab.

23-add-scsi-pt-1

 

You can jump back into Orchestrator and view the running workflow.

24-add-scsi-pt-1

 

Or just check vCenter as the reconfigure task gets executed.

25-add-scsi-pt-1

 

After completing this you should now be able to:

  1. A vRO workflow that will enable to you provision a new hard disk to an existing virtual machine
  2. A action that enables the users to request this through vRA to an existing provisioned virtual machine

 

Some of the power not illustrated here is that you can choose to entitle per specific conditions or even require an approval policy so people don’t abuse this action. Next time we will build out the method to use do this same thing at provision time instead of as a day two action! Stay tuned!!!

 

11 comments

1 ping

Skip to comment form

    • Ferdinando Simonetti on September 26, 2016 at 3:58 am
    • Reply

    Good morning from Italy.
    I’m trying to import the package into our 7.0.1 Orchestrator, but the operation seems to partially fail (for components that should reside under com.vmware.library.vc… ) showing this https://snag.gy/xqmtYZ.jpg
    I’m sorry for my lack of proper terminology, but I’m just starting my journey in Automation/Orchestrator.
    Best regards and thanks in advance

    1. Let me test in my 7.0.1 instance and see if I can resolve for you! Stay tuned

  1. Hi Gary,

    Great post. I was wondering if was a way to add a hard disk to an existing virtual machine and select a storage reservation policy when doing the request. We don’t store our secondary disk with the OS disk in our platform, and also some datastores are replicated and other aren’t, there is a storage reservation policy applied to each option.

    I’d like a user to be able to request a new VM and select the required policy. Just struggling to figure out how to expose the available policies.

    Any help greatly appreciated. Big fan of your site.

    Regards

    Dean

    1. Dean,

      You may want to check in 7.2, I haven’t had any chance to look at it but as of 7.1 and before there’s no real way to access the storage reservation policy because of it not being an exposed API. I think you might be able to do it in the same manner I did the custom request https://extendingclouds.com/vrealize-automation-7-custom-request-form-using-xaas/ basically altering the request but checking and altering the json string but it’s not a great method to accomplish what you’re looking for.

      1. Gary as always thanks for the reply, I appreciate you going out of your way to help us out. We did manage to get this working, but its definitely an inefficient way to do it.

        Have a great day.

    • parag bhardwaj on August 7, 2017 at 2:02 pm
    • Reply

    Hi Team,

    Getting below error on action. any clue.

    Failed to convert external resource VM Name. Script action com.vmware.vcac.asd.mappings/mapToVCVM failed.

    Thanks
    Parag

    1. What versions of VRA and VCenter are you running? The error is basically saying that it can’t map the vCAC VM to a vCenter VM object.

    • jeet on August 9, 2018 at 7:31 am
    • Reply

    Hi How to give drive letter and Disk Lable

    1. I never figured out how to over ride the drive label

    • jeet on August 9, 2018 at 10:02 am
    • Reply

    After deploying this solution we faced one issuetthat if we are adding more than 3 disk its give error “NO CONTROLLER FOUND”

    kindly edit the workflow to add a disk in same scsi controller if that is exceed then only it should go for other controller

    1. Sorry I don’t have access to the software any longer to update these samples. You should be able to do a scsi lookup tho and automatically select a new one for more disks.

  1. […] « New Disk with a SCSI adapter […]

Leave a Reply

Your email address will not be published.