VMware Cloud Community
zeevik
Contributor
Contributor
Jump to solution

Perl VI fails on vdiskcreate.pl - End Disconnect

Trying to run Perl-VI vm/vdiskcreate.pl and fails, with the following error message:

Can't call method "key" on an undefined value at C:\Program Files\VMware\VMware vSphere CLI\Perl\apps\vm\vdiskcreate.pl line 82, <STDIN> line 2.

End Disconnect

Perl-VI is the latest 1.6 version (doesnloaded this morning). Same script command works fine vs. ESX-3.5 server .

Help will be appriciate,

Zeevik.

Reply
0 Kudos
1 Solution

Accepted Solutions
jnhall
Enthusiast
Enthusiast
Jump to solution

Try this. But first, a disclaimer: This is not an official patch or an official anything and comes with no guarantees. You've been warned!

However, I did try this, and it seems to do the trick. Hope I copied everything in here correctly with no missing semicolons, etc.

In vdiskcreate.pl, change line 81 (or thereabouts) from:

controller => 'SCSI controller 0');

to

controller => qr/^SCSI controller 0$/i);

Then in VMUtil.pm (in the apps/AppUtil directory), at line 380 or thereabouts, in sub find_device, replace the line:

return $device if ($device->deviceInfo->label eq $name);

with this block of code:

if (ref $name eq 'Regexp') {

return $device if ($device->deviceInfo->label =~ $name);

} else {

return $device if ($device->deviceInfo->label eq $name);

}

Let me know how it goes....

View solution in original post

Reply
0 Kudos
27 Replies
admin
Immortal
Immortal
Jump to solution

VI Perl Toolkit is now known as vSphere SDK for Perl. Could you try it with the 4.0 version?

If it still doesn't work, could you post the command line you use?

Reply
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

Please provide the entire command that you are running and as Carter stated, if you're using vSphere ESX(i) 4.0, please make sure you're using the vSphere SDK for Perl which is specific for 4.0 release of vSphere.

=========================================================================

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".

Reply
0 Kudos
zeevik
Contributor
Contributor
Jump to solution

Thanks for the replies.

vSphere SDK for Perlis what I'm using (downloaded today to verify version is not the issue).

the command is

vdiskcreate.pl --server 10.55.1.31 --username user --password pass --vmname QA-06-Center --filename QA-06-Center --disksize 4000

Same command, same SDK works fine againts 3.5 ESX host, but fails against 4.0 ESX host.

Zeevik.

Reply
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

We only ask because in your initial thread you mention 1.6 which is for VIM2.5 and for vSphere it should be showing version 4.0

=========================================================================

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".

Reply
0 Kudos
zeevik
Contributor
Contributor
Jump to solution

Any hint for this issue ?

Even a line saying "Hey body, it is working for me. Check your conf" will be helpful

in the meantime, I installed a Linux machine with the latet Perl VI.

Still does not work, but the error message is different

Error: Server version unavailable at 'https://10.55.1.31/sdk/vimService.wsdl'

Thanks,

Zeevik.

Reply
0 Kudos
jnhall
Enthusiast
Enthusiast
Jump to solution

"Server version unavailable" can indicate a problem connecting to the host. Does connect.pl work?

connect.pl --server 10.55.1.31 --username user --password pass

If you're still having trouble with the original command, can you paste the output of connect.pl (whether it runs OK or also displays an error).

Reply
0 Kudos
zeevik
Contributor
Contributor
Jump to solution

Thanks for the quick response.

There is no connectivity issue between ESX host and Linux machine.

It looks like an SSL / certificate issue.

root@qa-dhcp-03:~# /usr/lib/vmware-vcli/apps/general/connect.pl --server 10.55.1.31 --username user --password pass

Error: Server version unavailable at 'https://10.55.1.31/sdk/vimService.wsdl'

root@qa-dhcp-03:~# wget https://10.55.1.31/sdk/vimService.wsdl

15:22:21 https://10.55.1.31/sdk/vimService.wsdl

=> `vimService.wsdl'

Connecting to 10.55.1.31:443... connected.

ERROR: Certificate verification error for 10.55.1.31: unable to get local issuer certificate

ERROR: certificate common name `VMware default certificate' doesn't match requested host name `10.55.1.31'.

To connect to 10.55.1.31 insecurely, use `--no-check-certificate'.

Unable to establish SSL connection.

root@qa-dhcp-03:~#

Reply
0 Kudos
jnhall
Enthusiast
Enthusiast
Jump to solution

You can disable the various certificate match requirements. It's a requirement that we support certificates but they can be sources of difficult to diagnose problems and some users may not need or want them.

It may be that Perl Toolkit is discarding a meaningful message in favor of its general "server version unavailable" message (which is not particularly helpful I agree).

Knowing that it's a certificate problem, are you able to fix it? If not, let me/us know.

Reply
0 Kudos
zeevik
Contributor
Contributor
Jump to solution

How can I disable the certificate requirement ?

Is it on the VC side ? Perl toolkit side ?

Thanks,

Zeevik.

Reply
0 Kudos
jnhall
Enthusiast
Enthusiast
Jump to solution

I think you can do it in VI Client ... there's a server administrator option. I'm not looking at the VI Client UI at the moment but if you can't find it let me know.

Reply
0 Kudos
jnhall
Enthusiast
Enthusiast
Jump to solution

I'm hoping that the lack of a followup response means that things are working for you now.

Reply
0 Kudos
zeevik
Contributor
Contributor
Jump to solution

Actually, they don't .

There are two issues:

1) on one machine (Ubuntu Linux), I get the certificate issue, although set the VC not to check for certificates.

2) on another machine (Win-XP SP2), the certifictaeis ok, but I do get the error message I originally posted.

Due to lack of time in the past few days, I did not workon this issue. plan to continue next week.

Will update you once progress is made.

Zeevik.

Reply
0 Kudos
zeevik
Contributor
Contributor
Jump to solution

Certificates issue resolved.

The original problem with the vdiskcreate is still open.

For the same PC, sa me Perl VIAPI:

Ruuning the vdiskcreate.pl against a VI3 vCenter - OK.

Running the vdiskcreate.pl against a vSphere vCenter - FAIL.

Please HELP

Reply
0 Kudos
jnhall
Enthusiast
Enthusiast
Jump to solution

Please paste the command line and the exact output you're seeing in your failure case.

It may be that this operation is not supported when passed through Virtual Center, but I don't know if that's the case.

Reply
0 Kudos
zeevik
Contributor
Contributor
Jump to solution

vdiskcreate.pl --server 10.55.1.31 --username user --password pass --vmname QA-06-Center --filename QA-06-Center-01 --disksize 4000

Can't call method "key" on an undefined value at C:\Program

Files\VMware\VMware vSphere CLI\Perl\apps\vm\vdiskcreate.pl line 82,

<STDIN> line 2.

End Disconnect

Reply
0 Kudos
jnhall
Enthusiast
Enthusiast
Jump to solution

Do you have another VM with the same name in your VC, datacenter, etc.?

Try adding the host name explicitly to the command (--host ....).

Message was edited by: jnhall

Reply
0 Kudos
zeevik
Contributor
Contributor
Jump to solution

Thanks for the response.

vmname is unique.

not host, nor hostname, are accepted parameter for this command:

Unknown option: host

For a summary of command usage, type './vdiskcreate.pl --help'.

Unknown option: hostname

For a summary of command usage, type './vdiskcreate.pl --help'.

Reply
0 Kudos
jnhall
Enthusiast
Enthusiast
Jump to solution

Okay, that's a separate problem, but those options should be supported in this command.

Anyway I think I found the problem, and the fix will involve changing some code. It appears that the name of a SCSI controller is reported as 'SCSI Controller x' in 2.5/3.5 and 'SCSI controller x' (<-- change in capitalization) in 4.0. If you use a 4.0 VC to retrieve the controller name from a 3.5 host the capitalization is still different. You can see this using VI Client. I don't know if anyone involved in Perl Toolkit knew about this, nor do I know why this change came about. Would you like to see a possible patch?

zeevik
Contributor
Contributor
Jump to solution

Will be happy to see a patch.

Will the patch allow me to run the vdiskcreate against VI3 vCenter as well as VI4 vCenter ?

I have the same machine running scripts to both vCenters.

But it is OK if not, I will find a way to workaround this issue.

Thanks,

Zeevik,

Reply
0 Kudos