VMware Cloud Community
chrisheartland
Enthusiast
Enthusiast
Jump to solution

2nd drive not being formatted/partitioned in vCAC 6 - what might that mean?

When building both windows 2008 R2 and 2012 R2 servers, the 2nd drive is added but not partitioned even if I submit it with a drive letter and label. I have the vcac guest agent installed on both templates.

One strange thing is that I was getting a pop up from Windows about the vcac guest agent. To get this to stop I went to the service, Log On , and unchecked "allow service to interact with desktop." The message went away but I'm still not sure what the underlying issue was if anything.

Thanks in advance.

1 Solution

Accepted Solutions
chrisheartland
Enthusiast
Enthusiast
Jump to solution

I received a workflow on how to do this from a friend. I will try and post a blog about it soon.

View solution in original post

Reply
0 Kudos
9 Replies
zebduin
Enthusiast
Enthusiast
Jump to solution

via a clone workflow - additional drives added will not be initialized/formatted/given a drive letter.  maybe someone here can tell you if those custom properties will be recognized if you use the Windows guest agent.

I generally use vCO to run guest os scripts to perform these tasks

Reply
0 Kudos
chrisheartland
Enthusiast
Enthusiast
Jump to solution

I've read online that the agent is supposed to allow for this to happen just with vCAC.

Reply
0 Kudos
chrisheartland
Enthusiast
Enthusiast
Jump to solution

In case I can't get it to work (as it seems to be a real pain in the butt), do you have a working example of how to add, initialize, and format a hard disk when added via vCAC? One issue I see is that if you add multiple HD's with vCAC they will be added just not formatted. Do you then just use vCO to do the formatting?

Reply
0 Kudos
chrisheartland
Enthusiast
Enthusiast
Jump to solution

I received a workflow on how to do this from a friend. I will try and post a blog about it soon.

Reply
0 Kudos
awjudge
Hot Shot
Hot Shot
Jump to solution

The vCAC Guest Agent can do the formatting for you.


For Windows, it will format and add the drive letter, for Linux it will format and mount the filesystem. The only thing I've found that it can't do (yet) is anything like LVM.

Reply
0 Kudos
chrisheartland
Enthusiast
Enthusiast
Jump to solution

I could never get the guest agent to work either because I installed it wrong or whatever. Apparently, there are known issues with installing the agent and it can be tricky to get working properly. I have a workflow to format the drives so all is good now.

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

Hey Chris,

Could you please help us with the workflow?

Reply
0 Kudos
chrisheartland
Enthusiast
Enthusiast
Jump to solution

Are you asking for the formatted drive workflow? Yes I can give it to you. I have a long lunch meeting today so I'll try and get it before EOB or it may be tomorrow.

Reply
0 Kudos
chrisheartland
Enthusiast
Enthusiast
Jump to solution

OK, let's see if I can piece this together for you.

At the beginning of your Provisioning stub workflow (after build), add this to an existing or new scriptable task (there are 6 iterations here. You can either write a better loop or add additional ones per each additional disk wanted). Create an Out attribute called "diskLayout" (string) and one called "diskBoolean" (boolean). Your "in- paramters" need to be: vcacHost,  vCAC:entity, vCAC:VirtualMachine, VC:VirtualMachine, vCACVmPeroperties (Properties).

var index = 1;

if (vCACVmProperties.get("VirtualMachine.Disk1.Size") != null)

{

  diskLayout = index + "_LETTER=" + vCACVmProperties.get("VirtualMachine.Disk1.Letter");

  diskLayout += ";" + index + "_SIZE=" + vCACVmProperties.get("VirtualMachine.Disk1.Size");

  if (vCACVmProperties.get("VirtualMachine.Disk1.Label") != null){

  diskLayout += ";" + index + "_LABEL=" + vCACVmProperties.get("VirtualMachine.Disk1.Label");

  }

  index += 1;

}

if (vCACVmProperties.get("VirtualMachine.Disk2.Size") != null)

{

  diskLayout += ";" + index + "_LETTER=" + vCACVmProperties.get("VirtualMachine.Disk2.Letter");

  diskLayout += ";" + index + "_SIZE=" + vCACVmProperties.get("VirtualMachine.Disk2.Size");

  if (vCACVmProperties.get("VirtualMachine.Disk2.Label") != null){

  diskLayout += ";" + index + "_LABEL=" + vCACVmProperties.get("VirtualMachine.Disk2.Label");

  }

  index += 1;

}

if (vCACVmProperties.get("VirtualMachine.Disk3.Size") != null)

{

  diskLayout += ";" + index + "_LETTER=" + vCACVmProperties.get("VirtualMachine.Disk3.Letter");

  diskLayout += ";" + index + "_SIZE=" + vCACVmProperties.get("VirtualMachine.Disk3.Size");

  if (vCACVmProperties.get("VirtualMachine.Disk3.Label") != null){

  diskLayout += ";" + index + "_LABEL=" + vCACVmProperties.get("VirtualMachine.Disk3.Label");

  }

  index += 1;

}

if (vCACVmProperties.get("VirtualMachine.Disk4.Size" != null))

{

  diskLayout += ";" + index + "_LETTER=" + vCACVmProperties.get("VirtualMachine.Disk4.Letter");

  diskLayout += ";" + index + "_SIZE=" + vCACVmProperties.get("VirtualMachine.Disk4.Size");

  if (vCACVmProperties.get("VirtualMachine.Disk4.Label") != null){

  diskLayout += ";" + index + "_LABEL=" + vCACVmProperties.get("VirtualMachine.Disk4.Label");

  }

  index += 1;

}

if (vCACVmProperties.get("VirtualMachine.Disk5.Size") != null)

{

  diskLayout += ";" + index + "_LETTER=" + vCACVmProperties.get("VirtualMachine.Disk5.Letter");

  diskLayout += ";" + index + "_SIZE=" + vCACVmProperties.get("VirtualMachine.Disk5.Size");

  if (vCACVmProperties.get("VirtualMachine.Disk5.Label") != null){

  diskLayout += ";" + index + "_LABEL=" + vCACVmProperties.get("VirtualMachine.Disk5.Label");

  }

  index += 1;

}

if (vCACVmProperties.get("VirtualMachine.Disk6.Size") != null)

{

  diskLayout += ";" + index + "_LETTER=" + vCACVmProperties.get("VirtualMachine.Disk6.Letter");

  diskLayout += ";" + index + "_SIZE=" + vCACVmProperties.get("VirtualMachine.Disk6.Size");

  if (vCACVmProperties.get("VirtualMachine.Disk6.Label") != null){

  diskLayout += ";" + index + "_LABEL=" + vCACVmProperties.get("VirtualMachine.Disk6.Label");

  }

  index += 1;

}

At some point, add a scriptable decision tree, and set vCACVmProperties as an in-parameter and diskLayout as an attribute. Your script should be:

if (diskLayout == null)

  {

  return false;

  }

else

  {

  return true;

  }

If true, send to a new scriptable task. Set your In's as in-parameter vcVirtualmachine (VC:VirtualMachine) and diskLayout (attribute / string). Set all Out's as attributes and the follwing: index (array/number), Letter (Array/string), Size (number), Label (Array/string), errorCode (string). The script is:

function bailOut(error) {

  error = error;

  System.error(error);

  throw(error);

}

var pairs = diskLayout.split(";");

if (pairs.length < 2)

  bailOut("Invalid number of parameters in disk layout: " + diskLayout);

pairs = pairs.sort();

Size = [];

Letter = [];

Label = [];

index = [];

var j = 0;

var lastIdx = -1;

for (var i=0; i < pairs.length; i++) {

  var tmp = pairs[i].split("=");

  if (tmp.length < 2)

  bailOut("Invalid key/value pair in disk layout: " + pairs[i]);

  var key = tmp[0];

  var val = tmp[1];

  tmp = tmp[0].split("_");

  if (tmp.length != 2)

  bailOut("Invalid drive key in disk layout: " + key);

  var idx = Number(tmp[0]);

  var key = tmp[1];

  if (lastIdx == -1) {

  lastIdx = idx;

  Label[j] = "New Volume";

  } else {

  if (idx != lastIdx) {

  lastIdx = idx;

  j++;

  Label[j] = "New Volume";

  }

  }

  switch(key.toLowerCase()) {

  case "size":

  Size[j] = Number(val);

  break;

  case "letter":

  Letter[j] = val;

  break;

  case "label":

  Label[j] = val;

  break;

  }

  index[j] = idx;

}

System.debug(errorCode)

From that scriptable task, drag and drop on top of it a "foreach loop" workflow. The foreach loop should map to the workflow called "GO Windows Partition and Format Disk." Inside this is another custom workflow called "Go invoke PS script". Inside this is a custom script "Run Process in Guest".

I've attached all three workflows. Hopefully this will make some sense and you'll be able to figure out the layout and linkages and what not. Let me know if you have any questions or if something is not working.