første endring registrert
[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.8" 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=epostliste;
74         mail.ccAddress=mailto;
75         mail.subject="[virtprov] Your new server, "+vm.name+", is ready";
76         mail.smtpPort=smtp_port;
77         mail.smtpHost=smtp_server;
78
79
80         var body=""
81                 +"Your new server "+vm.name+" is installed and now available for you.\n"
82                 +"\n"
83                 +"If you have any questions and/or request for changes, please contact\n"
84                 +"windows-drift@usit.uio.no or unix-drift@usit.uio.no depending on the\n"
85                 +"operating system on your new server.\n"
86                 +"\n"
87                 +"Servername      =&gt; "+vm.name+"\n"
88                 +"Viktighet       =&gt; "+viktighet+"\n"
89                 +"Datacenter      =&gt; "+datacenter+"\n"
90                 +"Cluster         =&gt; "+cluster+"\n"
91                 +"Disksize        =&gt; "+disksize+" GB\n"
92                 +"Number of CPU's =&gt; "+num_cpus+"\n"
93                 +"Memory          =&gt; "+memory+" GB\n"
94                 +"Operating System =&gt; "+osname+"\n"
95                 +"Epost liste     =&gt; "+epostliste+"\n"
96                 +""
97         
98
99         mail.addMimePart(body)
100         mail.sendMessage();
101 }
102
103 vm_name=vm.name;
104 message="Installed and ready";
105         </script>
106
107         <in-binding>
108             <bind name="cluster" type="string" export-name="cluster"/>
109             <bind name="datacenter" type="string" export-name="datacenter"/>
110             <bind name="disksize" type="number" export-name="disksize"/>
111             <bind name="enable_mail" type="boolean" export-name="enable_mail">
112                 <description>If true, send email for all events</description>
113             </bind>
114             <bind name="epostliste" type="string" export-name="epostliste"/>
115             <bind name="mailto" type="string" export-name="mailto">
116                 <description>Default mailto parameter</description>
117             </bind>
118             <bind name="memory" type="number" export-name="memory"/>
119             <bind name="num_cpus" type="number" export-name="num_cpus"/>
120             <bind name="osname" type="string" export-name="osname"/>
121             <bind name="smtp_port" type="string" export-name="smtp_port">
122                 <description>Default SMTP port</description>
123             </bind>
124             <bind name="smtp_server" type="string" export-name="smtp_server">
125                 <description>Default SMTP server</description>
126             </bind>
127             <bind name="state" type="string" export-name="state">
128                 <description>Log state</description>
129             </bind>
130             <bind name="viktighet" type="number" export-name="viktighet"/>
131             <bind name="vm" type="VC:VirtualMachine" export-name="vm"/>
132         </in-binding>
133
134         <out-binding>
135             <bind name="message" type="string" export-name="message"/>
136             <bind name="vm_name" type="string" export-name="vm_name">
137                 <description>Navn på vm som skal ha oppdatert status</description>
138             </bind>
139         </out-binding>
140
141         <position x="364.5" y="55.40909090909091"/>
142     </workflow-item>
143
144     <workflow-item name="item3" out-name="item2" type="link" linked-workflow-id="1f0fc470-006c-4c15-a3b9-95e2e7540f22">
145         <display-name>global_parameters</display-name>
146
147         <in-binding/>
148
149         <out-binding>
150             <bind name="mailto" type="string" export-name="mailto"/>
151             <bind name="smtp_server" type="string" export-name="smtp_server"/>
152             <bind name="smtp_port" type="string" export-name="smtp_port"/>
153             <bind name="database" type="SQL:Database" export-name="database"/>
154             <bind name="vmPassword" type="SecureString" export-name="vmPassword"/>
155             <bind name="enable_email" type="boolean" export-name="enable_mail"/>
156         </out-binding>
157
158         <position x="204.5" y="55.40909090909091"/>
159     </workflow-item>
160
161     <workflow-item name="item4" out-name="item0" type="link" linked-workflow-id="fac19258-528f-4e75-a341-6242a16246b6">
162         <display-name>set_db_state</display-name>
163
164         <in-binding>
165             <bind name="vm" type="string" export-name="vm_name">
166                 <description>Navn på vm som skal ha oppdatert status</description>
167             </bind>
168             <bind name="status" type="number" export-name="status">
169                 <description>VM status. Default 4 or 999 for deleted</description>
170             </bind>
171             <bind name="message" type="string" export-name="message">
172                 <description>Message to log to info or error</description>
173             </bind>
174             <bind name="virtualMachine" type="VC:VirtualMachine" export-name="vm"/>
175             <bind name="project_folder" type="string" export-name="epostliste"/>
176             <bind name="datacenter" type="VC:Datacenter" export-name="datacenter1"/>
177         </in-binding>
178
179         <out-binding/>
180
181         <description>Set a new state for VM in database</description>
182
183         <position x="504.5" y="55.40909090909091"/>
184     </workflow-item>
185
186     <workflow-item name="item1" out-name="item4" type="condition" alt-out-name="item0" comparator="0">
187         <display-name>Decision</display-name>
188
189         <script encoded="false">
190 //Generated by the system, cannot be edited
191 return (database  != null ) ;
192         </script>
193
194         <in-binding>
195             <bind name="database" type="SQL:Database" export-name="database"/>
196         </in-binding>
197         <condition name="database" type="SQL:Database" comparator="0" label="null"/>
198
199         <position x="425.0" y="109.04545454545453"/>
200     </workflow-item>
201
202     <presentation>
203         <p-param name="vm">
204             <desc>vm</desc>
205         </p-param>
206         <p-param name="viktighet">
207             <desc>viktighet</desc>
208         </p-param>
209         <p-param name="datacenter">
210             <desc>datacenter</desc>
211         </p-param>
212         <p-param name="cluster">
213             <desc>cluster</desc>
214         </p-param>
215         <p-param name="disksize">
216             <desc>disksize</desc>
217         </p-param>
218         <p-param name="num_cpus">
219             <desc>num_cpus</desc>
220         </p-param>
221         <p-param name="memory">
222             <desc>memory</desc>
223         </p-param>
224         <p-param name="osname">
225             <desc>osname</desc>
226         </p-param>
227         <p-param name="epostliste">
228             <desc>epostliste</desc>
229         </p-param>
230         <p-param name="datacenter1">
231             <desc>datacenter1</desc>
232         </p-param>
233     </presentation>
234 </workflow>