Browse Community
Help
Log In
Responses(1)
Solutions(1)
BamseSE
3 Posts
0
June 10th, 2015 08:00
For future references if anyone else ever is going to need the same solution, here is a solution provided by Dell support.
Running this in the script console will create a dynamic service from a vApp defined in the script.
vAppName = 'Insert Your vApp name here'; //vApp Name
serviceName = "VCD_vApp_"+vAppName; //This is the creating service name
toMerge = [];
ts = server.get("TopologyService");
// Create Category
categoryType = ts.getType("FSMCategory"); vCat = ts.getObjectShell(categoryType); vCat.setName("Cloud"); toMerge << vCat;
// Create Service
serviceType = ts.getType("FSMService"); vServ = ts.getObjectShell(serviceType); vServ.setName(serviceName); def domainsProperty = vServ.getType().getProperty("domainAssociationIDs");
vServ.markOverridingProperty(domainsProperty);
def domainsList = vServ.get("domainAssociationIDs") as Set; domainsList << "vcloud"; vServ.setList("domainAssociationIDs", domainsList.toList());
// Add service to category
catDefintion = categoryType.getProperty("definition");
vCat.getList(catDefintion).add(vServ);
toMerge << vServ;
dmcType = ts.getType("FSMDynamicManagedComponent");
// Add all VMs
vmDMC = ts.getObjectShell(dmcType);
vmDMC.setName("VMs");
vmDMC.set("container",vServ);
vmDMC.set("componentQuery","(VMVCloudVApp where name ='"+vAppName+"').virtualMachines");
//Here to retrieve all virtualMachines of the specified vApp toMerge << vmDMC;
vServ.set("definition",[vmDMC]);
ts.mergeData(toMerge);
return;
Dell Support Resources
View All
Top
BamseSE
3 Posts
0
June 10th, 2015 08:00
For future references if anyone else ever is going to need the same solution, here is a solution provided by Dell support.
Running this in the script console will create a dynamic service from a vApp defined in the script.
vAppName = 'Insert Your vApp name here'; //vApp Name
serviceName = "VCD_vApp_"+vAppName; //This is the creating service name
toMerge = [];
ts = server.get("TopologyService");
// Create Category
categoryType = ts.getType("FSMCategory"); vCat = ts.getObjectShell(categoryType); vCat.setName("Cloud"); toMerge << vCat;
// Create Service
serviceType = ts.getType("FSMService"); vServ = ts.getObjectShell(serviceType); vServ.setName(serviceName); def domainsProperty = vServ.getType().getProperty("domainAssociationIDs");
vServ.markOverridingProperty(domainsProperty);
def domainsList = vServ.get("domainAssociationIDs") as Set; domainsList << "vcloud"; vServ.setList("domainAssociationIDs", domainsList.toList());
// Add service to category
catDefintion = categoryType.getProperty("definition");
vCat.getList(catDefintion).add(vServ);
toMerge << vServ;
dmcType = ts.getType("FSMDynamicManagedComponent");
// Add all VMs
vmDMC = ts.getObjectShell(dmcType);
vmDMC.setName("VMs");
vmDMC.set("container",vServ);
vmDMC.set("componentQuery","(VMVCloudVApp where name ='"+vAppName+"').virtualMachines");
//Here to retrieve all virtualMachines of the specified vApp toMerge << vmDMC;
vServ.set("definition",[vmDMC]);
ts.mergeData(toMerge);
return;