b793da42c3d61dcb8000a7d955b76af3cbbb56f1
[virt-orchestrator.git] / vFLOWER / content / Workflows / uio / lib / log / vm_ready_email.workflow.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <workflow xmlns="http://vmware.com/vco/workflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://vmware.com/vco/workflow http://vmware.com/vco/workflow/Workflow-v4.xsd" root-name="item3" object-name="workflow:name=generic" id="e8ecbc5e-964e-4811-84d6-76ff12d69d72" version="1.0.7" api-version="3.1.0" allowed-operations="fve" icon-id="93015d83-b1ba-42d0-9b3c-bb3ebb862beb" restartMode="1" resumeFromFailedMode="0">
3     <display-name>vm_ready_email</display-name>
4
5     <description>Send email to "epostliste" and inform that the new VM is installed and ready</description>
6
7     <position x="100.0" y="50.0"/>
8
9     <input>
10         <param name="vm" type="VC:VirtualMachine"/>
11         <param name="viktighet" type="number"/>
12         <param name="datacenter" type="string"/>
13         <param name="cluster" type="string"/>
14         <param name="disksize" type="number"/>
15         <param name="num_cpus" type="number"/>
16         <param name="memory" type="number"/>
17         <param name="osname" type="string"/>
18         <param name="epostliste" type="string"/>
19         <param name="datacenter1" type="VC:Datacenter"/>
20     </input>
21
22     <attrib name="mailto" type="string" read-only="false">
23         <value encoded="n">__NULL__</value>
24         <description>Default mailto parameter</description>
25     </attrib>
26     <attrib name="smtp_server" type="string" read-only="false">
27         <value encoded="n">__NULL__</value>
28         <description>Default SMTP server</description>
29     </attrib>
30     <attrib name="smtp_port" type="string" read-only="false">
31         <value encoded="n">__NULL__</value>
32         <description>Default SMTP port</description>
33     </attrib>
34     <attrib name="database" type="SQL:Database" read-only="false">
35         <value encoded="n">__NULL__</value>
36         <description>Default database</description>
37     </attrib>
38     <attrib name="state" type="string" read-only="false">
39         <value encoded="n">INFO</value>
40         <description>Log state</description>
41     </attrib>
42     <attrib name="enable_mail" type="boolean" read-only="false">
43         <value encoded="n">__NULL__</value>
44         <description>If true, send email for all events</description>
45     </attrib>
46     <attrib name="message" type="string" read-only="false">
47         <value encoded="n"/>
48         <description>Message to log to db</description>
49     </attrib>
50     <attrib name="status" type="number" read-only="false">
51         <value encoded="n">4.0</value>
52         <description>VM status. Default 4 or 999 for deleted</description>
53     </attrib>
54     <attrib name="vm_name" type="string" read-only="false">
55         <value encoded="n"/>
56         <description>Navn på vm som skal ha oppdatert status</description>
57     </attrib>
58     <attrib name="vmPassword" type="SecureString" read-only="false">
59         <value encoded="n"/>
60     </attrib>
61
62     <workflow-item name="item0" type="end" end-mode="0">
63         <position x="824.5" y="118.13636363636363"/>
64     </workflow-item>
65
66     <workflow-item name="item2" out-name="item1" type="task">
67         <display-name>Send mail to user that server is built and ready for use</display-name>
68
69         <script encoded="false">
70 if (enable_mail) {
71         var mail = new EmailMessage() ;
72         mail.fromAddress='virtprov@usit.uio.no';
73         mail.toAddress=mailto;
74         mail.subject="[virtprov] Your new server, "+vm.name+", is ready";
75         mail.smtpPort=smtp_port;
76         mail.smtpHost=smtp_server;
77
78
79         var body=""
80                 +"Your new server "+vm.name+" is installed and now available for you.\n"
81                 +"\n"
82                 +"If you have any questions and/or request for changes, please contact\n"
83                 +"windows-drift@usit.uio.no or unix-drift@usit.uio.no depending on the\n"
84                 +"operating system on your new server.\n"
85                 +"\n"
86                 +"Servername      =&gt; "+vm.name+"\n"
87                 +"Viktighet       =&gt; "+viktighet+"\n"
88                 +"Datacenter      =&gt; "+datacenter+"\n"
89                 +"Cluster         =&gt; "+cluster+"\n"
90                 +"Disksize        =&gt; "+disksize+" GB\n"
91                 +"Number of CPU's =&gt; "+num_cpus+"\n"
92                 +"Memory          =&gt; "+memory+" GB\n"
93                 +"Operating System =&gt; "+osname+"\n"
94                 +"Epost liste     =&gt; "+epostliste+"\n"
95                 +""
96         
97
98         mail.addMimePart(body)
99         mail.sendMessage();
100 }
101
102 vm_name=vm.name;
103 message="Installed and ready";
104         </script>
105
106         <in-binding>
107             <bind name="cluster" type="string" export-name="cluster"/>
108             <bind name="datacenter" type="string" export-name="datacenter"/>
109             <bind name="disksize" type="number" export-name="disksize"/>
110             <bind name="enable_mail" type="boolean" export-name="enable_mail">
111                 <description>If true, send email for all events</description>
112             </bind>
113             <bind name="epostliste" type="string" export-name="epostliste"/>
114             <bind name="mailto" type="string" export-name="mailto">
115                 <description>Default mailto parameter</description>
116             </bind>
117             <bind name="memory" type="number" export-name="memory"/>
118             <bind name="num_cpus" type="number" export-name="num_cpus"/>
119             <bind name="osname" type="string" export-name="osname"/>
120             <bind name="smtp_port" type="string" export-name="smtp_port">
121                 <description>Default SMTP port</description>
122             </bind>
123             <bind name="smtp_server" type="string" export-name="smtp_server">
124                 <description>Default SMTP server</description>
125             </bind>
126             <bind name="state" type="string" export-name="state">
127                 <description>Log state</description>
128             </bind>
129             <bind name="viktighet" type="number" export-name="viktighet"/>
130             <bind name="vm" type="VC:VirtualMachine" export-name="vm"/>
131         </in-binding>
132
133         <out-binding>
134             <bind name="message" type="string" export-name="message"/>
135             <bind name="vm_name" type="string" export-name="vm_name">
136                 <description>Navn på vm som skal ha oppdatert status</description>
137             </bind>
138         </out-binding>
139
140         <position x="364.5" y="55.40909090909091"/>
141     </workflow-item>
142
143     <workflow-item name="item3" out-name="item2" type="link" linked-workflow-id="1f0fc470-006c-4c15-a3b9-95e2e7540f22">
144         <display-name>global_parameters</display-name>
145
146         <in-binding/>
147
148         <out-binding>
149             <bind name="mailto" type="string" export-name="mailto"/>
150             <bind name="smtp_server" type="string" export-name="smtp_server"/>
151             <bind name="smtp_port" type="string" export-name="smtp_port"/>
152             <bind name="database" type="SQL:Database" export-name="database"/>
153             <bind name="vmPassword" type="SecureString" export-name="vmPassword"/>
154             <bind name="enable_email" type="boolean" export-name="enable_mail"/>
155         </out-binding>
156
157         <position x="204.5" y="55.40909090909091"/>
158     </workflow-item>
159
160     <workflow-item name="item4" out-name="item0" type="link" linked-workflow-id="fac19258-528f-4e75-a341-6242a16246b6">
161         <display-name>set_db_state</display-name>
162
163         <in-binding>
164             <bind name="vm" type="string" export-name="vm_name">
165                 <description>Navn på vm som skal ha oppdatert status</description>
166             </bind>
167             <bind name="status" type="number" export-name="status">
168                 <description>VM status. Default 4 or 999 for deleted</description>
169             </bind>
170             <bind name="message" type="string" export-name="message">
171                 <description>Message to log to info or error</description>
172             </bind>
173             <bind name="virtualMachine" type="VC:VirtualMachine" export-name="vm"/>
174             <bind name="project_folder" type="string" export-name="epostliste"/>
175             <bind name="datacenter" type="VC:Datacenter" export-name="datacenter1"/>
176         </in-binding>
177
178         <out-binding/>
179
180         <description>Set a new state for VM in database</description>
181
182         <position x="504.5" y="55.40909090909091"/>
183     </workflow-item>
184
185     <workflow-item name="item1" out-name="item4" type="condition" alt-out-name="item0" comparator="0">
186         <display-name>Decision</display-name>
187
188         <script encoded="false">
189 //Generated by the system, cannot be edited
190 return (database  != null ) ;
191         </script>
192
193         <in-binding>
194             <bind name="database" type="SQL:Database" export-name="database"/>
195         </in-binding>
196         <condition name="database" type="SQL:Database" comparator="0" label="null"/>
197
198         <position x="425.0" y="109.04545454545453"/>
199     </workflow-item>
200
201     <presentation>
202         <p-param name="vm">
203             <desc>vm</desc>
204         </p-param>
205         <p-param name="viktighet">
206             <desc>viktighet</desc>
207         </p-param>
208         <p-param name="datacenter">
209             <desc>datacenter</desc>
210         </p-param>
211         <p-param name="cluster">
212             <desc>cluster</desc>
213         </p-param>
214         <p-param name="disksize">
215             <desc>disksize</desc>
216         </p-param>
217         <p-param name="num_cpus">
218             <desc>num_cpus</desc>
219         </p-param>
220         <p-param name="memory">
221             <desc>memory</desc>
222         </p-param>
223         <p-param name="osname">
224             <desc>osname</desc>
225         </p-param>
226         <p-param name="epostliste">
227             <desc>epostliste</desc>
228         </p-param>
229         <p-param name="datacenter1">
230             <desc>datacenter1</desc>
231         </p-param>
232     </presentation>
233 </workflow>