]> xenbits.xensource.com Git - people/iwj/colo-for-testing.git/commitdiff
convert-cabinet-layout: flags, etc.
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 9 Mar 2015 18:03:50 +0000 (18:03 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 9 Mar 2015 18:03:57 +0000 (18:03 +0000)
convert-cabinet-layout

index 6ec5b1d2d942f416083c19b1771e514b01898f65..7b3277fae0c1a511fbb0f657467dea6790b4206c 100755 (executable)
@@ -22,6 +22,11 @@ use Data::Dumper;
 
 open DEBUG, ">/dev/null";
 our $only;
+our $createlike;
+
+our @flags = qw(arch-amd64 arch-i386 arch-xen-amd64 arch-xen-i386
+                hvm purpose-build purpose-test
+                suite-wheezy);
 
 while (@ARGV && $ARGV[0] =~ m/^-/) {
     $_ = shift @ARGV;
@@ -38,6 +43,10 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
             $|=1;
             select(STDOUT);
             $|=1;
+        } elsif (s/^-c(.)/$1/) {
+            $createlike = $_;
+        } elsif (s/^-f(.)/$1/) {
+            push @flags, $_;
         } else {
             die "bad option $_ ?";
         }
@@ -80,6 +89,8 @@ sub setprop ($$) {
         "./mg-hosts setprops $machine -- $prop '$value'\n";
 }
 
+our @machines;
+
 while (my $row = $csv->getline_hr($fh)) {
     print DEBUG Dumper($row);
 
@@ -87,12 +98,17 @@ while (my $row = $csv->getline_hr($fh)) {
     next unless $machine =~ m/^([a-z]+) ([0-1])$/;
     $machine = $1.$2;
 
+    outfor "mg-hosts equiv",
+    "./mg-hosts setflags $machine -- equiv-$1\n";
+
     if (defined $only) {
         next unless $only =~ m/\b$machine\b/;
     }
 
     print "# $machine\n";
 
+    push @machines, $machine;
+
     eval {
         my $ip = $row->{'IP addr'} or die "no ip\n";
         $ip =~ m/^172\.16\.(144|145|146|147)\.(\d+)$/ or die "bad ip\n";
@@ -130,6 +146,16 @@ while (my $row = $csv->getline_hr($fh)) {
     reportno 'Serial';
 }
 
+if (defined $createlike) {
+    outfor "mg-hosts",
+    "./mg-hosts create-like $createlike ".(join ",", @machines)."\n";
+}
+
+if (@flags) {
+    outfor "mg-hosts",
+    "./mg-hosts setflags @machines -- @flags\n";
+}
+
 close $fh or die $!;
 
 foreach my $dest (sort { $dests{$a} <=> $dests{$b} } keys %dests) {