[root@VCL-Server Desktop]# perl CatPerlTest.pl
OK: executed command: cat /etc/hosts, pid: 19185, exit status: 0, output:
127.0.0.1   localhost localhost.localdomain localhost4
localhost4.localdomain4
 192.168.0.101  1vsphere.upb.pitt.edu 1vsphere
 192.168.0.102  2vsphere.upb.pitt.edu 2vsphere
 192.168.0.103  3vsphere.upb.pitt.edu 3vsphere
 192.168.0.104  4vsphere.upb.pitt.edu 4vsphere
 192.168.0.105  5vsphere.upb.pitt.edu 5vsphere
 192.168.0.106  6vsphere.upb.pitt.edu 6vsphere
 192.168.0.107  7vsphere.upb.pitt.edu 7vsphere
 192.168.0.108  8vsphere.upb.pitt.edu 8vsphere
 192.168.0.109  9vsphere.upb.pitt.edu 9vsphere
 192.168.0.110  10vsphere.upb.pitt.edu 10vsphere
 192.168.0.3    vsphere.upb.pitt.edu vsphere
 192.168.0.2    vcl-server.upb.pitt.edu vcl-server
 ::1         localhost localhost.localdomain localhost6
localhost6.localdomain6



Aaron

I just looked at the peace of code which generates the error.
There is really nothing unusual:

# Retrieve the contents of /etc/hosts using cat
        my ($exit_status, $output) = run_command('cat /etc/hosts', 1);
        if (defined $exit_status && $exit_status == 0) {
                notify($ERRORS{'DEBUG'}, 0, "retrieved contents of
/etc/hosts on this management node, contains " . scalar
@$output . " lines");
        }
        elsif (defined $exit_status) {
                notify($ERRORS{'WARNING'}, 0, "failed to cat /etc/hosts on
this management node, exit status: $exit_status,
output:\n" . join("\n", @$output));
                return;
        }
        else {
                notify($ERRORS{'WARNING'}, 0, "failed to run command to
cat /etc/hosts on this management node");
                return;
        }

Could you please save following code as a hosts-test.pl file and execute
it (perl hosts-test.pl).
I got this code from utils.pm's run_command funtion. This what generates
exit_code 255 in your case.
What output do you get?


#!/usr/bin/perl

$command = 'cat /etc/hosts';
if ($pid = open(COMMAND, "$command 2>&1 |")) {
                # Capture the output of the command
                @output = <COMMAND>;
                # Save the exit status
                $exit_status = $? >> 8;
        if ($? == -1) {
                print("Error: \$? is set to $?, setting exit status to 0,
Perl bug likely encountered");
                $exit_status = 0;
        }
                # Close the command handle
                close(COMMAND);
        }
        else {
                print("Error: failed to execute command: $command, error:
$!");
                exit 0;
        }
                print("\nOK: executed command: $command, pid: $pid, exit
status: $exit_status, output:\n\n@output");

Thanks.


On Mar 16, 2012, at 13:13 , Aaron Bryant wrote:

> After seeing your suggestion, I have done the following changes to no
> avail:
>
> - Disabled Selinux
> - Changed the syntax of the hosts file from IP Address - Alias -
> Hostname, to IP Address - Hostname - Alias (Just to make sure this
> wasn't causing a problem)
>
> I can't seem to find any problems with permissions.  I also could not
> find any valid reason for the "cat" to fail, although directly after it
> fails, it prints the output of the "cat" command in the log file.
>
> The problem is still occurring even after the simple changes I have
> made.  Any additional suggestions?
>
>
>
> On 2/28/2012 4:21 PM, Dmitri Chebotarov wrote:
>> Aaron
>>
>> The problem seems to be with your /etc/hosts file.
>> 'cat /etc/hosts' failed with exit status 255, when exit status 0 is
>> expected. B/c of this, vcl couldn't get private ip address and didn't
>> attempt to connect to the host. I cannot think of any valid reasons why
>> 'cat /etc/hosts' would fail... Can you double-check syntax, permission,
>> selinux, ... ?
>>
>> ...
>> |10951|20:20|image| ---- WARNING ----
>> |10951|20:20|image| 2012-02-28
>> 13:32:34|10951|20:20|image|DataStructure.pm:get_computer_private_ip_address(1589)|failed
>> to cat /etc/hosts on this management node, exit status: 255, output:
>> |10951|20:20|image| 127.0.0.1 localhost localhost.localdomain
>> localhost4 localhost4.localdomain4
>> |10951|20:20|image| 192.168.0.101 1vsphere 1vsphere.upb.pitt.edu
>> ...
>> On Feb 28, 2012, at 13:28 , Aaron Bryant wrote:
>>
>>> Greetings,
>>>
>>> I completed installing Cygwin SSHD and I'm attempting to run the vcld
>>> -setup command.  My problem occurs in this step while creating a base
>>> image.  I am able to get through all of the prompts and start the
>>> creation before the script crashes.  I have checked the
>>> '/var/log/vcld.log' log file and this is a portion of the output:
>>>
>>> -------------------------------------------------------------------------------------------------------
>>> VCL::Module::Provisioning::VMware::vSphere_SDK
>>>
>>> |10951|20:20|image| ---- WARNING ----
>>> |10951|20:20|image| 2012-02-28
>>>
>>> 13:32:34|10951|20:20|image|VMware.pm:initialize(273)|no methods are
>>> available to control VM host vsphere, the
>>>
>>> vSphere SDK cannot be used to control the VM host and the host OS
>>> cannot be controlled via SSH
>>> |10951|20:20|image| (
>>>
>>> 0) VMware.pm, initialize (line: 273)
>>> |10951|20:20|image| (-1) Module.pm, new (line: 207)
>>> |10951|20:20|image| (-2)
>>>
>>> Module.pm, create_provisioning_object (line: 423)
>>> |10951|20:20|image| (-3) State.pm, initialize (line: 117)
>>> |10951|
>>>
>>> 20:20|image| (-4) Module.pm, new (line: 207)
>>> |10951|20:20|image| (-5) vcld, make_new_child (line: 564)
>>>
>>>
>>> |10951|20:20|
>>>
>>> image| ---- WARNING ----
>>> |10951|20:20|image| 2012-02-28 13:32:34|10951|20:20|image|
>>>
>>> Module.pm:create_provisioning_object(431)|provisioning object could
>>> not be created, returning 0
>>> |10951|20:20|image|
>>>
>>> ( 0) Module.pm, create_provisioning_object (line: 431)
>>> |10951|20:20|image| (-1) State.pm, initialize (line: 117)
>>> |
>>>
>>> 10951|20:20|image| (-2) Module.pm, new (line: 207)
>>> |10951|20:20|image| (-3) vcld, make_new_child (line: 564)
>>> |10951|
>>> ---------------------------------------------------------------------------------------------
>>>
>>>
>>> I have checked and am able to ssh between the management node and the
>>> virtual machines using key authentication.
>>>
>>> Please see the log file attached for more information.
>>>
>>> Thanks,
>>> Aaron Bryant
>>> <Logfile.txt>
>>
>>
>>
>> Thank you.
>>
>> -----------------
>> Dmitri Chebotarov
>> dcheb...@gmu.edu
>> 703-993-6175
>> -----------------
>>
>>
>
> <Logfile.txt>

--
Dmitri Chebotarov
Virtual Computing Lab Systems Engineer, TSD - Ent Servers & Messaging
223 Aquia Building, Ffx, MSN: 1B5
Phone: (703) 993-6175
Fax: (703) 993-3404






Reply via email to