Respect availability zones and OS image names in service definition

Change-Id: I0ebc65092ccd3c17bf823c3e20d6f83ed580d280
This commit is contained in:
Stan Lagun 2013-07-30 10:35:38 +04:00
parent f611530e96
commit 024c72f327
6 changed files with 44 additions and 9 deletions

View File

@ -15,7 +15,12 @@
"ImageName" : {
"Description" : "Image name",
"Type" : "String"
}
},
"AvailabilityZone" : {
"Description" : "The Availability Zone in which to launch the instance.",
"Type" : "String",
"Default" : "nova"
}
},
"Resources" : {
@ -24,6 +29,7 @@
"Properties": {
"InstanceType" : { "Ref" : "InstanceType" },
"ImageId" : { "Ref" : "ImageName" },
"AvailabilityZone" : { "Ref" : "AvailabilityZone" },
"UserData": "$userData"
}
}

View File

@ -5,7 +5,7 @@
</set>
</rule>
<rule match="$.services[?(@.type == 'activeDirectory')].units[?(@.state.hostname and not @.state.instanceName)]">
<rule match="$.services[?(@.type == 'activeDirectory')].units[?(@.state.hostname and @.state.osImageName and not @.state.instanceName)]">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating instance <select path="state.hostname"/> (<select path="name"/>)</parameter>
@ -26,7 +26,8 @@
<parameter name="arguments">
<map>
<argument name="InstanceType"><select path="::flavor" default="m1.medium"/></argument>
<argument name="ImageName">ws-2012-full</argument>
<argument name="ImageName"><select path="state.osImageName"/></argument>
<argument name="AvailabilityZone"><select path="::availabilityZone" default="nova"/></argument>
</map>
</parameter>

View File

@ -5,7 +5,7 @@
</set>
</rule>
<rule match="$.services[?(@.type in ('webServer', 'aspNetApp', 'webServerFarm', 'aspNetAppFarm'))].units[?(@.state.hostname and not @.state.instanceName)]">
<rule match="$.services[?(@.type in ('webServer', 'aspNetApp', 'webServerFarm', 'aspNetAppFarm'))].units[?(@.state.hostname and @.state.osImageName and not @.state.instanceName)]">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating instance <select path="state.hostname"/> (<select path="name"/>)</parameter>
@ -26,7 +26,8 @@
<parameter name="arguments">
<map>
<argument name="InstanceType"><select path="::flavor" default="m1.medium"/></argument>
<argument name="ImageName">ws-2012-full</argument>
<argument name="ImageName"><select path="state.osImageName"/></argument>
<argument name="AvailabilityZone"><select path="::availabilityZone" default="nova"/></argument>
</map>
</parameter>

View File

@ -8,7 +8,7 @@
<!-- Specify here parameters of domain controllers at each availability zone -->
<!-- ======================================================================= -->
<mapping name="Region1">
<mapping name="nova">
<map>
<mapping name="domain">domain1</mapping>
<mapping name="domainUser">Administrator</mapping>
@ -18,7 +18,7 @@
</map>
</mapping>
<mapping name="Region2">
<mapping name="AnotherAvailabilityZone">
<map>
<mapping name="domain">domain2</mapping>
<mapping name="domainUser">Administrator</mapping>

26
data/workflows/Images.xml Normal file
View File

@ -0,0 +1,26 @@
<workflow>
<rule match="$.services[*].units[?(not @.state.osImageName)]">
<set path="#osImageMap">
<map>
<!-- ====================================================================== -->
<!-- Mappings between image IDs and image file names can be configured here -->
<!-- ====================================================================== -->
<mapping name="win2k12full">ws-2012-full</mapping>
<!-- image to use if no image id provided -->
<mapping name="DEFAULT">ws-2012-full</mapping>
<!-- ====================================================================== -->
</map>
</set>
<set path="state.osImageName">
<select source="osImageMap">
<parameter name="path"><select path="::osImage" default="DEFAULT"/></parameter>
</select>
</set>
</rule>
</workflow>

View File

@ -5,7 +5,7 @@
</set>
</rule>
<rule match="$.services[?(@.type == 'msSqlServer')].units[?(@.state.hostname and not @.state.instanceName)]">
<rule match="$.services[?(@.type == 'msSqlServer')].units[?(@.state.hostname and @.state.osImageName and not @.state.instanceName)]">
<report entity="unit">
<parameter name="id"><select path="id"/></parameter>
<parameter name="text">Creating instance <select path="state.hostname"/> (<select path="name"/>)</parameter>
@ -26,7 +26,8 @@
<parameter name="arguments">
<map>
<argument name="InstanceType"><select path="::flavor" default="m1.medium"/></argument>
<argument name="ImageName">ws-2012-full</argument>
<argument name="ImageName"><select path="state.osImageName"/></argument>
<argument name="AvailabilityZone"><select path="::availabilityZone" default="nova"/></argument>
</map>
</parameter>