Cannot seem to make this work. Any suggestions?
In the examples of new-harddisk for 6.5 r1 this is what is provided:
-------------- Example 6 --------------
New-HardDisk -VM $vm -VDisk $vDisk
Attaches the $vDisk VDisk object to the $vm virtual machine.
-----------------------------------------
This is the result when Ii attempt to use this command against a 6.5 lab setup from William Lam. I even tried specifying a controller and it doesn't matter.
PowerCLI C:\> $controller
Type BusSharingMode UnitNumber
---- -------------- ----------
ParaVirtual NoSharing 3
PowerCLI C:\> $vm
Name PowerState Num CPUs MemoryGB
---- ---------- -------- --------
TestVM PoweredOff 1 2.000
PowerCLI C:\> $vdisk
Name Disk Type CapacityGB Filename
---- --------- ---------- --------
TestVolume Flat 1.000 ...056898496/a90a82eeb49c40218fc27ad3ece92109.vmdk
PowerCLI C:\> New-HardDisk -Controller $controller -vdisk $vdisk -vm $vm
WARNING: Parameter 'VM' is obsolete. Passing multiple values to this parameter is obsolete.
New-HardDisk : 11/25/2016 3:48:36 PM New-HardDisk Device requires a controller.
At line:1 char:1
+ New-HardDisk -Controller $controller -vdisk $vdisk -vm $vm
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-HardDisk], MissingController
+ FullyQualifiedErrorId : Client20_VirtualDeviceServiceImpl_AttachHardDisk_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDev
ice.NewHardDisk
Just curious, how did you create the VDisk?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hey Luc
PowerCLI C:\> $datastore = get-datastore v*
PowerCLI C:\> $datastore
Name FreeSpaceGB CapacityGB
---- ----------- ----------
vsanDatastore 65.221 68.182
PowerCLI C:\> New-VDisk -Name TestvDisk2 -StorageFormat:Thin -CapacityGB 1 -Datastore $datastore -DiskType:Flat
Name Disk Type CapacityGB Filename
---- --------- ---------- --------
TestvDisk2 Flat 1.000 ...056898496/9fdeae6b683944ddb7357300768bd5bf.vmdk
Any ideas? I opened a case, but they are saying I need SDK support (first time I have ever heard that before).
Is there a technical reason to use vdisk instead of the "old" way?
You could simply do :
get-vm "Test-VM" | New-HardDisk -VM -CapacityGB 5 -StorageFormat Thin -Datastore (Get-Datastore "Test-DS") -DiskType Flat | New-ScsiController -Type ParaVirtual
LucD The vdisk command he's using is part of a new set of cmdlets introduced in PowerCLI 6.5: New Release: PowerCLI 6.5 R1 - VMware PowerCLI Blog - VMware Blogs
I heard that SDK Support statement before, afaik that is not true.
Perhaps alanrenoufAlan Renouf can shed a light?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
On the question about support, you do not require SDK support unless you are asking them to support your entire script, a single cmdlet failing should be supported, especially this where you are replicating whats in the cmdlet help, please feel free to tell them I said
Having said that I just tried and managed to connect the vDisk to my machine, how many controllers do you have in the VM so that I can replicate your setup?
Here is what I did:
C:\Users\renou_000> $datastore = get-datastore "Shared NFS Volume"
C:\Users\renou_000> New-VDisk -Name TestvDisk1 -StorageFormat:Thin -CapacityGB 1 -Datastore $datastore -DiskType:Flat
Name Disk Type CapacityGB Filename
---- --------- ---------- --------
TestvDisk1 Flat 1.000 ...lume] fcd/b28dfc8f6f374d3e8ae9e09e12361398.vmdk
C:\Users\renou_000> get-vm
Name PowerState Num CPUs MemoryGB
---- ---------- -------- --------
TestAlan PoweredOff 1 4.000
C:\Users\renou_000> New-HardDisk -VM (get-VM TestAlan) -VDisk (get-vdisk)
WARNING: Parameter 'VM' is obsolete. Passing multiple values to this parameter is obsolete.
CapacityGB Persistence Filename
---------- ----------- --------
1.000 Persistent ...lume] fcd/b28dfc8f6f374d3e8ae9e09e12361398.vmdk
Thanks Alan. I am using Will's virtual lab setup script (http://www.virtuallyghetto.com/2016/11/vghetto-automated-vsphere-lab-deployment-for-vsphere-6-0u2-vs...) to create virtual 6.5 ESXi hosts and a vCenter and its a virtual vsan datastore. There are no running VMsin this environment. The only vm has a single paravirtual scsi controller.
PowerCLI C:\> get-vm
Name PowerState Num CPUs MemoryGB
---- ---------- -------- --------
TestVM PoweredOff 1 2.000
PowerCLI C:\> get-vm | Get-ScsiController
Type BusSharingMode UnitNumber
---- -------------- ----------
ParaVirtual NoSharing 3
PowerCLI C:\> get-vdisk
Name Disk Type CapacityGB Filename
---- --------- ---------- --------
TestVolume Flat 1.000 ...056898496/a90a82eeb49c40218fc27ad3ece92109.vmdk
TestvDisk2 Flat 1.000 ...056898496/9fdeae6b683944ddb7357300768bd5bf.vmdk
PowerCLI C:\> New-HardDisk -VM (get-VM TestVM) -VDisk (get-vdisk -Name TestVolume)
WARNING: Parameter 'VM' is obsolete. Passing multiple values to this parameter is obsolete.
New-HardDisk : 12/13/2016 3:03:32 PM New-HardDisk Device requires a controller.
At line:1 char:1
+ New-HardDisk -VM (get-VM TestVM) -VDisk (get-vdisk -Name TestVolume)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-HardDisk], MissingController
+ FullyQualifiedErrorId : Client20_VirtualDeviceServiceImpl_AttachHardDisk_ViError,VMware.VimAutomation.ViCore.Cmd
lets.Commands.VirtualDevice.NewHardDisk
I did a few test and I had the same result as you.
I found out that it works if you change the existing disk controller to SATA and remove the scsi controller
New-HardDisk -VDisk $vdisk -VM $vm
The disk is then attached by default to the 0:1 SATA controller.
I'm not sure exactly what to do with this information but it looks like some kind of incompatibility? VMware vSphere 6.5 Documentation Library
Or maybe does it require a special setting in the bios?
Maybe Alan Renouf and LucD can find an explanation to this behaviour?
Hi,
I am trying to issue same commands on my set-up and getting unsupported error, anything you needed to enable on vSAN to get new-vdisk command working
PowerCLI C:\Users\Bindu> new-vdisk -datastore vsanDatastore -DiskType Flat -Stor
ageFormat Thin -Name disk6 -CapacityGB 20
new-vdisk : 7/26/2017 10:34:24 AM New-VDisk The operation is not
supported on the object.
At line:1 char:1
+ new-vdisk -datastore vsanDatastore -DiskType Flat -StorageFormat Thin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-VDisk], NotSupported
+ FullyQualifiedErrorId : StorageImpl_VDisk_NewVDisk_CreationFailed,VMware
.VimAutomation.Storage.Commands.Cmdlets.VDisk.NewVDisk
Did you check the controller type (see previously in this thread)?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you for your comment, isn't controller when attaching the vdisk to VM as harddisk? I am getting error when creating vdisk itself which isn't independent of the any VM controller?
As far as I understand it, when you create the harddisk, it is automatically attached to a controller.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
you are absolutely correct regarding harddisk, but I am running into issue at vdisk creation time.
So if I get it right, you're seeing the issue when you do the New-VDisk?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
yes, that is exactly correct.
Strange.
Sorry, no real explanation for that right now.
I would suggest you open a SR.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference