-
Notifications
You must be signed in to change notification settings - Fork 605
accessgroup and ressource pool problem on linked clone .json methos
Hello, For begining, thanks to all people who have contributed to the creation of this module.
I write this message to explain two problems I've had to create linked clone with .json method and the solution I found to resolve them.
error message : Command : New-HVPool -Spec "C:\temp\ScriptsVMwareHV\TestpoolLinkedClone.json"
New-HVPool : Failed to create Pool with error: No hostOrCluster found with Name: [Form_Reference] Au caractère Ligne:1 : 1
- New-HVPool -Spec "C:\temp\ScriptsVMwareHV\TestpoolManFS6.json"
-
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-HVPool
[Form_Reference] is the name of my resource pool that I put in the .json file : Extract of .jsoon for ressource pool definition : ...
"VirtualCenterProvisioningData": {
"datacenter": "/Name_Of_Datacenter",
"parentVm": "Name_Of_VM",
"hostOrCluster": "/Name_Of_Datacenter/host/Name_Of_Cluster",
"resourcePool": "Form_Reference",
"snapshot": "reference",
"vmFolder": "/Name_Of_Datacenter/vm/Name_Of_Folder",
"template": null
},
...
The code which concerns thi part is (between line 4826-4836) in VMware.HV.Helper.psm1 : 4826: if ($resourcePool) {
4827: $resourcePool_helper = New-Object VMware.Hv.ResourcePoolService
4828: $resourcePoolList = $resourcePool_helper.ResourcePool_GetResourcePoolTree($services,$vmobject.HostOrCluster)
4829: $resourcePoolObj =
4830: if ($null -eq $resourcePoolObj) {
4831: throw "No hostOrCluster found with Name: [$resourcePool]"
4832: }
4833: $vmObject.ResourcePool = $resourcePoolObj.id
4834: }
4835: return $vmObject
4836: }
The variable $resourcePool takes the value of "resourcePool": in the .json file (in my case : "Form_Reference").
$resourcePoolList takes the value of ressource pool of the cluster : path = "/Name_Of_Datacenter/host/Name_Of_Cluster/Resources" and name = "Name_Of_Cluster"
But my ressource pool is located in the path "/Name_Of_Datacenter/host/Name_Of_Cluster/Resources", it is a children.
The path of my ressource pool is : "/Name_Of_Datacenter/host/Name_Of_Cluster/Resources/Form_Reference" and name "Form_Reference".
so, the line :
$resourcePoolObj =
can't be true and $resourcePoolObj never have the good value.
Solution : to resolve this probleme I Replace this line by :
$resourcePoolObj =
Error message : Exception lors de l'appel de « Desktop_Create » avec « 2 » argument(s) : « ExceptionType : VMware.Hv.MethodFault ErrorMessage : Missing value for non-optional field accessGroup » Au caractère C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:4730 : 7
-
$id = $desktop_helper.Desktop_create($services,$desktopSpecObj)
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [], MethodInvocationException
- FullyQualifiedErrorId : VimException
in my .json i give a value to accessgroup (this accessgroup is present on view administrator aod user used to create pool is present in this accessgroup) : ...
"Base": {
"AccessGroup": "Windows 7",
"description": "Test linked clone VMFS6",
"name": "TestpoolManFS6-3",
"displayName": "Test pool Script VMFS6"
},
...
The code which concerns thi part is (between line 4624-4630) in VMware.HV.Helper.psm1 :
4624: if (!$desktopBase) {
4625: $accessGroup_client = New-Object VMware.Hv.AccessGroupService
4626: $ag = $accessGroup_client.AccessGroup_List($services) | Where-Object { $_.base.name -eq $accessGroup }
4627: $desktopSpecObj.base.AccessGroup = $ag.id 4628: } else {
4629: $desktopSpecObj.base = $desktopBase
4630: }
The variable $accessGroup takes the value of "accessGroup": in the .json file (in my case : "Windows 7"). in this case, the value of $accessGroup_client.AccessGroup_List($services) is equal to 'Root' and the condition Where-Object { $_.base.name -eq $accessGroup } will never exist.
Solution : for this parameter work, I must change the line 4626 like this : $ag = $accessGroup_client.AccessGroup_List($services).Children| Where-Object { $_.base.name -eq $accessGroup }
Thanks, I hope this will be usefull.
Eric Lavarec System Engineer - Ministry of Education (France)