Browse Source

cbsd bls works now :)

master
Zane C. B-H 1 year ago
parent
commit
9144dd207b
  1. 2
      Rex-Virtualization-CBSD/Makefile.PL
  2. 15
      Rex-Virtualization-CBSD/lib/Rex/Virtualization/CBSD/list.pm

2
Rex-Virtualization-CBSD/Makefile.PL

@ -18,7 +18,7 @@ my %WriteMakefileArgs = (
},
PREREQ_PM => {
'Term::ANSIColor'=>'0',
'Rex'=>'1.9.0';
'Rex'=>'1.9.0',
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Rex-Virtualization-CBSD-*' },

15
Rex-Virtualization-CBSD/lib/Rex/Virtualization/CBSD/list.pm

@ -11,31 +11,30 @@ our $VERSION = '1.9.0'; # VERSION
use Rex::Logger;
use Rex::Helper::Run;
use Term::ANSIColor;
use Term::ANSIColor qw(colorstrip);
sub execute {
my ( $class, $arg1 ) = @_;
Rex::Logger::debug("Getting CBSD VM list via display=nodename,jname,jid,vm_ram,vm_curmem,vm_cpus,pcpu,vm_os_type,ip4_addr,status,vnc,path");
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");
my %VMs;
my $found=i_run('display=nodename,jname,jid,vm_ram,vm_curmem,vm_cpus,pcpu,vm_os_type,ip4_addr,status,vnc,path'),
fail_ok => 1;
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' , fail_ok => 1);
if ( $? != 0 ) {
die("Error running 'display=nodename,jname,jid,vm_ram,vm_curmem,vm_cpus,pcpu,vm_os_type,ip4_addr,status,vnc,path'");
die("Error running 'cbsd bls display=nodename,jname,jid,vm_ram,vm_curmem,vm_cpus,pcpu,vm_os_type,ip4_addr,status,vnc,path'");
}
$found=colorstrip($found);
my @found_lines=split(/\n/, $found);
foreach my $line (@found_lines){
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;
$VM{'vnc'}, $VM{'path'} ) = split(/[\ \t]+/, $line);
$VMs{$VM{'name'}}=\%VM;
}
return \%VMs;

Loading…
Cancel
Save