[! use strict; use PVE::pvecfg; use PVE::I18N; use PVE::ConfigServer; use PVE::HTMLTable; use PVE::Config; use PVE::Cluster; use PVE::HTMLForm; use PVE::HTMLUtils; !] [- use strict; my $out = ''; sub html_table_line { my ($v1, $v2) = @_; $v1 = " " if !$v1; $v2 = " " if !$v2; my $html = ''; $html .= "$v1$v2\n"; return $html; } my $form = PVE::HTMLForm->new (\%fdat); my $html; my $cinfo = $fdat{__cinfo}; my $veid = $fdat{veid}; my $cid = $fdat{cid}; if ($form->action eq 'save') { eval { check_write_mode ($udat{AM}); my $conn = PVE::ConfigClient::connect (); my $settings = {}; if ($fdat{quota}) { $settings->{quotatime} = $fdat{grace}; $settings->{quotaugidlimit} = $fdat{maxugids}; } else { $settings->{quotatime} = 0; $settings->{quotaugidlimit} = 0; } $settings->{cpuunits} = $fdat{cpuunits}; check_range (__("CPU Units"), $fdat{cpuunits}, 8, 500000); $conn->vmconfig_set ($udat{auth_username}, $cid, $veid, 'openvz', $settings)->result; }; $udat{popup_error} = $@ if $@; } my $vminfo = PVE::Cluster::load_vmconfig ($cinfo, $cid, $veid, 'openvz'); my $status = $vminfo->{vzlist}->{"VEID_$veid"}->{status}; my $vmconf = $vminfo->{config}; my $ni = $vminfo->{ni}; my $cpuunits = defined ($fdat{cpuunits}) ? $fdat{cpuunits} : $vmconf->{cpuunits}->{value} || 1000; my $quota = defined ($fdat{quota}) ? $fdat{quota} : int ($vmconf->{quotaugidlimit}->{value}) > 0; my $maxugids = defined ($fdat{maxugids}) ? $fdat{maxugids} : $vmconf->{quotaugidlimit}->{value} || 500; my $grace = defined ($fdat{grace}) ? $fdat{grace} : $vmconf->{quotatime}->{value} || 0; $html = ""; $html .= html_table_line (__("CPU Units") . ':', $form->create_element ('cpuunits', 'number', $cpuunits)); #$html .= html_table_line (); $html .= html_table_line (__("Enable User Quotas") . ':', $form->create_element ('quota', 'dynamicbool', $quota)); if ($quota) { $html .= html_table_line (__("Maximum user/group IDs") . ':', $form->create_element ('maxugids', 'number', $maxugids)); $html .= html_table_line (__("Grace period (seconds)") . ':', $form->create_element ('grace', 'number', $grace)); } $html .= '

'; $html .= $form->create_cmdbutton ('save'); $out .= $form->create_header(); $out .= $html; #$out .= PVE::HTMLUtils::create_statusframe (undef, __("Options"), undef, $html); $out .= $form->create_footer(); print OUT $out; -]