første xml update
[virt-orchestrator.git] / vFLOWER / content / Actions / no.uio / CheckPidInVM.action.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <dunes-script-module name="CheckPidInVM" result-type="boolean" api-version="3.1.0" id="965ff7b4-1631-4153-a767-b4e227ed5003" version="1.0.0" allowed-operations="fve">
3     <param n="pid" t="number"/>
4
5     <param n="vm" t="VC:VirtualMachine"/>
6
7     <param n="vmUsername" t="string"/>
8
9     <param n="vmPassword" t="SecureString"/>
10
11     <script encoded="false">
12 var host = vm.sdkConnection;
13
14 var guestOperationsManager = host.guestOperationsManager;
15 var guestAuth = new VcNamePasswordAuthentication();
16 guestAuth.username = vmUsername;
17 guestAuth.password = vmPassword;
18
19 //var pid=result.split(".");
20 var processManager = guestOperationsManager.processManager;
21 var guestProcessInfo = processManager.listProcessesInGuest(vm , guestAuth , [pid]);
22
23 for each (var p in guestProcessInfo) {
24         if (! p.startTime) {
25                 return true;
26         }
27         if (p.endTime) {
28                 return true;
29         } else {
30                 trow("Process still running");
31                 return false;
32         }
33 }
34     </script>
35 </dunes-script-module>