12-29-2016 12:52 PM - edited 03-01-2019 05:07 AM
Hello,
I am attempting to find out how to create a new DVS with a VLAN pool, and VCenter credentials as a single transaction, or at least I would like the entire thing to either complete or fail. Here is what I have come up with
https://APIC-IP/api/node/mo/uni.json
body:
{
"polUni":{
"attributes":{
},
"children":[
{
"infraInfra":{
"attributes":{
"dn":"uni/infra",
"status":"created,modified"
},
"children":[
{
"fvnsVlanInstP":{
"attributes":{
"allocMode":"dynamic",
"descr":"",
"dn":"",
"name":"DVSWITCH_NAME-Dvs-VlanPool",
"ownerKey":"",
"ownerTag":"",
"status":"created"
},
"children":[
{
"fvnsEncapBlk":{
"attributes":{
"allocMode":"inherit",
"descr":"",
"dn":"",
"from":"vlan-2000",
"name":"",
"to":"vlan-2499",
"status":"created"
}
}
}
]
}
},
{
"cdpIfPol":{
"attributes":{
"dn":"uni/infra/cdpIfP-DVSWITCH_NAME-Dvs_cdpIfPol",
"name":"DVSWITCH_NAME-Dvs_cdpIfPol",
"status":"created,modified",
"adminSt":"enabled"
},
"children":[
]
}
}
]
}
},
{
"vmmProvP":{
"attributes":{
"dn":"uni/vmmp-VMware"
},
"children":[
{
"vmmDomP":{
"attributes":{
"dn":"uni/vmmp-VMware/dom-DVSWITCH_NAME-Dvs",
"name":"DVSWITCH_NAME-Dvs",
"rn":"dom-DVSWITCH_NAME-Dvs",
"status":"created"
},
"children":[
{
"vmmCtrlrP":{
"attributes":{
"dn":"uni/vmmp-VMware/dom-DVSWITCH_NAME-Dvs/ctrlr-DVSWITCH_NAME-Dvs-Vcenter",
"name":"DVSWITCH_NAME-Dvs-Vcenter",
"rootContName":"DATACENTER_NAME",
"hostOrIp":"VCENTER_IP_ADDR",
"rn":"ctrlr-DVSWITCH_NAME-Dvs-Vcenter",
"status":"created"
},
"children":[
{
"vmmRsAcc":{
"attributes":{
"tDn":"uni/vmmp-VMware/dom-DVSWITCH_NAME-Dvs/usracc-DVSWITCH_NAME-Dvs-Cred",
"status":"created"
},
"children":[
]
}
}
]
}
},
{
"infraRsVlanNs":{
"attributes":{
"tDn":"uni/infra/vlanns-[DVSWITCH_NAME-VlanPool]-dynamic",
"status":"created"
},
"children":[
]
}
},
{
"vmmUsrAccP":{
"attributes":{
"dn":"uni/vmmp-VMware/dom-DVSWITCH_NAME-Dvs/usracc-DVSWITCH_NAME-Dvs-Cred",
"name":"DVSWITCH_NAME-Dvs-Cred",
"usr":"VCENTER_USERNAME",
"pwd":"VCENTER_PASSWORD",
"rn":"usracc-DVSWITCH_NAME-Dvs-Cred",
"status":"created"
},
"children":[
]
}
},
{
"vmmVSwitchPolicyCont":{
"attributes":{
"dn":"uni/vmmp-VMware/dom-DVSWITCH_NAME-Dvs/vswitchpolcont",
"status":"created,modified"
},
"children":[
{
"vmmRsVswitchOverrideCdpIfPol":{
"attributes":{
"tDn":"uni/infra/cdpIfP-DVSWITCH_NAME-Dvs_cdpIfPol",
"status":"created,modified"
},
"children":[
]
}
}
]
}
}
]
}
}
]
}
}
]
}
}
The error that I end of getting is
"code": "400",
"text": "Failed to update multiple items in a single operation - request requires distributed transaction. Please modify request to process each item individually"
Any ideas? Thanks!
Solved! Go to Solution.
01-02-2017 11:56 PM
Hi
You cant't post to uni/infra and uni/vmmp-VMware at the same time, because both are toplevel-MOs. You have to do two REST-Posts:
First post the infraInfra-MO to https://{{IP}}/api/mo.json, then post the vmmProvP-MO to https://{{IP}}/api/mo.json.
Also notice, that you only need to provide the DN on your toplevel MOs (infraInfra and vmmProvP)
HTH
Marcel
01-02-2017 11:56 PM
Hi
You cant't post to uni/infra and uni/vmmp-VMware at the same time, because both are toplevel-MOs. You have to do two REST-Posts:
First post the infraInfra-MO to https://{{IP}}/api/mo.json, then post the vmmProvP-MO to https://{{IP}}/api/mo.json.
Also notice, that you only need to provide the DN on your toplevel MOs (infraInfra and vmmProvP)
HTH
Marcel
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide