VMware {code} Community
VMinator
Contributor
Contributor
Jump to solution

vmreconfig.pl add device CD/DVD fails if VM created with vmcreate.pl

I am trying to add a cdrom to my VM that I created with the vmcreate.pl.

When I use the vmreconfig.pl script to create the cdrom I get the following error..

Can't use an undefined value as an ARRAY reference at /usr/lib/vmware-vcli/apps/vm/..//AppUtil/VMUtil.pm line 898.

Ok so I manually create a cdrom in vSphere and try agian...

Adding cd 'cd' . . .
Virtual machine 'vmname4' is reconfigured successfully.

Ok so I think my VM that I created with the vmcreate.pl is missing the ide0:0 or something...

Any suggestions on how I can do this?

I am trying to do the following..

1. Create VM using vmcreate.pl.

2. Add CDrom to VM using vmreconfig.pl.

Thanks in advanced.

0 Kudos
1 Solution

Accepted Solutions
stumpr
Virtuoso
Virtuoso
Jump to solution

Just looked at this.

The vmreconfig.pl script doesn't handle the case of an unset device array in the VirtualIDEController object.

Looks like the actual device array is not set until an IDE device is actually connected (or when a new IDE device is added).  I'm not 100% sure of what generates the actual device array off the VirtualIDEController, but the case of an undefined device array should be handled in the reconfig script.

I can see two solutions here, first write a custom script that adds the CDROM and handles this one-off case.  Second, edit the vmreconfig.pl script to handle this particular case of an unset device array.

In VMUtil.pm, you'll find line number 929:

      my $unitNumber = $#{$controller->device} + 1;

Change this to:

      my $unitNumber = (defined $controller->device) ? $#{$controller->device} + 1 : 0;

There may be other cases throughout the VMUtil.pm module that needs updating as well.  For this reason, it may be best to just write your own custom tool.  However, the simple fix above may let you move forward with your project in the short term.

Reuben Stump | http://www.virtuin.com | @ReubenStump

View solution in original post

0 Kudos
4 Replies
VMinator
Contributor
Contributor
Jump to solution

Hello,

Can anyone comment on this?

0 Kudos
stumpr
Virtuoso
Virtuoso
Jump to solution

Just looked at this.

The vmreconfig.pl script doesn't handle the case of an unset device array in the VirtualIDEController object.

Looks like the actual device array is not set until an IDE device is actually connected (or when a new IDE device is added).  I'm not 100% sure of what generates the actual device array off the VirtualIDEController, but the case of an undefined device array should be handled in the reconfig script.

I can see two solutions here, first write a custom script that adds the CDROM and handles this one-off case.  Second, edit the vmreconfig.pl script to handle this particular case of an unset device array.

In VMUtil.pm, you'll find line number 929:

      my $unitNumber = $#{$controller->device} + 1;

Change this to:

      my $unitNumber = (defined $controller->device) ? $#{$controller->device} + 1 : 0;

There may be other cases throughout the VMUtil.pm module that needs updating as well.  For this reason, it may be best to just write your own custom tool.  However, the simple fix above may let you move forward with your project in the short term.

Reuben Stump | http://www.virtuin.com | @ReubenStump
0 Kudos
VMinator
Contributor
Contributor
Jump to solution

Perfect, That worked.

I really appreciate it.

0 Kudos
pjelar
Contributor
Contributor
Jump to solution

me too Smiley Happy

0 Kudos