VMware Cloud Community
getvrohelp
Enthusiast
Enthusiast

Assembler 8.16.0.33697 Multiple Disks Strange Behavior and help ordering disks

I have tried to use the existing Provisioning Additional Disks with vRA* with Ordered MountPoints-or-Drive-Letters workflow. I updated it to work as there were many things that needed updated / correct for my environment. I can get the order from that as far as the drive letter but I have two issues that I'll do my best to explain. 1 is that I am using a vm template, nothing unusual about it and it's quite simple. When vRA provisions the machines one of my additional disks which are dynamic in size and count gets assigned as disk 0 and becomes the boot disk. vRA then says it's not attached or missing. This doesn't happen every time but most of the time. So I have 3 total disks in this test case. 1 is the disk on the template of 90 gigs, then a 2 gig and 3 gig disk. In the screenshot you can see what happens and that vRA says the 2 or sometimes 3 gig disk becomes the boot disk and the original 90 GB disk becomes another disk. It also shows as missing in the deployment. The second issue is the order. We all know it's been a wip and 8.4 allows you to assign a scsi id and lun. Perhaps I just need some help making that aspect dynamic? I am not able to get the disk label and number to align so that I can assign and format the disks within windows using the powershell script that comes with the Provisioning-Additional-Disks-with-vRA8-with-Ordered-MountPoints-or-Drive-Letters workflow. Any help or guidance would truly be appreciated. In the end what I need to do is allow a dynamic number of disks, sizes, and labels for those disks and then format them in Windows the same way. This is for SQL servers in case you were wondering.

 

 

inputs:
  disks:
    type: array
    minItems: 0
    maxItems: 4
    title: Additional Disks
    description: Add addtional disks
    items:
      type: object
      properties:
        label:
          type: string
          title: Disk Label
        size:
          type: integer
          title: Size (GB)
          minSize: 1
          maxSize: 2000
        mountpoint:
          type: string
          title: Drive Letter
resources:
  Cloud_Machine_1:
      storage:
      #attachedDisks: ${map_to_object(slice(resource.Cloud_vSphere_Disks[*].id, (length(input.disks))*count.index, (length(input.disks))*(count.index + 1)), "source")}
  Cloud_vSphere_Disks:
    type: Cloud.Volume
    allocatePerInstance: true
    properties:
      capacityGb: ${input.disks[count.index%(length(input.disks))].size}
      count: ${(length(input.disks))}

 

Reply
0 Kudos
7 Replies
hcfede
Enthusiast
Enthusiast

On Windows vm i add other disks like this:


Disks:
    type: array
    title: Additional Disks
    description: Additional data disks.
    maxItems: 10
    minItems: 0
    items:
      type: object
      properties:
        id:
          type: string
          title: Disk Identifier
        size:
          type: integer
          title: Size (GB)
          minimum: 1
          maximum: 1024
      default:
        id: Disk1
        Size: 8
resources:
  Disks:
    type: Cloud.vSphere.Disk
    allocatePerInstance: true
    properties:
      id: ${input.Disks[count.index].id}
      capacityGb: ${input.Disks[count.index].size}
      provisioningType: thin
      count: ${length(input.Disks)}
  Cloud_vSphere_Machine_1:
    type: Cloud.vSphere.Machine
    properties:
		--
		--
		--
		--
      attachedDisks: ${map_to_object(resource.Disks[*].id, "source")}
                --
                --

 When i add other disks to my vm during the deployment are correctly mapped in the spcified order and the boot disk is the correct one from vm template

hcfede_0-1709060562665.png

hcfede_1-1709060572176.png

 

Hope this help you with your blueprint

 




_______________________________
I appreciate your feedback on my answer!
If it has solved your issue, please mark it as RESOLVED!

Check my blog for more contents!
https://www.immiblogghenicloud.cloud
Reply
0 Kudos
kjellcomputer
Enthusiast
Enthusiast

Hi, I have a solution for Windows where you in Design can attach your disks on specific SCSI controllers with drive letters and labels and then the Orchestrator workflow will check your deployment inputs and compare the disks in Automation with the VM's disks in vSphere so that everything is correct when assigning this in Windows with Powershell.

At the moment I'm using the REST API to get data from Assembler with the REST plugin, so it might not be that flexible to just import the package and get going, but you can have a look and perhaps it might be understandable.

https://github.com/KjellComputer/vra

kjellcomputer_0-1709062836329.png

kjellcomputer_1-1709062843373.png

 

Reply
0 Kudos
getvrohelp
Enthusiast
Enthusiast

Thank you I will have a look at this. perhaps I am mapping incorrectly.

Tags (1)
Reply
0 Kudos
getvrohelp
Enthusiast
Enthusiast

I will take a look and see. I appreciate it. I am making a call now to vRA IAAS api so I may be halfway there :). I appreciate the help from you both.

Reply
0 Kudos
getvrohelp
Enthusiast
Enthusiast

These are not working for me. The first one has a default disk which messes with my inputs. I don't need a default as there is a check-box that is for SQL server and when they check it, then the drive selections show on the custom form. If it is not checked, it is just a plain windows machine. The second option is for different scsi controllers which is not something I want. I need them to be on the same controller. What might help me is if I can get the index number. I can see in the customProperties that countIndex which is the index number of the disk but for the life of me I can not get that value. I am trying to name the disk hostname_disk1 where 1 is the indexCount. If I can do that I may be able to manipulate the lun number and provide that in the cloud template. I am just shooting from the hip here as I still don't have a great solution. The screenshot show the countIndex on the disk customProperties. If I could get that I would at least be able to name the disk how I need to and then keep working on disk order. I don't know whey I can't have the disks dependOn the machine but it creates a cyclical dependency when I try and have the extra disks depend on the machine being created first. It seems the disk and network allocation have to be successful before the machine?

 

disk countIndex.png

Reply
0 Kudos
kjellcomputer
Enthusiast
Enthusiast


@getvrohelp wrote:

The second option is for different scsi controllers which is not something I want. I need them to be on the same controller.


That's not how it works, it's an option and not an requirement. If you don't choose a different SCSI controller, you will get them all on the same SCSI controller. The example is meant to show the flexibility and to be truly dynamic and able to format the correct drive at deployments regardless of SCSI controller and order.

You can also just omit the SCSI code from the yaml code if that is your preference. As a side note, as a best practice you also should consider putting the different drives of your SQL servers on different SCSI Controllers for queuing and performance.

Remember that you can use the yaml-code examples and tweak and alter them to your preference.

Reply
0 Kudos
getvrohelp
Enthusiast
Enthusiast

I appreciate that. I am aware of modifying the code for sure but I like to take what is given, give it a run, see how it works then deconstruct. I will work on it and see what i can come up with but I am so frustrated that I can't get the index count no matter what I try. Here is an action that pulls some data from the deployment that could be useful to others in the future so just adding it here. I am hoping to use this once I get things all sorted. There are a couple of actions I use to get info but I think that can be worked out by most just by the name.

 

 

 

 

/*
    Assumes the additional provisioned disks have the following properties set: name, label, mountPoint
*/
var actionName = 'getDeploymentDiskMappings';
System.debug("                                Executing action: " + actionName);
 
// 2 string inputs
//deploymentId
//hostname

// Get VM Instance
var vm = System.getModule("com.compnay.vmware.vc").getVirtualCenterVmByName(hostname);
if(vm !== 'Not-Found'){
    // Get Disks Filenames Assigned to VM in vSphere
    var diskOrder = vm.config.hardware.device.filter(function(device) {
        return device.deviceInfo.label.indexOf('Hard disk') !== -1;
    }).map(function(device) {
        const backing = device.backing;
        const match = backing.fileName.match(/.+\/(.+)\.vmdk/);
        return match ? match[1] : null;
    });
}
System.debug("   diskOrder:\n" + JSON.stringify(diskOrder, null, 2));
 
System.log("Determine vRA Disk Mapping:")
System.log("    Deployment Id [" + deploymentId + "]");
System.log("    Machine Name [" + hostname + "]");
 
// Get vRA Deployment Resources
var deploymentResources = JSON.parse(System.getModule("com.compnay.vra.deployment").getDeploymentResourcesById(deploymentId));

// Get Attached Disk Resources
var computeResource = deploymentResources.content.filter(function(resource) {
    System.warn("resource.properties.resourceName is " + resource.properties.resourceName)
    System.warn("resource.type " + resource.type)
    return (
        //resource.type === 'Cloud.vSphere.Machine' &&
        resource.type === 'Cloud.Machine' &&
        resource.properties.resourceName === hostname
    );
});
System.log("        Found [" + computeResource.length + "] Compute Resource(s)");
 
// Get attached disk source references
var attachedDisks = (computeResource.length && computeResource[0].properties.attachedDisks
    ? computeResource[0].properties.attachedDisks.map(function(disk) { return disk.source })
    : []);
System.log("        Found [" + attachedDisks.length + "] Attached Disk(s)");
System.debug("      attachedDisks:\n" + JSON.stringify(attachedDisks, null, 2));
 
/**
* Perform disk properties mapping based on machine attachment
* and attachment order. This operation is performed only for Windows-based machines
*/
 
System.log("Mapping Disk Resource(s)")
// Deployment Content
var diskMapping = deploymentResources.content
 
// Get attached disks
.filter(function(resource) {
    return (resource.type === 'Cloud.vSphere.Disk' || resource.type === 'Cloud.Volume') && attachedDisks.indexOf(resource.properties.id) !== -1;
})
 
// Sort the disks by order of attachment to get the correct letter, label and mountpoint assignment
.sort(function (a, b) {
    return diskOrder.indexOf(a.properties.resourceName) < diskOrder.indexOf(b.properties.resourceName) ? -1 : 1;
})
 
// Create an array of disk properties
.map(function (disk) {
    return {
        capacityGb: disk.properties.capacityGb,
        resourceId: disk.properties.resourceId,
        diskId: disk.id,
        diskName: disk.name,
        label: disk.properties.label,
        //label: disk.properties.additionalDisks.label,
        mountPoint: disk.properties.mountPoint
    };
});
 
System.log("    Disk mapping:\n" + JSON.stringify(diskMapping, null, 2));
return diskMapping;

 

 

 

getvrohelp_0-1709140143644.png

 

 

Reply
0 Kudos