my @devices = @{$vm->get("Status.devices")};
I think I figured it out. I forgot to actually connect to the vm so any
refrence to the vm would be undef.
Now on to other errors.
Thanks
-----Original Message-----
From: Dustin Puryear [mailto:dpuryear@usa.net]
Sent: Tuesday, February 03, 2004 11:25 AM
To: nolug@joeykelly.net
Subject: Re: [Nolug] Perl question
Which line is line 23? I think your email client funkified the code listing.
----- Original Message -----
From: "Wimprine, Thomas" <twimprine@stei.com>
To: <nolug@joeykelly.net>
Sent: Tuesday, February 03, 2004 11:00 AM
Subject: [Nolug] Perl question
> I'm working on a perl script and I'm getting this error
>
>
>
> Can't use an undefined value as an ARRAY reference at ./logdisk.pl line
23.
>
>
>
> Here is the script. Does anyone have any ideas?
>
>
>
>
>
> #!/usr/bin/perl -w
>
>
>
> use VMware::Control;
>
> use VMware::Control::Server;
>
> use VMware::Control::VM;
>
> use strict;
>
>
>
> my $port = 902;
>
>
>
> my $server = VMware::Control::Server::new();
>
>
>
> if (!$server->connect()) {
>
> my ($errorNumber, $errorString) = $server->get_last_error();
>
> die "Cannot connect to server: Error $errorNumber:
$errorString\n";
>
> }
>
>
>
> my @list = $server->enumerate();
>
> my $cfg = 0;
>
> foreach $cfg (@list) {
>
> print "$cfg\n";
>
> my $vm = VMware::Control::VM::new($server,$cfg);
>
>
>
> my @devices = @{$vm->get("Status.devices")};
>
> my $ndisk = 1;
>
> my @disks;
>
> my $disk;
>
>
>
> foreach $disk (@devices) {
>
> if ($disk =~"ethernet" || $disk !~ ":") {
>
> next;
>
> }
>
>
>
> my $deviceType = $vm->get("Config.$disk.deviceType");
>
> if($deviceType eq "atapi-cdrom" || $deviceType eq
> "cdrom-image") {
>
> next;
>
> }
>
>
>
>
>
> if (!$vm->add_redo($disk)) {
>
> my ($errorNumber, $errorString) =
> $vm->get_last_error();
>
> die "Cannot add redo log: Error $errorNumber:
> $errorString\n";
>
> }
>
> }
>
> $vm->disconnect();
>
> }
>
>
>
>
>
> $server->disconnect();
>
>
___________________
Nolug mailing list
nolug@nolug.org
___________________
Nolug mailing list
nolug@nolug.org
Received on 02/03/04
This archive was generated by hypermail 2.2.0 : 12/19/08 EST