misc fixes for create and list

This commit is contained in:
Zane C. B-H 2021-10-14 10:42:50 -05:00
parent 419a0149aa
commit 27f50bcd73
3 changed files with 13 additions and 7 deletions

View File

@ -25,7 +25,13 @@ our $VERSION = '0.0.1';
set virtualization => "CBSD";
use Data::Dumper;
print Dumper vm 'create', name=>'foo',
'vm_os_type'=>'freebsd',
'vm_os_profile'=>'FreeBSD-x64-13.0',
'vm_ram'=>'1g',
'vm_cpus'=>'1',
'imgsize'=>'10g';
=cut
@ -207,7 +213,7 @@ The returned array is a hash of hashes. The first level hash is the jname.
nodename - The node name that this is set to run on.
vm - Name of the VM.
name - Name of the VM.
jid - Jail ID/process ID of the VM if running. IF '0' it is not running.

View File

@ -57,13 +57,13 @@ sub execute {
if ( defined( $opts{$key} ) ) {
# make sure it does not contain any tabs, spaces, =, \. /, ', ", or new lines.
if ( $opts{$key} =~ /[\t\ \=\\\/\'\"\n]/ ) {
# make sure it does not contain any tabs, single/double quotes, and new lines
if ( $opts{$key} =~ /[\t\'\"\n]/ ) {
die 'The value "'
. $opts{$key}
. '" for key "'
. $key
. '" matched /[\t\ \=\/\\\'\"\n]/, meaning it is not a valid value';
. '" matched /[\t\'\"\n]/, meaning it is not a valid value';
}
if ( defined( $opts{$key} ) ) {

View File

@ -45,13 +45,13 @@ sub execute {
# needs to be updated if display= is ever changed
(
$VM{'node'}, $VM{'vm'}, $VM{'pid'}, $VM{'ram'}, $VM{'curmem'}, $VM{'cpus'},
$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;
return %VMs;
}
1;