Handle new capped-cpu output format
authorJamie Cameron <jcameron@webmin.com>
Wed, 6 Jan 2010 07:52:20 +0000 (23:52 -0800)
committerJamie Cameron <jcameron@webmin.com>
Wed, 6 Jan 2010 07:52:20 +0000 (23:52 -0800)
zones/zones-lib.pl

index 14593f9..5667586 100755 (executable)
@@ -10,6 +10,8 @@ use WebminCore;
 %thing_key_map = ( "net" => "address",
                   "fs" => "dir",
                   "inherit-pkg-dir" => "dir",
+                  "capped-cpu" => "ncpus",
+                  "capped-memory" => "physical",
                   "rctl" => "name",
                   "attr" => "name",
                   "device" => "match" );
@@ -64,7 +66,8 @@ foreach $p ("zonepath", "autoboot", "pool", "brand") {
        }
 
 # Add lists of things
-foreach $r ("fs", "inherit-pkg-dir", "net", "device", "rctl", "attr") {
+foreach $r ("fs", "inherit-pkg-dir", "net", "device", "rctl", "attr",
+           "capped-cpu", "capped-memory") {
        local @lines = &get_zonecfg_output($zone, "info $r");
        local ($l, $thing);
        foreach $l (@lines) {
@@ -75,9 +78,11 @@ foreach $r ("fs", "inherit-pkg-dir", "net", "device", "rctl", "attr") {
                                   'keyzone' => $zone };
                        push(@{$zinfo->{$r}}, $thing);
                        }
-               elsif ($l =~ /^\s+([^:]+):\s*\[(.*)\]/ ||
-                      $l =~ /^\s+([^:]+):\s*"(.*)"/ ||
-                      $l =~ /^\s+([^:]+):\s*(.*)/) {
+                elsif ($l =~ /^\s+\[([^:]+):\s*"(.*)"\]/ ||
+                       $l =~ /^\s+\[([^:]+):\s*(.*)\]/ ||
+                       $l =~ /^\s+([^:]+):\s*\[(.*)\]/ ||
+                       $l =~ /^\s+([^:]+):\s*"(.*)"/ ||
+                       $l =~ /^\s+([^:]+):\s*(.*)/) {
                        # An attribute of a thing
                        if (defined($thing->{$1})) {
                                # Multiple values!