Author: eelco
Date: Thu Jun 16 15:09:57 2011
New Revision: 27485
URL: https://svn.nixos.org/websvn/nix/?rev=27485&sc=1
Log:
* Handle Nova as an EC2 target.
Added:
cloud/trunk/examples/nova.nix
Modified:
cloud/trunk/src/nixos-deploy-network.pl
Added: cloud/trunk/examples/nova.nix
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cloud/trunk/examples/nova.nix Thu Jun 16 15:09:57 2011 (r27485)
@@ -0,0 +1,19 @@
+{
+
+ webserver =
+ { config, pkgs, ... }:
+
+ {
+ services.httpd.enable = true;
+ services.httpd.adminAddr = "[email protected]";
+ services.httpd.documentRoot = "${pkgs.valgrind}/share/doc/valgrind/html";
+
+ deployment.targetEnv = "ec2";
+ deployment.ec2.type = "nova";
+ deployment.ec2.controller = http://192.168.1.20:8773/services/Cloud;
+ deployment.ec2.ami = "ami-nixos";
+ deployment.ec2.instanceType = "m1.large";
+ deployment.ec2.keyPair = "my_key";
+ };
+
+}
Modified: cloud/trunk/src/nixos-deploy-network.pl
==============================================================================
--- cloud/trunk/src/nixos-deploy-network.pl Thu Jun 16 14:52:20 2011
(r27484)
+++ cloud/trunk/src/nixos-deploy-network.pl Thu Jun 16 15:09:57 2011
(r27485)
@@ -192,7 +192,8 @@
};
} elsif ($targetEnv eq "ec2") {
$info->{ec2} =
- { controller => $m->findvalue('./attrs/attr[@name =
"ec2"]/attrs/attr[@name = "controller"]/string/@value') || die
+ { type => $m->findvalue('./attrs/attr[@name =
"ec2"]/attrs/attr[@name = "type"]/string/@value') || die
+ , controller => $m->findvalue('./attrs/attr[@name =
"ec2"]/attrs/attr[@name = "controller"]/string/@value') || die
, ami => $m->findvalue('./attrs/attr[@name =
"ec2"]/attrs/attr[@name = "ami"]/string/@value') || die
, instanceType => $m->findvalue('./attrs/attr[@name =
"ec2"]/attrs/attr[@name = "instanceType"]/string/@value') || die
, keyPair => $m->findvalue('./attrs/attr[@name =
"ec2"]/attrs/attr[@name = "keyPair"]/string/@value') || die
@@ -453,7 +454,13 @@
if ($machine->{targetEnv} eq "adhoc") {
print STATE " require = [ $myDir/adhoc-cloud-vm.nix ];\n";
} elsif ($machine->{targetEnv} eq "ec2") {
- print STATE " require = [
\"\${modulesPath}/virtualisation/amazon-config.nix\" ];\n";
+ if ($machine->{ec2}->{type} eq "ec2") {
+ print STATE " require = [
\"\${modulesPath}/virtualisation/amazon-config.nix\" ];\n";
+ } elsif ($machine->{ec2}->{type} eq "nova") {
+ print STATE " require = [
\"\${modulesPath}/virtualisation/nova-image.nix\" ];\n";
+ } else {
+ die "machine ‘$name’ has unknown EC2 type
‘$machine->{ec2}->{type}’\n";
+ }
}
print STATE " networking.extraHosts = \"$hosts\";\n";
print STATE " };\n";
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits