OpenVZ

 view release on metacpan or  search on metacpan

lib/OpenVZ/Vzctl.pm  view on Meta::CPAN

        umount    => [],
        exec      => [qw( command )],
        exec2     => [qw( command )],
        runscript => [qw( script )],
        start     => [qw( [force] [wait] )],
        enter     => [qw( [exec] )],
        chkpnt    => [qw( [create_dumpfile] )],
        restore   => [qw( [restore_dumpfile] )],
        create    => [qw( [config] [hostname] [ipadd] [ostemplate] [private] [root] )],

        set => [ qw(

                [applyconfig] [applyconfig_map] [avnumproc] [bootorder] [capability]
                [cpulimit] [cpumask] [cpus] [cpuunits] [dcachesize] [devices] [devnodes]
                [dgramrcvbuf] [disabled] [diskinodes] [diskspace] [features] [force]
                [hostname] [ioprio] [ipadd] [ipdel] [iptables] [kmemsize] [lockedpages]
                [name] [nameserver] [netif_add] [netif_del] [noatime] [numfile]
                [numflock] [numiptent] [numothersock] [numproc] [numpty] [numsiginfo]
                [numtcpsock] [onboot] [oomguarpages] [othersockbuf] [pci_add] [pci_del]
                [physpages] [privvmpages] [quotatime] [quotaugidlimit] [save]
                [searchdomain] [setmode] [shmpages] [swappages] [tcprcvbuf] [tcpsndbuf]
                [userpasswd] [vmguarpages]

                ),
        ],

    );

####################################


    push @vzctl_exports, 'known_commands';

    sub known_commands { return keys %vzctl }

####################################


    push @vzctl_exports, 'known_options';

    my $commands_rx = join q{|}, keys %vzctl;

    sub known_options { ## no critic qw( Subroutines::RequireArgUnpacking )

        #my @spec; $spec[0] = { type => SCALAR, regex => qr/^$commands_rx$/ };
        my @spec = ( { type => SCALAR, regex => qr/^$commands_rx$/ } );

        my @arg = validate_with( params => \@_, spec => \@spec );

        my @options = ( 'flag', 'ctid', @{ $vzctl{ $arg[0] } } );

        return wantarray ? @options : \@options;

    }

####################################


    my @capabilities = qw(

        chown dac_override dac_read_search fowner fsetid ipc_lock ipc_owner kill
        lease linux_immutable mknod net_admin net_bind_service net_broadcast
        net_raw setgid setpcap setuid setveid sys_admin sys_boot sys_chroot
        sys_module sys_nice sys_pacct sys_ptrace sys_rawio sys_resource sys_time
        sys_tty_config ve_admin

    );

    push @vzctl_exports, 'capabilities';

    sub capabilities { return wantarray ? @capabilities : \@capabilities }

####################################


    my @iptables_modules = qw(

        ip_conntrack ip_conntrack_ftp ip_conntrack_irc ip_nat_ftp ip_nat_irc
        iptable_filter iptable_mangle iptable_nat ipt_conntrack ipt_helper
        ipt_length ipt_limit ipt_LOG ipt_multiport ipt_owner ipt_recent
        ipt_REDIRECT ipt_REJECT ipt_state ipt_tcpmss ipt_TCPMSS ipt_tos ipt_TOS
        ipt_ttl xt_mac

    );

    push @vzctl_exports, 'iptables_modules';

    sub iptables_modules { return wantarray ? @iptables_modules : \@iptables_modules }

####################################


    my @features = qw( sysfs nfs sit ipip ppp ipgre bridge nfsd );

    push @vzctl_exports, 'features';

    sub features { return wantarray ? @features : \@features }

####################################

    my %validate = do {

        my $capability_names = join q{|}, @capabilities;
        my $iptables_names   = join q{|}, @iptables_modules;
        my $features_names   = join q{|}, @features;

        my %hash = (

            # XXX: Annoying.  Need to submit a bug for this.
            ## no critic qw( Variables::ProhibitPunctuationVars )
            avnumproc  => { type => SCALAR, regex     => qr{^\d+[gmkp]?(?::\d+[gmkp]?)?$}i },
            bootorder  => { type => SCALAR, regex     => qr{^\d+$} },
            capability => { type => SCALAR, regex     => qr{^(?:$capability_names):(?:on|off)$}i },
            cpumask    => { type => SCALAR, regex     => qr{^\d+(?:[,-]\d+)*|all$}i },
            ctid       => { type => SCALAR, callbacks => { 'validate ctid' => \&_validate_ctid } },
            devices    => { type => SCALAR, regex     => qr{^(?:(?:[bc]:\d+:\d+)|all:(?:r?w?))|none$}i },
            features   => { type => SCALAR, regex     => qr{^(?:$features_names):(?:on|off)$}i },
            flag       => { type => SCALAR, regex     => qr{^quiet|verbose$}i },
            force      => { type => UNDEF },
            ioprio     => { type => SCALAR, regex => qr{^[0-7]$} },
            onboot     => { type => SCALAR, regex => qr{^yes|no$}i },

lib/OpenVZ/Vzctl.pm  view on Meta::CPAN


=item kmemsize

=item lockedpages

=item numfile

=item numflock

=item numiptent

=item numothersock

=item numproc

=item numpty

=item numsiginfo

=item numtcpsock

=item oomguarpages

=item othersockbuf

=item physpages

=item privvmpages

=item shmpages

=item swappages

=item tcprcvbuf

=item tcpsndbuf

=item vmguarpages

Expects an integer followed by an optional 'g', 'm', 'k' or 'p', followed optionally by a colon and an integer and an optional 'g',
'm', 'k' or 'p'.  E.g., 5M or 5M:15M.

=item bootorder

=item cpulimit

=item cpus

=item cpuunits

=item quotatime

=item quotaugidlimit

Expects an integer.

=item capability

Expects one of the following capabilities

    chown dac_override dac_read_search fowner fsetid ipc_lock ipc_owner kill lease linux_immutable mknod net_admin net_bind_service
    net_broadcast net_raw setgid setpcap setuid setveid sys_admin sys_boot sys_chroot sys_module sys_nice sys_pacct sys_ptrace
    sys_rawio sys_resource sys_time sys_tty_config ve_admin

joined with either 'on' or 'off' with a colon. E.g., 'chown:on'.

=item cpumask

Expects either a comma separated list of integers or the word 'all'.

=item devices

Expects a device that matches the regex

  /^(?:(?:(?:b|c):\d+:\d+)|all:(?:r?w?))|none$/

No other validation is performed.

XXX Better explanation needed here.

=item devnodes

=item features

Expects one of the following features

  sysfs nfs sit ipip ppp ipgre bridge nfsd

followed by a colon and either 'on' or 'off'.

=item force

=item save

Expects either undef or the empty string.

=item ioprio

Expects a single integer from 0 to 7.

=item ipadd

=item ipdel

Expects either an array reference or a space separated list of ips to be added or deleted. L<Regexp::Common>'s C<net IPv4> regex is
used to determine if the ips look valid.  No other validation is performed.

C<ipdel> also accepts 'all' to delete all ips.

=item iptables

Expects either an array reference or space separated list of one or more of the following

    ip_conntrack ip_conntrack_ftp ip_conntrack_irc ip_nat_ftp ip_nat_irc iptable_filter iptable_mangle iptable_nat ipt_conntrack
    ipt_helper ipt_length ipt_limit ipt_LOG ipt_multiport ipt_owner ipt_recent ipt_REDIRECT ipt_REJECT ipt_state ipt_tcpmss
    ipt_TCPMSS ipt_tos ipt_TOS ipt_ttl xt_mac

=item nameserver

=item disabled

=item noatime

=item onboot



( run in 0.931 second using v1.01-cache-2.11-cpan-5511b514fd6 )