Hi,
i have many problem con vdiskcreate.pl.
Initially I could not create a new disk, then I read this document and now all ok
http://communities.vmware.com/thread/213276
Now however, I need to create a rdmp but I think for my mistake, I always return the same error
Error; Incompatible device backing specified for device.
Maybe I'm wrong syntax. I use vsphere4, can you help?
I do not understand, on 'option --filename, what should I put.
I tried
perl vdiskcreate.pl --server 133.22.11.211 --username root --password password --vmname Test_IVAN --filename vml.02000000006006016055351f00506decc0459cde11524149442035 --backingtype rdm
Error; Incompatible device backing specified for device.
perl vdiskcreate.pl --server 172.22.11.211 --username root --password password --vmname Test_IVAN --filename /vmfs/devices/disks/vml.02000100006006016055351f00516decc0459cde11524149442035 --backingtype rdm
Error; Incompatible device backing specified for device.
I do not know what to do, help!
I agree, I'm not a fan of running it on Windows either but I was saying that you do have other options if you're not comfortable using Perl.
I finally got access back to our development server (had small outage due to very old UPS) ... anywho, take a look at this script:
The script allows you to create and add a new RDM and remove and delete RDM. Please take a look at the examples provided and would recommend taking a look at how the script works so you understand what's going on.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
There's a few errors with VMware's vdiskcreate.pl and their VMUtil.pl module which must have been using some old code ....
The reason you're receiveing the invalid backing, is it's basically selecting the first available LUN that it can find on your system which may or may not be correct. It's also hard coding the compatibility mode of your RDM ... but not only that, they're using the wrong key word.
Here is the snippet of code that needs off:
/usr/lib/vmware-vcli/apps/AppUtil/VMUtil.pm
my $lunId = $host_storage_system->storageDevice->scsiLun->[0]->uuid; my $deviceName = $host_storage_system->storageDevice->scsiLun->[0]->deviceName; $disk_backing_info = VirtualDiskRawDiskMappingVer1BackingInfo->new(compatibilityMode => "physical",
So basically, what should have happened is go through all the scsiLun[] and figure out the proper device to use, once you've narrowed that down, you'll go ahead and assign the UUID and DEVICENAME.
For the compatibilityMode the keyword should be either physicalMode or virtualMode
Here's the following changes I made to the script and actually extracted and redefined get_vdisk_spec() and put into the executing script:
my $LUNS = $host_storage_system->storageDevice->scsiLun; my ($lunId,$deviceName); foreach(@$LUNS) { if($_->lunType eq 'disk') { my $lunCap = (($_->capacity->blockSize * $_->capacity->block)/1024); if($lunCap eq $size) { $lunId = $_->uuid; $deviceName = $_->deviceName; } } } $disk_backing_info = VirtualDiskRawDiskMappingVer1BackingInfo->new(compatibilityMode => "physicalMode", deviceName => $deviceName, lunUuid => $lunId, fileName => $fileName);
The current logic is relying on the fact that you pass in the correct size of the RDM (MB) and make sure it's the exact since it will be converted into (kb) and compared with the devices that are available. I also just hard code the mode, but you can create either a physical or virtual RDM by just modifying compatibilityMode
I'm not sure where you got rdmCreate.pl but it's definitely not written to correctly handle RDMs and neither is vdiskcreate nor the VMUtils.pm module. If I have some time, I'll see if I can write up something that's slightly easier to use.
Here is a sample execution with the exact syntax using these modfications:
The input to the script is pretty simple, you just need to specify the backingtype which is rdm, the exact disksize and in my case I have 1.95gb which turns out to be 2000mb and I want the filename to be rdmVM_1.vmdk (this can be anything) and then I specify the name of the VM
[vi-admin@scofield vm][http://esx40-1.primp-industries.com|http://esx40-1.primp-industries.com]$ ./rdm.pl --server esx40-1.primp-industries.com --backingtype rdm --disksize 2000 --filename rdmVM_1.vmdk --vmname rdmVM Adding Virtual Disk on Virtual machine rdmVM in the host esx40-1.primp-industries.com with file name rdmVM_1.vmdk calling the reconfigure VM returned from reconfigure VM Virtual Disk created.
Note: This was executed on vMA 4.0 directly against the ESX 4 host that has the VM
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Hi Lamw,
Your answers are very helpful to me, but i have a problem for my inability.
When i run rdmCreate.pl i have this error;
# perl rdmCreate.pl --url https://ESXHOST/sdk/vimService --username root --password passw0rd --vmname MyVM --filename Pippo.vmdk --backingtype rdm
Adding Virtual Disk on Virtual machine MYVM in the host itrmvmw08.it.grouperci.com with file name Pippo.vmdk
env browser
*****
ARRAY(0x800b070)
*****
*****
number of present disks is 1
*****
ITRMVSC Disk[0]: Capacity /vmfs/devices/disks/naa.6006016055351f00506decc0459cde11
cannonical_name: /vmfs/devices/disks/naa.6006016055351f00506decc0459cde11
calling the reconfigure VM
Error trapped
SOAP Fault:
-
Fault string: Incompatible device backing specified for device '0'.
Fault detail: Invalicd ..
In Attach there' re my file .
Can you help me again.
Moreover, with these changes I can also give input
through a specific LUN --lunUuid, wrong?
Is can also set the label scsi, example "Hard disk 4"?
Thanks again for your enlightening answers
Please re-read my last repose, the answers are provided there. You have not made any of the modifications I spoke of ... that is why it's failing, your version of rdmCreate.pl which is really just a mod of vdiskcreate.pl is not written properly to handle RDMs and it uses the VMUtil.pl which also has errors in the script. Unfortunately I don't have access to my development system to provide a cleaner script but what you're looking for is in the previous post.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Sorry, but my knowledge of perl and 'equal to 0.
I tried to verify what you have written to me el 'errors it finds and' the following;
# perl rdmCreate.pl --url https://172.23.42.211/sdk/vimService --username root --passworddm --disksize 1000 --filename TestNew.vmdk --vmname ITRMVSC
Adding Virtual Disk on Virtual machine ITRMVSC in the host itrmvmw08.it.grouperci.com with file name TestNew.vmdk
calling the reconfigure VM
Error trapped
SOAP Fault:
-
Fault string: A general system error occurred: Failed to create disk: Error creating disk
Fault detail: SystemErrorFalut :
SOAP Fault:
-
Fault string: A general system error occurred: Failed to create disk: Error creating disk
Your script in perl rdm.pl is different with rdmCreate.pl e vdiskcreate.pl
In attach my VMUtil.pl
Thanks for your kind reply
by
Ivan
Until I have access into my development environment, I won't be able to share my version of the script.
rdm.pl is just the name I gave my script, you have to understand that the script you have is not written correctly to handle RDMs nor is the VMUtil.pm that it references. It's also good to understand what is going on in the script ... remember this can also be done using PowerCLI or other languages to the vSphere SDK, though I'm a big fan of the Perl implementation but it does require some knowledge of Perl and understanding of the vSphere API
I'll provide an update when I have access back into my environment.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Hello Lamw,
the problem I have with the powerCLI and 'that run only on Windows platform, but I should make it run on Linux. Anyway thanks, I remain waiting for your Info.
I will find everything on your blog?
Thanks again
Hello
I agree, I'm not a fan of running it on Windows either but I was saying that you do have other options if you're not comfortable using Perl.
I finally got access back to our development server (had small outage due to very old UPS) ... anywho, take a look at this script:
The script allows you to create and add a new RDM and remove and delete RDM. Please take a look at the examples provided and would recommend taking a look at how the script works so you understand what's going on.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Very very Thanks.
Your script is exceptional.
I hope that in future you can be useful as thou you were for me.
Thanks again
By
Ivan
Hi, Lamw,
Sorry for bring it up, can you share your rdm.pl? I'm facing the same problem with the previous user, and would really appreciate it if you can give me a copy of your rdm.pl. Thanks.
I no longer have the rdm.pl sample, it looks like the forum is no longer displaying the original download link.
Take a look at this rdm sample which should help http://communities.vmware.com/docs/DOC-10974
Thanks! I've got this script after a lot of searching.
But I just have a little problem:
if I want to create a RDM, not store with Virtual Machine, but store in a specific datastore, can we specify that?
Is there any API or parameter I can change to achieve that?
Thanks!
I too am struggling with rewriting the vdiskcreate.pl to allow me to put the vmdk in a separate datastore... Have you figured it out yet or gotten any info on the side?