Question

Creating an Image in Nutanix using PowerShell [ERROR occurred while creating Disk Image]

  • 10 January 2019
  • 0 replies
  • 7260 views

Userlevel 1
Badge +2
PROBLEM:
I am using powershell to automate creating Nutanix Images in Prism. When I am running the script from Prism Central I get the error message "This action is not supported on Prism Central" and when I am running the script from Prism Element I get the error message "Error occurred while creating Disk Image". If someone is aware of this problem or has a solution please help me out.

PROBLEM IN DETAIL:
Here is what I am trying to achieve through powershell script:
  • Create a DISK_IMAGE (.VHD) from a URL
URL is in the format: nfs://127.0.0.1/Nutanix_Container/SR_UUID/Disk_UUID.vhd

I am basically doing migration of VMs to Nutanix AHV, where I have to create image of the VM's disk copied on NTNX Cluster so that I can use that image to migrate VM to AHV.

I am trying to automate this step through PowerShell...

Here is my code:
code:
$ImgCreateSpec = New-NTNXObject -Name ImageImportSpecDTO
$ContainerID = (Get-NTNXContainer -SearchString "default").id
$ImgCreateSpec.containerId = $ContainerID.Substring($ContainerID.IndexOf(":")+2)
$ImgCreateSpec.url = "nfs://127.0.0.1/Xen_to_AHV_Migration/f63571ed-3fbf-80ba-f851-31767ad753fc/06b14602-c3de-48d5-949b-d252997d920e.vhd"

New-NTNXImage -Name "Xen_to_AHV" -ImageType DISK_IMAGE -ImageImportSpec $ImgCreateSpec



ERROR WHILE RUNNING CODE as PRISM "CENTRAL" ADMIN:
code:
This action is not supported on Prism Central

New-NTNXImage : The remote server returned an error: (500) Internal Server Error.
At line:1 char:1
+ New-NTNXImage -Name "Xen_to_AHV" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Nutanix.Prism.Common.NutanixCluster:NutanixCluster) [New-NTNXImage], WebException
+ FullyQualifiedErrorId : {"message":"This action is not supported on Prism Central"},Nutanix.Prism.PS.Cmds.Acropolis.NewImage


ERROR WHILE RUNNING CODE as PRISM "ELEMENT" ADMIN:
code:
Error occurred while creating Disk Image

New-NTNXImage : The remote server returned an error: (500) Internal Server Error.
At line:1 char:1
+ New-NTNXImage -Name "Xen_to_AHV" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Nutanix.Prism.Common.NutanixCluster:NutanixCluster) [New-NTNXImage], WebException
+ FullyQualifiedErrorId : {"message":"Error occurred while creating Disk Image"},Nutanix.Prism.PS.Cmds.Acropolis.NewImage



If someone has a solution to this problem or some ideas to share please post it out.

0 replies

Be the first to reply!

Reply