cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
AMA event- Migrating Existing Networks to Cisco ACI
992
Views
11
Helpful
13
Replies
Beginner

Creating VM or Linked VM request UCS cloud director from command line.

Dear All,

I am new to Cisco cloud director, I have been using vSphere SDK perl script to create/destroy VM, I would like to know if i need to do the same with UCS cloud director, Can someone point me a sample REST API based script, if the script is in Perl or Python it would be great help.

Also, Can i use my existing vSphere SDK based Perl script to request VM creation to Cisco UCS cloud director? if yes then how to do the same, any perquisite.

Regards,

Nilesh

1 ACCEPTED SOLUTION

Accepted Solutions
Enthusiast

Re: Creating VM or Linked VM request UCS cloud director from command line.

UCSD provides JSON/XML based REST API and as such can be invoked from any client including Java/Perl/Python. Currently UCSD provides Java SDK only.

However, Perl, Python and other clients shall use JSON/XML directly to talk to UCSD.

Sample will like something like this:

/app/api/rest?formatType=json&opName=userAPIProvisionRequest&opData=}

Regards,

Rekha

View solution in original post

13 REPLIES 13
Enthusiast

Re: Creating VM or Linked VM request UCS cloud director from command line.

UCSD provides JSON/XML based REST API and as such can be invoked from any client including Java/Perl/Python. Currently UCSD provides Java SDK only.

However, Perl, Python and other clients shall use JSON/XML directly to talk to UCSD.

Sample will like something like this:

/app/api/rest?formatType=json&opName=userAPIProvisionRequest&opData=}

Regards,

Rekha

View solution in original post

Beginner

Re: Creating VM or Linked VM request UCS cloud director from command line.

Thank you Rekha for your comments.

I guess opData would be the userAPIProvisionRequest option data, please correct me if i am wrong. So can we create json object and pass to this opData as request for VM creation. Could you please provide the sample if its possible.

I am new and learning to write web app for the same.

Regards,

Nilesh

Beginner

Re: Creating VM or Linked VM request UCS cloud director from command line.

Hi Rekha,

I have read the SDK document, I came across two APIs

userAPISubmitServiceRequest : This API is used to provision a VM

APIProvisionParams: This Json object API, the parameter provided with this api serves my purpose such no of vCPU and Ram etc, This argument i cannot see in the userAPISubmitServiceRequest api.

Can I use APIProvisionParams with userAPISubmitServiceRequest or i am missing something.

How to use both api to get all the parameter options.

Thanks in advance.

Waiting for your help.

Regards,

Nilesh

Enthusiast

Re: Creating VM or Linked VM request UCS cloud director from command line.

We can use userAPISubmitServiceRequestCustom instead of userAPISubmitServiceRequest to provision a vm

Note : vmName is used for suffix of VM Name

Regards,

Rekha Krishna

Beginner

Re: Creating VM or Linked VM request UCS cloud director from command line.

Hi Rekha,

Now i feel confident of what i am doing. I am having few questions based on your response.

1. The api userAPISubmitServiceRequestCustom does not mentioned in the document, am i using right version of document.

Does this option available to me also, how do i verify such option on server side. Should i need to ask my IT team to enable any setting which will allow me to look into all these api's and meta report example.

2. Something strange while passing opData, from the from the first instance while referring to document, I felt opData would be something like opData={vmName:'MC1',.......}, but after multiple tries i found that its is like opData={param0:'MC1'........} I guess opdata is the parameter list provided by the userAPI or I am missing something.

3. Data we pass in url can be easily read by the end user, did we thought about security aspect of it. I don't know if you are the right person to ask.

Regards,

Nilesh

Beginner

Re: Creating VM or Linked VM request UCS cloud director from command line.

Hi Rekha,

Like other option parameter for creating a VM, I need to deleteVM, I could not find this action associated with userAPIExecuteVMAction or i am missing something. Any other custom API for this action request.

Thanks a ton.

Regards,

Nilesh

Enthusiast

Re: Creating VM or Linked VM request UCS cloud director from command line.

Currently we have the one api userAPIExecuteVMAction to perform the VM Actions you have to pass the below mentioned parameters for the API  userAPIExecuteVMAction (vmId, actionName, comments);

for eg.,  /app/api/rest?formatType=json&opName=userAPIExecuteVMAction&opData=

Possible actionName to be passed in the 2nd parameter

·        vmStackView

·        accessVMCredentials

·        launchVMClient

·        assignVMToGroup

·        configureLeaseTime

·        reconfigureVM

·        powerOn

·        powerOff

·        deleteVM

·        suspend

·        shutdownGuest

·        standby

·        reset

·        reboot

·        createVMwareSnapshot

·        revertVMwareSnapshot

·        markVMwareSnapshot

·        deleteVMwareSnapshot

·        deleteAllVMwareSnapshot

·        resizeDisk

·        vmwareVMInventory

·        createVMDisk

·        deleteVMDisk

·        addVmvNic

·        deleteVmvNic

·        configureVmVNC

·        testVmVNCConnection

·        privateCloudVMClone

·        resynchVM

·        moveVMToVd

Regards,

Rekha Krishna

Beginner

Re: Creating VM or Linked VM request UCS cloud director from command line.

Hi Rekha,

I was able to create VM and your input was very helpful.

But I found some interesting issue. I logged in as end user profile. say "test" user, but the VM is getting created with the name admin-sr23, ideally it should create something like test-sr23. I have seen this issue when i triggered the VM creation from command line utility which call rest api ( userAPISubmitServiceRequestCustom ). but when i create VM using login into cloud director web console I see VM gets created with name test-sr23.

Can you please help us know/understand what could be the reason, why creation of VM through REST API overwrites the "test" name with "admin".

Appreciate your quick response.

Regards,

Nilesh

Beginner

Re: Creating VM or Linked VM request UCS cloud director from command line.

Hi Rekha,

I am still waiting response for above query, I would really appreciate your response. In continuation to above query I wanted to let you know that why Initiating user name is coming as admin when i trigger VM creation using REST API  userAPISubmitServiceRequestCustom and if i trigger the vm creation from UI it should my actual user name as Initiating user.

Regards,

Nilesh

Highlighted
Enthusiast

Re: Creating VM or Linked VM request UCS cloud director from command line.

The API (userAPISubmitServiceRequestCustom) internally will call the System Policy to create the VM. While creating the system policy they may mention vm prefix as $ or $. It will create in the naming format.

Regards,

Rekha Krishna

Beginner

Re: Creating VM or Linked VM request UCS cloud director from command line.

Hi Rekha,

I am trying to use below queries

/app/api/rest?formatType=json&opName=userAPISubmitWorkflowServiceRequest&opData={param0:"WorkFlow-01","param1":{"details":[{"name":"input_2_Select_OS286","value":"Win-64Bit"},{"name":"input_3_Select_Product117","value":"Syma"},{"name":"input_4_Select_Purpose7","value":"method01"}]},"param2":1000}

The above query works fine which returns me service request id say 32, But when i looked into service request panel i do not see this request present and hence i could not see machines details.

I would like to know what is missing here, Also param2 was mentioned as 1000 does this number has any significant, where should i find the correct parentSRID.

Thank you for quick response.

Regards,

Nilesh

Beginner

Re: Creating VM or Linked VM request UCS cloud director from command line.

Hi Nilesh,

Please try with passing the parent SRID as -1.

Updated query would be like:

/app/api/rest?formatType=json&opName=userAPISubmitWorkflowServiceRequest&opData={param0:"WorkFlow-01","param1":{"details":[{"name":"input_2_Select_OS286","value":"Win-64Bit"},{"name":"input_3_Select_Product117","value":"Syma"},{"name":"input_4_Select_Purpose7","value":"method01"}]},"param2": -1}


Please let me know if any issue found.

Regards,


Obul

Enthusiast

Re: Creating VM or Linked VM request UCS cloud director from command line.

1.      Yes I agree. In the document, userAPISubmitServiceRequestCustom  is not mentioned. If you have UCSD Installed check in the Policies -> orchestration -> REST API Browser for the mentioned API.

2.      For opData always we have specify like    opData=

3.      Data security we are providing through  authentication Key (say: REST KEY) .

Regards,

Rekha Krishna

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards