Author: eelco
Date: Wed May 11 14:10:25 2011
New Revision: 27227
URL: https://svn.nixos.org/websvn/nix/?rev=27227&sc=1

Log:
* Keep physical machines in the deployment state.

Modified:
   cloud/trunk/src/nixos-deploy-network.pl

Modified: cloud/trunk/src/nixos-deploy-network.pl
==============================================================================
--- cloud/trunk/src/nixos-deploy-network.pl     Wed May 11 13:56:13 2011        
(r27226)
+++ cloud/trunk/src/nixos-deploy-network.pl     Wed May 11 14:10:25 2011        
(r27227)
@@ -261,11 +261,25 @@
         }
         
         if ($machine->{targetEnv} eq "none") {
-            # Nothing to do here.
+            # Not much to do here.
+
+            print STDERR "checking whether machine ‘$name’ is reachable via 
SSH...\n";
+
+            # !!! should use sshName.
+            system "ssh -o StrictHostKeyChecking=no 
root\@$machine->{targetHost} true < /dev/null 2> /dev/null";
+            die "cannot SSH to machine: $?" unless $? == 0;
+
+            $state->{machines}->{$name} =
+                { targetEnv => $machine->{targetEnv}
+                , targetHost => $machine->{targetHost}
+                , timeRegistered => time()
+                };
+            
+            writeState;
         }
         
         elsif ($machine->{targetEnv} eq "adhoc") {
-        
+
             print STDERR "starting missing VM ‘$name’...\n";
             my $vmId = `ssh $machine->{adhoc}->{controller} 
$machine->{adhoc}->{createVMCommand} $ENV{USER}-$name`;
             die "unable to start VM: $?" unless $? == 0;
@@ -280,6 +294,7 @@
                 { targetEnv => $machine->{targetEnv}
                 , vmId => $vmId
                 , ipv6 => $ipv6
+                , timeCreated => time()
                 , # Need to remember these so that we know how to kill
                   # the VM later, among other things.
                   adhoc => $machine->{adhoc}
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to