FusionInventory-Agent
view release on metacpan or search on metacpan
lib/FusionInventory/Agent/SOAP/VMware.pm view on Meta::CPAN
#$vm = $ref->[0]{vm};
foreach my $id (@$machineIdList) {
push @$vms, $self->_getVirtualMachineById($id);
}
my $host = FusionInventory::Agent::SOAP::VMware::Host->new(
hash => $ref, vms => $vms
);
return $host;
}
sub getHostIds {
my ($self) = @_;
if ( !$self->{vcenter} ) {
return ['ha-host'];
}
my $req = '<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<RetrieveProperties xmlns="urn:vim25"><_this type="PropertyCollector">propertyCollector</_this>
<specSet><propSet><type>HostSystem</type><all>0</all></propSet><objectSet><obj type="Folder">group-d1</obj>
<skip>0</skip><selectSet xsi:type="TraversalSpec"><name>folderTraversalSpec</name><type>Folder</type><path>childEntity</path><skip>0</skip><selectSet><name>folderTraversalSpec</name></selectSet><selectSet><name>datacenterHostTraversalSpec</name></sel...
my $answer = $self->_send('RetrieveProperties', sprintf($req) );
my $ref = $self->_parseAnswer($answer);
my @ids;
foreach (@$ref) {
push @ids, $_->{obj};
}
return \@ids;
}
1;
__END__
=head1 NAME
FusionInventory::Agent::SOAP::VMware - Access to VMware hypervisor
=head1 DESCRIPTION
This module allow access to VMware hypervisor using VMware SOAP API
and _WITHOUT_ their Perl library.
=head1 METHODS
=head2 new(%params)
Returns a VMware object.
=head2 connect($user, $password)
Connect the VMware object with the given credentials.
=head2 getHostFullInfo($id)
Returns a large hash structure with the host information.
=head2 getHostIds()
Returns the list of the virtual machine ID in an array reference.
( run in 0.516 second using v1.01-cache-2.11-cpan-39bf76dae61 )