our
$VERSION
=
'0.0.1'
;
sub
execute {
my
(
$class
) =
@_
;
Rex::Logger::debug(
"Getting CBSD VM list via cbsd bls display=nodename,jname,jid,vm_ram,vm_curmem,vm_cpus,pcpu,vm_os_type,ip4_addr,status,vnc,path header=0"
);
my
%VMs
;
my
$found
= i_run(
'cbsd bls display=nodename,jname,jid,vm_ram,vm_curmem,vm_cpus,pcpu,vm_os_type,ip4_addr,status,vnc,path header=0'
,
fail_ok
=> 1
);
if
( $? != 0 ) {
die
(
"Error running 'cbsd bls display=nodename,jname,jid,vm_ram,vm_curmem,vm_cpus,pcpu,vm_os_type,ip4_addr,status,vnc,path header=0'"
);
}
$found
= colorstrip(
$found
);
my
@found_lines
=
split
( /\n/,
$found
);
foreach
my
$line
(
@found_lines
) {
my
%VM
;
(
$VM
{
'node'
},
$VM
{
'name'
},
$VM
{
'pid'
},
$VM
{
'ram'
},
$VM
{
'curmem'
},
$VM
{
'cpus'
},
$VM
{
'pcpu'
},
$VM
{
'os'
},
$VM
{
'ip4'
},
$VM
{
'status'
},
$VM
{
'vnc'
},
$VM
{
'path'
}
) =
split
( /[\ \t]+/,
$line
);
$VMs
{
$VM
{
'name'
} } = \
%VM
;
}
return
%VMs
;
}
1;