rajuskark has asked for the wisdom of the Perl Monks concerning the following question:

I want to run command ($onevm list) using perl script through OpenNebula perl module is this possible with perl module
SAN
  • Comment on OpenNebula : Run command ($onevm list ) using perl script

Replies are listed 'Best First'.
Re: OpenNebula : Run command ($onevm list ) using perl script
by LanX (Saint) on Dec 26, 2016 at 12:35 UTC
Re: OpenNebula : Run command ($onevm list ) using perl script
by FreeBeerReekingMonk (Deacon) on Dec 27, 2016 at 22:10 UTC
    Looking at the Open Nebula API I see that your requested "one vm list" command maps to the one.vmpool.info XML-RPC method.

    Looking at OpenNebula.pm line 128, we see that

    my $data = $self->_rpc("one.vm.info", [ int => $id ]);

    so clone that subroutine, and make your own script that fetches the one.vmpool.info instead. Then, with "use Data::Dumper;" try to dump $data and see if there is useful information.

    EDIT:

    Net::OpenNebula::RPCClient is what you need (untested, but at least it runs without me having OpenNebula):

    use Data::Dumper; use Net::OpenNebula::RPCClient; my $one = Net::OpenNebula::RPCClient->new( url => "http://server:2633/RPC2", user => "oneadmin", password => "onepass", ); my $ret = $one->_rpc("one.vmpool.info"); die Dumper $ret; #die Dumper $one;

    OLD, probably BAD STUFF:

    use Data::Dumper; use Net::OpenNebula; my $one = Net::OpenNebula->new( url => "http://server:2633/RPC2", user => "oneadmin", password => "onepass", ); my $data = $one->_rpc("one.vmpool.info"); die Dumper \$data;

    sorry for being vague... I do not know the module, nor your application.

      How to use start vnc process in perl. Is there any option for generation sunstone_token using OpenNebual.pm

      Kishor

        "How to use start vnc process in perl."

        The module offers no functionality to do this, system?