-
Notifications
You must be signed in to change notification settings - Fork 1
/
DeployVM.xml
1553 lines (1553 loc) · 184 KB
/
DeployVM.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8"?>
<Workflow_WorkflowDefinition apiMode="0" config="<configuration />"
description="" executeOnWeb="0"
inputs="<inputs><vmName class="java.lang.String" _list_="false" /><hypervisorName class="java.lang.String" _list_="false" /><vmHost class="java.lang.String" _list_="false" /><resourcePool class="java.lang.String" _list_="false" /><dataCenterName class="java.lang.String" _list_="false" /><vmNetwork class="java.lang.String" _list_="false" /><dataStore class="java.lang.String" _list_="false" /><companyName class="java.lang.String" _list_="false" /><ovaPath class="java.lang.String" _list_="false" /><contentLibrary class="java.lang.String" _list_="false" /><gatewayClientGroup class="java.lang.String" _list_="false" /></inputs>"
interactive="0" isHtmlDescription="0" manualPercentageComplete="0"
name="DeployVM"
outputs="<outputs><clientId class="java.lang.String" _list_="false" /><clientName class="java.lang.String" _list_="false" /></outputs>"
revision="$Revision: $" tags=""
uniqueGuid="0f634bfc-2c6d-4602-9716-b8146e249fed"
variables="<variables><vmPassword class="java.lang.String" _list_="false"></vmPassword><scriptPath class="java.lang.String" _list_="false" /><scriptlogPath class="java.lang.String" _list_="false" /><failureMessage class="java.lang.String" _list_="false" /><vmIPAddress class="java.lang.String" _list_="false" /><vmSyncCount class="java.lang.Integer" _list_="false">10</vmSyncCount><dataCenterName class="java.lang.String" _list_="false">SDDC-Datacenter</dataCenterName><vmHost class="java.lang.String" _list_="false">Cluster-1</vmHost><vmNetwork class="java.lang.String" _list_="false">computenetwork</vmNetwork><ovaPath class="java.lang.String" _list_="false">C:\OVA\commvaultappliance.ova</ovaPath><ovftoolpath class="java.lang.String" _list_="false">C:\Program Files\VMware\VMware OVF Tool\ovftool</ovftoolpath><dataStore class="java.lang.String" _list_="false">WorkloadDatastore</dataStore><resourcePool class="java.lang.String" _list_="false">Compute-ResourcePool</resourcePool><gatewayClientName class="java.lang.String" _list_="false" /><gatewayHostname class="java.lang.String" _list_="false" /><gatewayPort class="java.lang.Integer" _list_="false" /><proxiesClientGroup class="java.lang.String" _list_="false" /><firewallStop class="java.lang.String" _list_="false">sudo systemctl stop firewalld;sudo systemctl disable firewalld</firewallStop><scriptPath_FW class="java.lang.String" _list_="false" /><scriptLogPath_FW class="java.lang.String" _list_="false" /><unixOvfPath class="java.lang.String" _list_="false">ovftool</unixOvfPath><enableFirewall class="java.lang.String" _list_="false">False</enableFirewall><ovaUnixPath class="java.lang.String" _list_="false">/opt/ova/commvaultappliance.ova</ovaUnixPath><sessionId class="java.lang.String" _list_="false" /><datastoreId class="java.lang.String" _list_="false" /><datacenterId class="java.lang.String" _list_="false" /><networkId class="java.lang.String" _list_="false" /><resourcepoolId class="java.lang.String" _list_="false" /><libraryId class="java.lang.String" _list_="false" /><itemId class="java.lang.String" _list_="false" /><networkKey class="java.lang.String" _list_="false" /><storagegroupKey class="java.lang.String" _list_="false" /><itemName class="java.lang.String" _list_="false">commvaultappliance</itemName><vmId class="java.lang.String" _list_="false" /><loopcount class="java.lang.Integer" _list_="false">1</loopcount><CCR class="java.lang.String" _list_="true" /><XmlArguments class="java.lang.String" _list_="false" /><encryptedPassword class="workflow.types.EncryptedString" _list_="false">387be93ed16c19268f4ff02fa18b27d38492dc181e19376df</encryptedPassword></variables>"
webHidden="0" workflowId="0">
<schema>
<outputs className="" name="outputs" type="">
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="clientId" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="clientName" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
</outputs>
<variables attribute="0" className="" name="variables" type="">
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="vmPassword" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="scriptPath" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="scriptlogPath" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="failureMessage" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="vmIPAddress" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.Integer"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0"
inputType="java.lang.Integer" listType="0"
name="vmSyncCount" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}integer"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="dataCenterName" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="vmHost" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="vmNetwork" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="ovaPath" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="ovftoolpath" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="dataStore" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="resourcePool" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="gatewayClientName" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="gatewayHostname" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.Integer"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0"
inputType="java.lang.Integer" listType="0"
name="gatewayPort" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}integer"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="proxiesClientGroup" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="firewallStop" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="scriptPath_FW" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
hidden="0" inputType="java.lang.String" listType="0"
name="scriptLogPath_FW" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="unixOvfPath" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="enableFirewall" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="ovaUnixPath" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
hidden="0" inputType="java.lang.String" listType="0"
name="sessionId" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
hidden="0" inputType="java.lang.String" listType="0"
name="datastoreId" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
hidden="0" inputType="java.lang.String" listType="0"
name="datacenterId" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
hidden="0" inputType="java.lang.String" listType="0"
name="networkId" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
hidden="0" inputType="java.lang.String" listType="0"
name="resourcepoolId" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
hidden="0" inputType="java.lang.String" listType="0"
name="libraryId" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
hidden="0" inputType="java.lang.String" listType="0"
name="itemId" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
hidden="0" inputType="java.lang.String" listType="0"
name="networkKey" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
hidden="0" inputType="java.lang.String" listType="0"
name="storagegroupKey" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="itemName" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
hidden="0" inputType="java.lang.String" listType="0"
name="vmId" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.Integer"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0"
inputType="java.lang.Integer" listType="0"
name="loopcount" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}integer"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
hidden="0" inputType="java.lang.String" listType="1"
name="CCR" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
hidden="0" inputType="java.lang.String" listType="0"
name="XmlArguments" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0"
className="workflow.types.EncryptedString"
controlType="0" defaultValue="" documentation=""
hidden="0" inputType="workflow.types.EncryptedString"
listType="0" name="encryptedPassword" readOnly="0" type="{workflow.types}EncryptedString"/>
</variables>
<inputs attribute="0" className="" name="inputs" type="">
<children attribute="0" className="java.lang.String"
controlHidden="0" controlType="0" defaultValue=""
displayName="VM Name" documentation="" hidden="0"
inputType="java.lang.String" listType="0"
maximumValue="" minimumValue="" name="vmName"
readOnly="0" required="1" searchable="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlHidden="0" controlType="0" defaultValue=""
displayName="vCenter/Hypervisor Name" documentation=""
hidden="0" inputType="java.lang.String" listType="0"
maximumValue="" minimumValue="" name="hypervisorName"
readOnly="0" required="1" searchable="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlHidden="0" controlType="0" defaultValue=""
displayName="ESX/Cluster" documentation="" hidden="0"
inputType="java.lang.String" listType="0"
maximumValue="" minimumValue="" name="vmHost"
readOnly="0" required="0" searchable="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlHidden="0" controlType="0" defaultValue=""
displayName="ResourcePool" documentation="" hidden="0"
inputType="java.lang.String" listType="0"
maximumValue="" minimumValue="" name="resourcePool"
readOnly="0" required="0" searchable="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlHidden="0" controlType="0" defaultValue=""
displayName="" documentation="" hidden="0"
inputType="java.lang.String" listType="0"
maximumValue="" minimumValue="" name="dataCenterName"
readOnly="0" required="0" searchable="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlHidden="0" controlType="0" defaultValue=""
displayName="Network" documentation="" hidden="0"
inputType="java.lang.String" listType="0"
maximumValue="" minimumValue="" name="vmNetwork"
readOnly="0" required="0" searchable="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlHidden="0" controlType="0" defaultValue=""
displayName="Datastore" documentation="" hidden="0"
inputType="java.lang.String" listType="0"
maximumValue="" minimumValue="" name="dataStore"
readOnly="0" required="0" searchable="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="companyName" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="ovaPath" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="contentLibrary" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
<children attribute="0" className="java.lang.String"
controlType="0" defaultValue="" displayName=""
documentation="" hidden="0" inputType="java.lang.String"
listType="0" name="gatewayClientGroup" readOnly="0" type="{http://www.w3.org/2001/XMLSchema}string"/>
</inputs>
<config className="" name="configuration" type=""/>
</schema>
<Start commented="0" continueOnFailure="0" created="0"
description="" displayName="Start" height="36" interactive="0"
jobMode="0" name="Start" originalStyle="" skipAttempt="0"
style="image;image=/images/jgraphx/house.png"
uniqueName="Start_1" waitSetting="0" width="55" x="12" y="69">
<onExit language="4" script="workflow.types.EncryptedString e = xpath:{/workflow/variables/encryptedPassword};
workflow.setVariable("vmPassword",e.getPlainText());
"/>
<inputs val="<inputs />"/>
<transition activity="CommServDBQuery_3" commented="0"
description="" originalStyle="" points="" sourceX="39"
sourceY="87" status="0" style="defaultEdge" targetX="165"
targetY="204" transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Start>
<Activity commented="0" continueOnFailure="0"
created="1585916810973"
description="executes queries against a commcell database"
displayName="Collecting VM Details" height="34" interactive="0"
jobMode="0" name="CommServDBQuery"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.CommServDBQuery"
uniqueName="CommServDBQuery_1" waitSetting="0" width="149"
x="466" y="341">
<onExit language="1" script="if(xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmGUID"]}==null || xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmGUID"]}.length() == 0)
{ 
workflow.setVariable("failureMessage","Invalid job");
}
 
if(xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmIP"]}!=null && xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmIP"]}.length() > 0)
{
 workflow.setVariable("vmIPAddress",xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmIP"]});
 workflow.setVariable("vmSyncCount",0);
}
 
 "/>
<inputs val="<inputs><commCell /><query>set nocount on&#xD;
&#xD;
declare @csName nvarchar(1024)&#xD;
declare @csHostName nvarchar(1024)&#xD;
declare @csUserName nvarchar(1024)&#xD;
declare @csPassword nvarchar(1024)&#xD;
declare @vmID int&#xD;
declare @email nvarchar(1024)&#xD;
declare @vmName nvarchar(1024) = isnull('xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="vmName"]}','')&#xD;
declare @vmGUID nvarchar(1024) = isnull('xpath:{/workflow/XPathQuery_27/result}','')&#xD;
&#xD;
declare @vmIP nvarchar(1024)&#xD;
declare @vmAccountName nvarchar(1024) = 'root'&#xD;
declare @vmAccountPwd nvarchar(max)&#xD;
declare @vmPolicyId int&#xD;
declare @vmOsType int = 2&#xD;
declare @vmClientname nvarchar(1024)&#xD;
DECLARE @vmClientId int&#xD;
&#xD;
if (ISNULL(@vmName,'')='')&#xD;
begin &#xD;
 select 0 as status,'VMName value are empty or VM is not availabl' as ErrorMessage&#xD;
end&#xD;
else&#xD;
begin&#xD;
 select @vmID =vm.id,&#xD;
 @vmClientname = cl.name,&#xD;
	 @vmGUID = vm.GUID,&#xD;
	 @vmClientId=vm.clientId,&#xD;
	 @vmIP = isnull(vmIp.value('@ipAddress','nvarchar(1024)'),'')&#xD;
	 from APP_VM vm inner join APP_VMHost vmh on vmh.id=vm.vHostId&#xD;
	 inner join app_client cl on cl.id=vm.clientId&#xD;
	 CROSS APPLY vm.vxml.nodes('/QSMServer_QVirtualMachineReq') as vmIp(vmIp) &#xD;
	 where vm.guid=@vmGUID&#xD;
&#xD;
-- for cs &#xD;
select @csName=cl.name,@csHostName=cl.csHostName from app_client cl where cl.id=2&#xD;
select @csUserName=us.login, @csPassword=us.password from umusers us where us.id =1&#xD;
--Getting email details&#xD;
select @email=email from umusers where id=(select attrval from app_clientprop where componentNameId=11 and attrName='Virtual Machine Created by User')&#xD;
&#xD;
IF LEN(@vmIP) &gt; 15 --IPv4 max len is 15&#xD;
BEGIN	&#xD;
 SET @vmIP = ''&#xD;
END&#xD;
ELSE IF ISNULL(@vmIP,'') !='' AND LEN(@vmIP) &gt; 0&#xD;
BEGIN&#xD;
 update app_client set net_hostname = @vmIP where id = @vmClientId&#xD;
END &#xD;
 select @csName as 'csName', @csHostName as 'csHostName',@csUserName as 'csUsername' ,&#xD;
 @csPassword as 'csPassword',@vmClientId as 'vmClientId', @vmClientname 'vmClientname', @vmName as 'vmName',@vmIP as 'vmIP',&#xD;
 @vmOsType as 'osType',@vmClientname as 'clientName',@vmGUID as 'vmGUID' ,@email as emailId, @vmAccountName 'vmUsername'&#xD;
end&#xD;
set nocount off&#xD;
	</query></inputs>"/>
<transition activity="WorkflowEnd_1" commented="0"
description="" displayName="Failed" originalStyle=""
points="" sourceX="623" sourceY="88" status="0"
style="defaultEdge" targetX="810" targetY="318"
transitionIndex="0" x="430" y="29">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmGUID"]}==null || xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmGUID"]}.length() == 0;"/>
</transition>
<transition activity="Script_2" commented="0" description=""
displayName="Sucess" originalStyle="" points=""
sourceX="682" sourceY="85" status="0" style="defaultEdge"
targetX="675" targetY="218" transitionIndex="0" x="430" y="29">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmGUID"]}!=null && xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmGUID"]}.length() > 0 && xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmIP"]}!=null && xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmIP"]}.length() > 0;"/>
</transition>
<transition activity="Delay_1" commented="0" description=""
displayName="No valid IP" originalStyle="" points=""
sourceX="540" sourceY="358" status="0" style="defaultEdge"
targetX="530" targetY="251" transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmGUID"]}!=null && xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmGUID"]}.length() > 0 && (xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmIP"]}==null || xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmIP"]}.length() == 0);"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1586166070136"
description="activity to execute code snippets in the selected language"
displayName="Processing Data" height="34" interactive="0"
jobMode="0" name="Script"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.ScriptActivity"
uniqueName="Script_2" waitSetting="0" width="124" x="786" y="236">
<inputs val="<inputs><script language="1" script="String osType=&quot;&quot;;&#xD;&#xA;if(xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name=&quot;osType&quot;]}==2)&#xD;&#xA; osType=&quot;Unix&quot;;&#xD;&#xA;else osType=&quot;Unknown&quot;;&#xD;&#xA;String ClientName=xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name=&quot;vmClientname&quot;]};&#xD;&#xA;String ClientHostName=xpath:{/workflow/variables/vmIPAddress};&#xD;&#xA;String CSName=xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name=&quot;csName&quot;]};&#xD;&#xA;String CSHostName=xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name=&quot;csHostName&quot;]};&#xD;&#xA;String CSUserName=xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name=&quot;csUsername&quot;]};&#xD;&#xA;String CSPassword= xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name=&quot;csPassword&quot;]};&#xD;&#xA;String authCode= xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;authCode&quot;]};&#xD;&#xA;String encryptCSPassword = (utils.encryptString(CSPassword)).toString();&#xD;&#xA;Integer vsaProxyOSType = xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;osType&quot;]}; //vsaproxy&#xD;&#xA;//String decodedString = commvault.cte.util.Base64.decode(xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name=&quot;vmPassword&quot;]});&#xD;&#xA;//String decrypted = utils.decryptString(decodedString);&#xD;&#xA;//workflow.setVariable(&quot;vmPassword&quot;,decrypted);&#xD;&#xA;String scriptPrefix = &quot;C:\\Windows\\Temp\\RegistrationScript_&quot;;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;//String XmlInput=&quot;@echo Powershell.exe -executionpolicy remotesigned -File C:\\Windows\\Temp\\CVAutoDeployment\\baseInitScript.ps1&quot;;&#xD;&#xA;String XmlInput=&quot;@echo sudo pwsh /etc/baseInitScript.ps1&quot;;&#xD;&#xA;if(vsaProxyOSType.equals(2)){&#xD;&#xA;scriptPrefix = &quot;/tmp/RegistrationScript_&quot;;&#xD;&#xA;XmlInput=&quot;echo sudo pwsh /etc/baseInitScript.ps1&quot;;&#xD;&#xA;}&#xD;&#xA;&#xD;&#xA;String scriptPath=scriptPrefix+String.valueOf(xpath:{/workflow/system/jobId})+xpath:{/workflow/inputs/vmName}+&quot;.sh&quot;;&#xD;&#xA;String scriptlogPath=scriptPrefix+String.valueOf(xpath:{/workflow/system/jobId})+xpath:{/workflow/inputs/vmName}+&quot;.log&quot;;&#xD;&#xA;String XmlArguments = &quot;&quot;;&#xD;&#xA;XmlArguments+=osType;&#xD;&#xA;XmlArguments+=&quot; &quot;+ClientName;&#xD;&#xA;XmlArguments+=&quot; &quot;+ClientHostName;&#xD;&#xA;XmlArguments+=&quot; &quot;+CSName;&#xD;&#xA;XmlArguments+=&quot; &quot;+CSHostName;&#xD;&#xA;XmlArguments+=&quot; &quot;+CSUserName;&#xD;&#xA;XmlArguments+=&quot; &quot;+encryptCSPassword;&#xD;&#xA;XmlArguments+=&quot; &quot;+xpath:{/workflow/variables/enableFirewall};&#xD;&#xA;XmlArguments+=&quot; NA&quot;; //CSFirewallPort&#xD;&#xA;XmlArguments+=&quot; NA&quot;; //ClientFirewallPort&#xD;&#xA;XmlArguments+=&quot; &quot;+xpath:{/workflow/variables/gatewayHostname};&#xD;&#xA;XmlArguments+=&quot; &quot;+xpath:{/workflow/variables/gatewayClientName};&#xD;&#xA;XmlArguments+=&quot; &quot;+xpath:{/workflow/variables/gatewayPort};&#xD;&#xA;XmlArguments+=&quot; NA&quot;; //httphostname&#xD;&#xA;XmlArguments+=&quot; NA&quot;; //port&#xD;&#xA;if(authCode != null &amp;&amp; authCode.length() &gt; 0){&#xD;&#xA;XmlArguments+=&quot; &quot;+authCode;&#xD;&#xA;}else{&#xD;&#xA;XmlArguments+=&quot; NA&quot;; //authCode&#xD;&#xA;}&#xD;&#xA;XmlArguments+=&quot; NA&quot;; //csplainpassword&#xD;&#xA;&#xD;&#xA;XmlInput+=&quot; &quot;+XmlArguments;&#xD;&#xA;// turn off firewall on unix nodes if there is no FW configured else CS is not able to communicate&#xD;&#xA;if (osType.equalsIgnoreCase(&quot;Unix&quot;))&#xD;&#xA;{&#xD;&#xA;if(vsaProxyOSType.equals(2)){&#xD;&#xA;workflow.setVariable(&quot;firewallStop&quot;,&quot;echo 'sudo systemctl stop firewalld;sudo systemctl disable firewalld'&quot;);&#xD;&#xA;}else{&#xD;&#xA;workflow.setVariable(&quot;firewallStop&quot;,&quot;@echo | set /p c=sudo systemctl stop firewalld;sudo systemctl disable firewalld&quot;);&#xD;&#xA;}&#xD;&#xA; &#xD;&#xA; workflow.setVariable(&quot;scriptPath_FW&quot;,scriptPrefix+String.valueOf(xpath:{/workflow/system/jobId})+xpath:{/workflow/inputs/vmName}+&quot;.fw.sh&quot;);&#xD;&#xA; workflow.setVariable(&quot;scriptLogPath_FW&quot;,scriptPrefix+String.valueOf(xpath:{/workflow/system/jobId})+xpath:{/workflow/inputs/vmName}+&quot;.fw.log&quot;);&#xD;&#xA;}&#xD;&#xA;workflow.setVariable(&quot;scriptPath&quot;,scriptPath);&#xD;&#xA;workflow.setVariable(&quot;scriptlogPath&quot;,scriptlogPath);&#xD;&#xA;workflow.setVariable(&quot;XmlArguments&quot;,XmlArguments);&#xD;&#xA;return XmlInput;&#xD;&#xA;" /></inputs>"/>
<transition activity="WorkflowEnd_1" commented="0"
description="" displayName="Failed
"
originalStyle="" points="" sourceX="614" sourceY="210"
status="2" style="defaultEdge" targetX="971" targetY="415"
transitionIndex="0" x="430" y="29">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
<transition activity="HttpClient_10" commented="0"
description="" displayName="Success" originalStyle=""
points="" sourceX="848" sourceY="253" status="0"
style="defaultEdge" targetX="1105" targetY="73"
transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="1"
created="1585740632850"
description="Execute a script on a remote machine"
displayName="Prepare Installation" height="34" interactive="0"
jobMode="0" maxRestarts="0" name="ExecuteScript"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.ExecuteScript"
uniqueName="ExecuteScript_1" waitSetting="0" width="141"
x="1193" y="86">
<onExit language="1" script="if(xpath:{/workflow/ExecuteScript_1/exitCode}!=0 || xpath:{/workflow/ExecuteScript_1/errorCode}!=0)
 workflow.setVariable("failureMessage","Failed to create batch file");"/>
<inputs val="<inputs><client class="commvault.msgs.CvEntities.ClientEntity" _list_="false">xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="vsaProxy"]}</client><impersonateUserName class="java.lang.String" _list_="false" /><impersonateUserPassword class="workflow.types.EncryptedString" _list_="false" /><startUpPath class="java.lang.String" _list_="false" /><scriptType class="commvault.msgs.App.ScriptType" _list_="false">xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="scriptType"]}</scriptType><script class="java.lang.String" _list_="false">xpath:{/workflow/Script_2/output} &gt; xpath:{/workflow/variables/scriptPath}</script><arguments class="java.lang.String" _list_="false" /><waitForProcessCompletion class="java.lang.Boolean" _list_="false">true</waitForProcessCompletion></inputs>"/>
<transition activity="ExecuteScriptInGuestOS_1" commented="0"
description="" displayName="Succeed" originalStyle=""
points="" sourceX="774" sourceY="180" status="3"
style="defaultEdge" targetX="961" targetY="175"
transitionIndex="0" x="430" y="29">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/ExecuteScript_1/exitCode}==0 && xpath:{/workflow/ExecuteScript_1/errorCode}==0;"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="1"
created="1586175291856"
description="This operation used to execute script on guest os in the provided VM"
displayName="Dock" height="34" interactive="0" jobMode="0"
maxRestarts="5" name="ExecuteScriptInGuestOS"
namespaceUri="commvault.cte.workflow.activities.VMUtilities"
originalStyle="" restartInterval="1" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.VMUtilities.ExecuteScriptInGuestOS"
uniqueName="ExecuteScriptInGuestOS_1" waitSetting="0"
width="170" x="1179" y="153">
<onExit language="1" script="if(xpath:{/workflow/ExecuteScriptInGuestOS_1/errorCode}!=0 || xpath:{/workflow/ExecuteScriptInGuestOS_1/exitCode}!=0)
 workflow.setVariable("failureMessage","Failed to run ");"/>
<inputs val="<inputs><vmClientName class="commvault.msgs.CvEntities.ClientEntity" _list_="false"><clientName class="java.lang.String" _list_="false" /><clientId class="java.lang.Integer" _list_="false" /><clientName class="java.lang.String" _list_="false" /><hostName class="java.lang.String" _list_="false" /><clientGUID class="java.lang.String" _list_="false" /><displayName class="java.lang.String" _list_="false" /><commCellName class="java.lang.String" _list_="false" /><csGUID class="java.lang.String" _list_="false" /><type class="commvault.msgs.CvEntities.CommCellType" _list_="false" /><flags class="commvault.msgs.CvEntities.EntityFlags" _list_="false" /><GUID class="java.lang.String" _list_="false" /><newName class="java.lang.String" _list_="false" /></vmClientName><vmName class="java.lang.String" _list_="false">xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmName"]}</vmName><vmGUID class="java.lang.String" _list_="false">xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmGUID"]}</vmGUID><virtualizationClient class="commvault.msgs.CvEntities.ClientEntity" _list_="false">xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="hypervisorName"]}</virtualizationClient><isUNCPath class="java.lang.Boolean" _list_="false">false</isUNCPath><scriptPath class="java.lang.String" _list_="false">xpath:{/workflow/variables/scriptPath}</scriptPath><scriptLog class="java.lang.String" _list_="false">xpath:{/workflow/variables/scriptlogPath}</scriptLog><uncPathUserName class="java.lang.String" _list_="false" /><uncPathPassword class="workflow.types.EncryptedString" _list_="false" /><guestOSUserName class="java.lang.String" _list_="false">xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmUsername"]}</guestOSUserName><guestOSPassword class="workflow.types.EncryptedString" _list_="false">xpath:{/workflow/variables/vmPassword}</guestOSPassword><vsaProxyClient class="commvault.msgs.CvEntities.ClientEntity" _list_="false">xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="vsaProxy"]}</vsaProxyClient><timeOutInSeconds class="java.lang.Integer" _list_="false">480</timeOutInSeconds><sessionOptions class="workflow.types.cmd.SessionOptions" _list_="false"><useImpersonatedAccount class="java.lang.Boolean" _list_="false">true</useImpersonatedAccount><tokenFile class="java.lang.String" _list_="false" /><token class="java.lang.String" _list_="false" /></sessionOptions></inputs>"/>
<transition activity="XPathQuery_26" commented="0"
description="" originalStyle="" points="" sourceX="1241"
sourceY="199" status="0" style="defaultEdge" targetX="1242"
targetY="265" transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="1"
created="1395163955278"
description="Sends an email to a list of users"
displayName="Email" height="34" interactive="0" jobMode="0"
maxRestarts="0" name="Email"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0" style="label;image=Email"
uniqueName="Email_2" waitSetting="0" width="100" x="1013" y="340">
<inputs val="<inputs><email class="workflow.types.Email"><to class="java.lang.String">xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="emailId"]}</to><cc class="java.lang.String" /><bcc class="java.lang.String" /><from class="java.lang.String" /><subject class="java.lang.String">Auto-docking of VM xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmName"]} is failed</subject><body class="java.lang.String"> &#xD;
Failed to register VM xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmName"]} to CommServe. &#xD;
&#xD;
</body><attachments class="java.lang.Object" /><html class="java.lang.Boolean">false</html><repeatInterval /></email></inputs>"/>
<transition activity="WorkflowEnd_1" commented="0"
description="" originalStyle="" points="" sourceX="970"
sourceY="299" status="0" style="defaultEdge" targetX="971"
targetY="359" transitionIndex="0" x="430" y="29">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1586246288964" description="Ends the workflow"
displayName="Failed" height="34" interactive="0" jobMode="0"
name="WorkflowEnd"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.EndActivity"
uniqueName="WorkflowEnd_1" waitSetting="0" width="106" x="761" y="342">
<inputs val="<inputs><completionStatus class="workflow.types.WorkflowCompletionStatus" _list_="false">FAILED</completionStatus><failureMessage class="java.lang.String" _list_="false">xpath:{/workflow/variables/failureMessage}</failureMessage></inputs>"/>
</Activity>
<Activity commented="0" continueOnFailure="1"
created="1586254063523"
description="Sends an email to a list of users"
displayName="Email" height="34" interactive="0" jobMode="0"
maxRestarts="0" name="Email"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0" style="label;image=Email"
uniqueName="Email_3" waitSetting="0" width="100" x="1651" y="344">
<inputs val="<inputs><email class="workflow.types.Email"><to class="java.lang.String">xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="emailId"]}</to><cc class="java.lang.String" /><bcc class="java.lang.String" /><from class="java.lang.String" /><subject class="java.lang.String">Auto-docking of VM xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmName"]} is succeed</subject><body class="java.lang.String"> xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmName"]} VM registration is successful. Client is ready to use. </body><attachments class="java.lang.Object" /><html class="java.lang.Boolean">false</html><repeatInterval /></email></inputs>"/>
<transition activity="WorkflowEnd_2" commented="0"
description="" originalStyle="" points="" sourceX="1437"
sourceY="198" status="0" style="defaultEdge" targetX="1465"
targetY="300" transitionIndex="0" x="430" y="29">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1586254238656" description="Ends the workflow"
displayName="Complete" height="34" interactive="0" jobMode="0"
name="WorkflowEnd"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.EndActivity"
uniqueName="WorkflowEnd_2" waitSetting="0" width="106" x="1651" y="439">
<outputs outputs="<outputs><clientId class="java.lang.String" _list_="false">xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmClientId"]}</clientId><clientName class="java.lang.String" _list_="false">xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmClientname"]}</clientName></outputs>"/>
<inputs val="<inputs><completionStatus class="workflow.types.WorkflowCompletionStatus" _list_="false">COMPLETED</completionStatus><failureMessage class="java.lang.String" _list_="false">"VM registration sucessfull"</failureMessage></inputs>"/>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1586283381871"
description="This operation used to refresh the VM details/discover the VM"
displayName="Synchronize" height="34" interactive="0"
jobMode="0" name="Synchronize"
namespaceUri="commvault.cte.workflow.activities.VMUtilities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.VMUtilities.Synchronize"
uniqueName="Synchronize_1" waitSetting="0" width="100" x="487" y="148">
<inputs val="<inputs><vmClientName class="commvault.msgs.CvEntities.ClientEntity" _list_="false"><clientName class="java.lang.String" _list_="false" /><clientId class="java.lang.Integer" _list_="false" /><clientName class="java.lang.String" _list_="false" /><hostName class="java.lang.String" _list_="false" /><clientGUID class="java.lang.String" _list_="false" /><displayName class="java.lang.String" _list_="false" /><commCellName class="java.lang.String" _list_="false" /><csGUID class="java.lang.String" _list_="false" /><type class="commvault.msgs.CvEntities.CommCellType" _list_="false" /><flags class="commvault.msgs.CvEntities.EntityFlags" _list_="false" /><GUID class="java.lang.String" _list_="false" /><newName class="java.lang.String" _list_="false" /></vmClientName><vmName class="java.lang.String" _list_="false">xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmName"]}</vmName><vmGUID class="java.lang.String" _list_="false">xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmGUID"]}</vmGUID><virtualizationClient class="commvault.msgs.CvEntities.ClientEntity" _list_="false">xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="hypervisorName"]}</virtualizationClient><sessionOptions class="workflow.types.cmd.SessionOptions" _list_="false"><useImpersonatedAccount class="java.lang.Boolean" _list_="false">true</useImpersonatedAccount><tokenFile class="java.lang.String" _list_="false" /><token class="java.lang.String" _list_="false" /></sessionOptions></inputs>"/>
<transition activity="CommServDBQuery_2" commented="0"
description="" originalStyle="" points="" sourceX="580"
sourceY="75" status="0" style="defaultEdge" targetX="756"
targetY="76" transitionIndex="0" x="430" y="29">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1586283465035"
description="executes queries against a commcell database"
displayName="Collecting IP" height="34" interactive="0"
jobMode="0" name="CommServDBQuery"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.CommServDBQuery"
uniqueName="CommServDBQuery_2" waitSetting="0" width="149"
x="567" y="56">
<onExit language="1" script="if(xpath:{/workflow/CommServDBQuery_2/resultSets/row/col[@name="vmIP"]}!=null && xpath:{/workflow/CommServDBQuery_2/resultSets/row/col[@name="vmIP"]}.length() > 0){
 workflow.setVariable("vmIPAddress",xpath:{/workflow/CommServDBQuery_2/resultSets/row/col[@name="vmIP"]});
 workflow.setVariable("vmSyncCount",0);
}else{
 int vmSyncCount = xpath:{/workflow/variables/vmSyncCount};
 vmSyncCount = vmSyncCount-1;
 workflow.setVariable("vmSyncCount",vmSyncCount);
}
 
 "/>
<inputs val="<inputs><commCell /><query>set nocount on&#xD;
declare @vmGUID nvarchar(256) = 'xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmGUID"]}'&#xD;
declare @vmIP nvarchar(256)&#xD;
declare @vmClientId int&#xD;
select &#xD;
	 @vmIP = vmIp.value('@ipAddress','nvarchar(1024)') ,&#xD;
	 @vmClientId = vm.clientId&#xD;
	 from APP_VM vm inner join APP_VMHost vmh on vmh.id=vm.vHostId&#xD;
	 inner join app_client cl on cl.id=vm.clientId&#xD;
	 CROSS APPLY vm.vxml.nodes('/QSMServer_QVirtualMachineReq') as vmIp(vmIp) &#xD;
	 where vm.GUID=@vmGUID &#xD;
IF LEN(@vmIP) &gt; 15 --IPv4 max len is 15&#xD;
BEGIN &#xD;
 SET @vmIP = ''&#xD;
END&#xD;
ELSE IF ISNULL(@vmIP,'') !='' AND LEN(@vmIP) &gt; 0&#xD;
BEGIN&#xD;
 update app_client set net_hostname = @vmIP where id = @vmClientId&#xD;
END&#xD;
 &#xD;
 select @vmIP as 'vmIP'&#xD;
 &#xD;
 set nocount off&#xD;
	&#xD;
	&#xD;
	&#xD;
	&#xD;
	&#xD;
	&#xD;
	&#xD;
	&#xD;
	&#xD;
	&#xD;
	&#xD;
	&#xD;
	&#xD;
	&#xD;
	&#xD;
	</query></inputs>"/>
<transition activity="Script_2" commented="0" description=""
originalStyle="" points="" sourceX="649" sourceY="47"
status="0" style="defaultEdge" targetX="789" targetY="79"
transitionIndex="0" x="430" y="29">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/variables/vmSyncCount}==0;"/>
</transition>
<transition activity="Delay_1" commented="0" description=""
originalStyle=""
points="657.8947368421053,173.6842105263158" sourceX="641"
sourceY="73" status="0" style="defaultEdge" targetX="547"
targetY="256" transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/variables/vmSyncCount}>0;"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1586284477374"
description="activity to delay the workflow execution in minutes"
displayName="Delay" height="34" interactive="0" jobMode="0"
name="Delay" namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.DelayActivity"
uniqueName="Delay_1" waitSetting="0" width="100" x="474" y="237">
<inputs val="<inputs><delayLength class="java.lang.Integer" _list_="false">1</delayLength><delayInterval class="workflow.types.DelayInterval" _list_="false">Minutes</delayInterval></inputs>"/>
<transition activity="Synchronize_1" commented="0"
description="" originalStyle="" points="" sourceX="536"
sourceY="132" status="0" style="defaultEdge" targetX="553"
targetY="84" transitionIndex="0" x="430" y="29">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1587808211321"
description="executes queries against a commcell database"
displayName="Prepare VM Creation" height="34" interactive="0"
jobMode="0" name="CommServDBQuery"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.CommServDBQuery"
uniqueName="CommServDBQuery_3" waitSetting="0" width="149"
x="70" y="71">
<onExit language="1" script="if(xpath:{/workflow/CommServDBQuery_3/resultSets/row[1]/col[@name="errorCode"]}!=0){
 if(xpath:{/workflow/CommServDBQuery_3/resultSets/row[1]/col[@name="errorMessage"]}!=null && xpath:{/workflow/CommServDBQuery_3/resultSets/row[1]/col[@name="errorMessage"]}.length() > 0){
 workflow.setVariable("failureMessage",xpath:{/workflow/CommServDBQuery_3/resultSets/row[1]/col[@name="errorMessage"]});
 }else{
 workflow.setVariable("failureMessage","Failed to submit VM creation, please check log for more details");
 }
}"/>
<inputs val="<inputs><commCell /><query>set nocount on&#xD;
&#xD;
&#xD;
--input&#xD;
declare @errorMessage nvarchar(1024)&#xD;
declare @errorCode int =0&#xD;
declare @hypevisorName nvarchar(max)= isnull('xpath:{/workflow/inputs/hypervisorName}','')&#xD;
declare @dataCenterName nvarchar(max)= isnull('xpath:{/workflow/inputs/dataCenterName}','xpath:{/workflow/variables/dataCenterName}')&#xD;
declare @resoucePool nvarchar(max)= isnull('xpath:{/workflow/inputs/resourcePool}','xpath:{/workflow/variables/resourcePool}')&#xD;
declare @hostName nvarchar(1024) = isnull('xpath:{/workflow/inputs/vmHost}','xpath:{/workflow/variables/vmHost}')&#xD;
declare @networkName nvarchar(1024) = isnull('xpath:{/workflow/inputs/vmNetwork}','xpath:{/workflow/variables/vmNetwork}')&#xD;
declare @dataStore nvarchar(1024) = isnull('xpath:{/workflow/inputs/dataStore}','xpath:{/workflow/variables/dataStore}')&#xD;
declare @vmName nvarchar(1024) = isnull('xpath:{/workflow/inputs/vmName}','AutoDemo')&#xD;
declare @emailId nvarchar(1024)= (select email from umusers where id =xpath:{/workflow/system/executor/userId})&#xD;
declare @companyId int = isnull((select top 1 id from UMDSProviders where hostName='xpath:{/workflow/inputs/companyName}') , 0)&#xD;
&#xD;
IF @dataCenterName = ''&#xD;
 SET @dataCenterName = 'xpath:{/workflow/variables/dataCenterName}'&#xD;
IF @resoucePool = ''&#xD;
 SET @resoucePool = 'xpath:{/workflow/variables/resourcePool}'&#xD;
IF @hostName = ''&#xD;
 SET @hostName = 'xpath:{/workflow/variables/vmHost}'&#xD;
IF @networkName = ''&#xD;
 SET @networkName = 'xpath:{/workflow/variables/vmNetwork}'&#xD;
IF @dataStore = ''&#xD;
 SET @dataStore = 'xpath:{/workflow/variables/dataStore}' &#xD;
--output&#xD;
declare @username nvarchar(max)&#xD;
declare @password nvarchar(max)&#xD;
declare @vcentername nvarchar(max)&#xD;
declare @vsaproxyClient nvarchar(max)&#xD;
declare @vsaproxyClientId int&#xD;
declare @osType int&#xD;
declare @hypervisorClientId int&#xD;
declare @authCode nvarchar(max)&#xD;
declare @ovfToolPath nvarchar(max)&#xD;
declare @scripType nvarchar(max)&#xD;
&#xD;
 --intermediate&#xD;
 declare @instanceId int &#xD;
 &#xD;
if isnull(@hypevisorName,'') = ''&#xD;
begin&#xD;
	set @errorCode = -1&#xD;
	set @errorMessage = 'Provide valid vcenter/hypervisor name'&#xD;
	goto ERROR_EXIT&#xD;
end&#xD;
select @instanceId =app.instance, @hypervisorClientId = c.id from app_client c inner join app_application app on app.clientId=c.id and apptypeid=106 where c.name =@hypevisorName&#xD;
&#xD;
--if client name doens't match get from the vcentername&#xD;
if isnull(@instanceId,0) = 0&#xD;
select @instanceId = componentnameId from app_instanceprop where attrval = @hypevisorName and attrname='Virtual Server Host'&#xD;
&#xD;
if isnull(@instanceId,0) = 0&#xD;
begin&#xD;
	set @errorCode = -1&#xD;
	set @errorMessage = 'Provide valid vcenter/hypervisor name'&#xD;
	goto ERROR_EXIT&#xD;
end&#xD;
select @vcentername = attrval from app_instanceprop where componentnameId = @instanceId and attrname='Virtual Server Host'&#xD;
&#xD;
select @username = attrval from app_instanceprop where componentnameId = @instanceId and attrname='Virtual Server User'&#xD;
&#xD;
select @password = attrval from app_instanceprop where componentnameId = @instanceId and attrname='Virtual Server Password'&#xD;
&#xD;
&#xD;
select @authCode = cast(cpp.attrVal as nvarchar(max)) from App_CompanyProp cpp	&#xD;
		where&#xD;
		 cpp.componentNameId = @companyId&#xD;
		and cpp.attrName = 'Authorization Code'&#xD;
		and cpp.modified = 0&#xD;
&#xD;
&#xD;
CREATE TABLE #tmpTable&#xD;
	(&#xD;
		OutputValue XML&#xD;
	)&#xD;
	declare @inputxml xml&#xD;
&#xD;
	declare @output xml&#xD;
 SET @inputxml = '&lt;App_GetVSMemberServersRequest expandClientGroup="1"&gt;&lt;entity _type_="5" instanceId="' + convert(varchar(10),@instanceId) + '"/&gt;&lt;/App_GetVSMemberServersRequest&gt;'&#xD;
&#xD;
 INSERT INTO #tmpTable(OutputValue) &#xD;
 EXEC AppGetVSMemberServers @inputxml&#xD;
 &#xD;
 SELECT @output = OutputValue FROM #tmpTable&#xD;
 DROP TABLE #tmpTable&#xD;
 select @vsaproxyClient = g.x.value('@clientName','nvarchar(max)') , @vsaproxyClientId = g.x.value('@clientId','nvarchar(max)') from @output.nodes('/App_GetVSMemberServersResponse/associatedClients/memberServers[1]/client[1]') g(x)&#xD;
 SET @osType = isnull((select 1 from simInstalledPackages where clientId=@vsaproxyClientId and simPackageId = 713),2)&#xD;
&#xD;
	IF @osType = 1 --Windows&#xD;
	BEGIN&#xD;
		SET @scripType		= 'WindowsBatch'&#xD;
		SET @ovfToolPath	= 'xpath:{/workflow/variables/ovftoolpath}'&#xD;
	END&#xD;
	ELSE&#xD;
	BEGIN&#xD;
		SET @scripType = 'UnixShell'&#xD;
		SET @ovfToolPath	= 'xpath:{/workflow/variables/unixOvfPath}'&#xD;
	END&#xD;
&#xD;
&#xD;
ERROR_EXIT:&#xD;
select @errorCode 'errorCode' , @errorMessage 'errorMessage', @hostName 'hostName', @networkName 'networkName',&#xD;
 @vmName 'vmName', @instanceId 'instanceId', @vcentername 'vcentername', @username 'username',&#xD;
 @password 'password', @hypevisorName 'hypervisorName', @hypervisorClientId 'hypervisorClientId' , &#xD;
 @vsaProxyClient 'vsaProxy', @vsaproxyClientId 'vsaproxyClientId', @dataCenterName 'dataCenterName' , &#xD;
 @dataStore 'dataStore', @resoucePool 'resourcePool', @authCode 'authCode', @companyId 'companyId',&#xD;
 @scripType 'scriptType', @ovfToolPath 'ovfToolPath', @osType 'osType'&#xD;
&#xD;
set nocount off&#xD;
	</query></inputs>"/>
<transition activity="Email_4" commented="0" description=""
displayName="Error" originalStyle="" points="" sourceX="165"
sourceY="89" status="0" style="defaultEdge" targetX="331"
targetY="177" transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/CommServDBQuery_3/resultSets/row[1]/col[@name="errorCode"]}!=0;"/>
</transition>
<transition activity="Execute_2" commented="0" description=""
originalStyle="" points="" sourceX="167" sourceY="106"
status="0" style="defaultEdge" targetX="167" targetY="149"
transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/CommServDBQuery_3/resultSets/row[1]/col[@name="errorCode"]}==0;"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="1"
created="1587815438108"
description="Sends an email to a list of users"
displayName="Email" height="34" interactive="0" jobMode="0"
maxRestarts="0" name="Email"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0" style="label;image=Email"
uniqueName="Email_4" waitSetting="0" width="100" x="316" y="94">
<inputs val="<inputs><email class="workflow.types.Email"><to class="java.lang.String">xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="emailId"]}</to><cc class="java.lang.String" /><bcc class="java.lang.String" /><from class="java.lang.String" /><subject class="java.lang.String">VM [xpath:{/workflow/inputs/vmName}] creation is failed</subject><body class="java.lang.String"> &#xD;
VM creation failed with error : xpath:{/workflow/variables/failureMessage}&#xD;
</body><attachments class="java.lang.Object" /><html class="java.lang.Boolean">false</html><repeatInterval /></email></inputs>"/>
<transition activity="WorkflowEnd_3" commented="0"
description="" originalStyle="" points="" sourceX="331"
sourceY="177" status="0" style="defaultEdge" targetX="329"
targetY="269" transitionIndex="0" x="0" y="0">
<condition script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1587815453959" description="Ends the workflow"
displayName="Failed" height="34" interactive="0" jobMode="0"
name="WorkflowEnd"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.EndActivity"
uniqueName="WorkflowEnd_3" waitSetting="0" width="106" x="326" y="203">
<inputs val="<inputs><completionStatus class="workflow.types.WorkflowCompletionStatus" _list_="false">FAILED</completionStatus><failureMessage class="java.lang.String" _list_="false">xpath:{/workflow/variables/failureMessage}</failureMessage></inputs>"/>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1587878485443"
description="activity to execute code snippets in the selected language"
displayName="Prepare OVA Download" height="34" interactive="0"
jobMode="0" name="Script"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.ScriptActivity"
uniqueName="Script_3" waitSetting="0" width="163" x="71" y="190">
<inputs val="<inputs><script language="1" script="&#xD;&#xA;String vCenterName = xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;vcentername&quot;]};&#xD;&#xA;String vCenterUserName= xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;username&quot;]};&#xD;&#xA;&#xD;&#xA;String vCenterPassword = utils.decryptString(xpath:{/workflow/CommServDBQuery_5/resultSets/row/col});&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;String vmName= xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;vmName&quot;]};&#xD;&#xA;String dataStore= xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;dataStore&quot;]};&#xD;&#xA;String hostName= xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;hostName&quot;]};&#xD;&#xA;String dataCenterName= xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;dataCenterName&quot;]};&#xD;&#xA;String resourcePool= xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;resourcePool&quot;]};&#xD;&#xA;String networkName= xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;networkName&quot;]};&#xD;&#xA;&#xD;&#xA;String ovaPath= xpath:{/workflow/inputs/ovaPath};&#xD;&#xA;&#xD;&#xA;if(ovaPath == null || ovaPath.length() == 0){&#xD;&#xA; if(xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;osType&quot;]}!=null &amp;&amp; xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;osType&quot;]} ==1){&#xD;&#xA; ovaPath = xpath:{/workflow/variables/ovaPath};&#xD;&#xA; }else{&#xD;&#xA; ovaPath = xpath:{/workflow/variables/ovaUnixPath};&#xD;&#xA; }&#xD;&#xA;}&#xD;&#xA;&#xD;&#xA;//ovftool --acceptAllEulas --noSSLVerify --acceptAllEulas --diskMode=thin --powerOn --name=&quot;autodemo1&quot; --datastore=&quot;ESX02-DS02&quot; &quot;F:\Projects\RAX\OVA\commvaultvsa.ova&quot; &quot;vi://username:[email protected]/BLRVA/host/bdcvsaesx02.idcprodcert.loc/Resources/Compute-ResourcePool/&quot;&#xD;&#xA;&#xD;&#xA;String ovfpath = &quot;\&quot;&quot;+xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;ovfToolPath&quot;]}+&quot;\&quot;&quot;;&#xD;&#xA;String command = ovfpath + &quot; --acceptAllEulas --noSSLVerify --acceptAllEulas --diskMode=thin --powerOn --X:waitForIp --name=\&quot;&quot;+vmName+&quot;\&quot; --network=\&quot;&quot;+networkName+&quot;\&quot;&quot;;&#xD;&#xA;command +=&quot; --datastore=\&quot;&quot;+dataStore+&quot;\&quot; \&quot;&quot;+ovaPath+&quot;\&quot; \&quot;vi://&quot;+vCenterUserName+&quot;:&quot;+vCenterPassword+&quot;@&quot;+vCenterName+&quot;/&quot;+dataCenterName+&quot;/host/&quot;+hostName+&quot;/Resources/&quot;+resourcePool+&quot;/\&quot;&quot;;&#xD;&#xA;&#xD;&#xA;//logger.info(&quot;command&quot;+command);&#xD;&#xA;&#xD;&#xA;return command;&#xD;&#xA;&#xD;&#xA;//workflow.setVariable(&quot;vmPassword&quot;,decodedString);" /></inputs>"/>
<transition activity="ExecuteScript_3" commented="0"
description="" originalStyle="" points="" sourceX="152"
sourceY="207" status="0" style="defaultEdge" targetX="226"
targetY="270" transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
(xpath:{/workflow/inputs/contentLibrary}==null || xpath:{/workflow/inputs/contentLibrary}.isEmpty());"/>
</transition>
<transition activity="EnableLogging_1" commented="0"
description="" originalStyle="" points="32.0,205.0"
sourceX="152" sourceY="207" status="0" style="defaultEdge"
targetX="126" targetY="258" transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
(xpath:{/workflow/inputs/contentLibrary}!=null && !xpath:{/workflow/inputs/contentLibrary}.isEmpty());"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1587912570653"
description="retrieves a list of values from xml"
displayName="Get ErrorMessage" height="34" interactive="0"
jobMode="0" name="XPathQuery"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0" style="label;image=XPathQuery"
uniqueName="XPathQuery_25" waitSetting="0" width="133" x="1255" y="276">
<onExit language="1" script="if(xpath:{/workflow/XPathQuery_26/result}!=0){
 if(xpath:{/workflow/XPathQuery_25/result}!=null && xpath:{/workflow/XPathQuery_25/result}.length() > 0){
 workflow.setVariable("failureMessage",xpath:{/workflow/XPathQuery_25/result});
 }else{
 workflow.setVariable("failureMessage","Failed to register client to commserve at guest os");
 }
}
"/>
<inputs val="<inputs><xml class="java.lang.String">xpath:{/workflow/ExecuteScriptInGuestOS_1/commandOutput}</xml><xpath class="java.lang.String">/TMMsg_GenericResp/errorMessage</xpath><outputType class="workflow.types.SimpleType">String</outputType><outputAsList class="java.lang.Boolean">false</outputAsList></inputs>"/>
<transition activity="ExecuteScript_6" commented="0"
description="" displayName="Success & Unix"
originalStyle="" points="" sourceX="1274" sourceY="351"
status="0" style="defaultEdge" targetX="1491" targetY="133"
transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/ExecuteScriptInGuestOS_1/exitCode}==0 && xpath:{/workflow/XPathQuery_26/result}==0 && xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="osType"]}==2 && xpath:{/workflow/variables/enableFirewall}.equals("False");
"/>
</transition>
<transition activity="Email_3" commented="0" description=""
displayName="Success & Wndows" originalStyle=""
points="" sourceX="1248" sourceY="356" status="0"
style="defaultEdge" targetX="1430" targetY="194"
transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/ExecuteScriptInGuestOS_1/exitCode}==0 && xpath:{/workflow/XPathQuery_26/result}==0 && xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="osType"]}!=2;"/>
</transition>
<transition activity="Email_2" commented="0" description=""
displayName="Failed " originalStyle="" points=""
sourceX="934" sourceY="68" status="0" style="defaultEdge"
targetX="1018" targetY="204" transitionIndex="0" x="430" y="29">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/ExecuteScriptInGuestOS_1/exitCode}!=0 || xpath:{/workflow/XPathQuery_26/result}!=0;"/>
</transition>
<transition activity="CommServDBQuery_6" commented="0"
description="" displayName="Success & Firewall Enabled"
originalStyle="" points="" sourceX="1330" sourceY="308"
status="0" style="defaultEdge" targetX="1318" targetY="400"
transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/ExecuteScriptInGuestOS_1/exitCode}==0 && xpath:{/workflow/XPathQuery_26/result}==0 && xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="osType"]}==2 && !xpath:{/workflow/variables/enableFirewall}.equals("False");
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1587913303089"
description="retrieves a list of values from xml"
displayName="Get ErrorCode" height="34" interactive="0"
jobMode="0" name="XPathQuery"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0" style="label;image=XPathQuery"
uniqueName="XPathQuery_26" waitSetting="0" width="133" x="1201" y="219">
<inputs val="<inputs><xml class="java.lang.String">xpath:{/workflow/ExecuteScriptInGuestOS_1/commandOutput}</xml><xpath class="java.lang.String">/TMMsg_GenericResp/errorCode</xpath><outputType class="workflow.types.SimpleType">Integer</outputType><outputAsList class="java.lang.Boolean">false</outputAsList></inputs>"/>
<transition activity="XPathQuery_25" commented="0"
description="" originalStyle="" points="" sourceX="1241"
sourceY="276" status="0" style="defaultEdge" targetX="1247"
targetY="362" transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1589966327472"
description="Execute a script on a remote machine"
displayName="Upload OVA" height="34" interactive="0" jobMode="0"
name="ExecuteScript"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.ExecuteScript"
uniqueName="ExecuteScript_3" waitSetting="0" width="110" x="179" y="251">
<onExit language="1" script="if(xpath:{/workflow/ExecuteScript_3/exitCode}!=0 || xpath:{/workflow/ExecuteScript_3/errorCode}!=0){
 if(xpath:{/workflow/ExecuteScript_3/commandOutput}!=null && xpath:{/workflow/ExecuteScript_3/commandOutput}.length() > 0){
 workflow.setVariable("failureMessage",xpath:{/workflow/ExecuteScript_3/commandOutput});
 }else{
 workflow.setVariable("failureMessage","Failed to submit VM creation, please check log for more details");
 }
}"/>
<inputs val="<inputs><client class="commvault.msgs.CvEntities.ClientEntity" _list_="false">xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="vsaProxy"]}</client><impersonateUserName class="java.lang.String" _list_="false" /><impersonateUserPassword class="workflow.types.EncryptedString" _list_="false" /><startUpPath class="java.lang.String" _list_="false" /><scriptType class="commvault.msgs.App.ScriptType" _list_="false">xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="scriptType"]}</scriptType><script class="java.lang.String" _list_="false">xpath:{/workflow/Script_3/output}</script><arguments class="java.lang.String" _list_="false" /><waitForProcessCompletion class="java.lang.Boolean" _list_="false">true</waitForProcessCompletion></inputs>"/>
<transition activity="EnableLogging_2" commented="0"
description="" originalStyle="" points="" sourceX="234"
sourceY="268" status="0" style="defaultEdge" targetX="244"
targetY="317" transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1589975859302"
description="activity to execute code snippets in the selected language"
displayName="Prepare Preview Req" height="34" interactive="0"
jobMode="0" name="Script"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.ScriptActivity"
uniqueName="Script_4" waitSetting="0" width="150" x="27" y="337">
<inputs val="<inputs><script language="1" script="String vmName= xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;vmName&quot;]};&#xD;&#xA;int hypervisorClientId= xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;hypervisorClientId&quot;]};&#xD;&#xA;String hypervisorName= xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;hypervisorName&quot;]};&#xD;&#xA;int instanceId= xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;instanceId&quot;]};&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;String previewInv= &quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;UTF-8\&quot; standalone=\&quot;no\&quot; ?&gt;&lt;EVGui_PreviewInventoryReq createClientsForDiscoveredVms=\&quot;0\&quot; previewInventoryRespType=\&quot;0\&quot;&gt;&quot;&#xD;&#xA; + &quot;&lt;appId applicationName=\&quot;Virtual Server\&quot; apptypeId=\&quot;106\&quot; clientId=\&quot;&quot;+hypervisorClientId+&quot;\&quot; clientName=\&quot;&quot;+hypervisorName+&quot;\&quot; instanceId=\&quot;&quot;+instanceId+&quot;\&quot; instanceName=\&quot;VMware\&quot;/&gt;&quot;&#xD;&#xA; + &quot;&lt;contentEntity allOrAnyChildren=\&quot;0\&quot;&gt;&quot;&#xD;&#xA; + &quot;&lt;children allOrAnyChildren=\&quot;1\&quot; displayName=\&quot;&quot;+vmName+&quot;\&quot; equalsOrNotEquals=\&quot;1\&quot; name=\&quot;\&quot; path=\&quot;\&quot; type=\&quot;10\&quot;/&gt;&quot;&#xD;&#xA; + &quot;&lt;/contentEntity&gt;&lt;filterEntity allOrAnyChildren=\&quot;0\&quot;/&gt;&lt;/EVGui_PreviewInventoryReq&gt;&quot;;&#xD;&#xA;return previewInv;" /></inputs>"/>
<transition activity="Execute_1" commented="0" description=""
originalStyle="" points="" sourceX="164" sourceY="325"
status="0" style="defaultEdge" targetX="163" targetY="389"
transitionIndex="0" x="0" y="0">
<condition script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1589976179353" description="" displayName="Preview VM"
height="34" interactive="0" jobMode="0" name="Execute"
namespaceUri="commvault.cte.workflow.activities.cmd.operation"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.cmd.operation.OperationExecute"
uniqueName="Execute_1" waitSetting="0" width="100" x="106" y="402">
<inputs val="<inputs><inputXml class="java.lang.String" _list_="false">xpath:{/workflow/Script_4/output}</inputXml><escapeXml class="java.lang.Boolean" _list_="false">false</escapeXml><commandArgs class="java.lang.String" _list_="false" /><sessionOptions class="workflow.types.cmd.SessionOptions" _list_="false"><useImpersonatedAccount class="java.lang.Boolean" _list_="false">true</useImpersonatedAccount><tokenFile class="java.lang.String" _list_="false" /><token class="java.lang.String" _list_="false" /></sessionOptions></inputs>"/>
<transition activity="Script_5" commented="0" description=""
originalStyle="" points="" sourceX="156" sourceY="419"
status="0" style="defaultEdge" targetX="153" targetY="471"
transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1589976296696"
description="retrieves a list of values from xml"
displayName="Get VM GUID" height="34" interactive="0"
jobMode="0" name="XPathQuery"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.XMLQueryActivity"
uniqueName="XPathQuery_27" waitSetting="0" width="100" x="316" y="324">
<onExit language="1" script=" if(xpath:{/workflow/XPathQuery_27/result}==null && xpath:{/workflow/XPathQuery_27/result}.length() == 0){
 workflow.setVariable("failureMessage","Failed to find the deployed VM");
 }
"/>
<inputs val="<inputs><xml class="java.lang.String" _list_="false">xpath:{/workflow/Execute_1/commandOutput}</xml><xpath class="java.lang.String" _list_="false">/EVGui_VirtualGuestHostList/scList/guid</xpath><outputType class="workflow.types.SimpleType" _list_="false">String</outputType><outputAsList class="java.lang.Boolean" _list_="false">false</outputAsList></inputs>"/>
<transition activity="WorkflowEnd_3" commented="0"
description="" displayName="Failed" originalStyle=""
points="" sourceX="313" sourceY="388" status="0"
style="defaultEdge" targetX="354" targetY="241"
transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/XPathQuery_27/result}==null && xpath:{/workflow/XPathQuery_27/result}.length() == 0;"/>
</transition>
<transition activity="Synchronize_2" commented="0"
description="" originalStyle="" points="" sourceX="366"
sourceY="307" status="0" style="defaultEdge" targetX="368"
targetY="398" transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/XPathQuery_27/result}!=null && xpath:{/workflow/XPathQuery_27/result}.length() > 0;"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1589976820664"
description="This operation used to refresh the VM details/discover the VM"
displayName="Synchronize" height="34" interactive="0"
jobMode="0" maxRestarts="5" name="Synchronize"
namespaceUri="commvault.cte.workflow.activities.VMUtilities"
originalStyle="" restartInterval="1" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.VMUtilities.Synchronize"
uniqueName="Synchronize_2" waitSetting="0" width="100" x="318" y="381">
<inputs val="<inputs><vmClientName class="commvault.msgs.CvEntities.ClientEntity" _list_="false"><clientName class="java.lang.String" _list_="false" /><clientId class="java.lang.Integer" _list_="false" /><clientName class="java.lang.String" _list_="false" /><hostName class="java.lang.String" _list_="false" /><clientGUID class="java.lang.String" _list_="false" /><displayName class="java.lang.String" _list_="false" /><commCellName class="java.lang.String" _list_="false" /><csGUID class="java.lang.String" _list_="false" /><type class="commvault.msgs.CvEntities.CommCellType" _list_="false" /><flags class="commvault.msgs.CvEntities.EntityFlags" _list_="false" /><GUID class="java.lang.String" _list_="false" /><newName class="java.lang.String" _list_="false" /></vmClientName><vmName class="java.lang.String" _list_="false">xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="vmName"]}</vmName><vmGUID class="java.lang.String" _list_="false">xpath:{/workflow/XPathQuery_27/result}</vmGUID><virtualizationClient class="commvault.msgs.CvEntities.ClientEntity" _list_="false">xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="hypervisorName"]}</virtualizationClient><sessionOptions class="workflow.types.cmd.SessionOptions" _list_="false"><useImpersonatedAccount class="java.lang.Boolean" _list_="false">true</useImpersonatedAccount><tokenFile class="java.lang.String" _list_="false" /><token class="java.lang.String" _list_="false" /></sessionOptions></inputs>"/>
<transition activity="PowerOn_1" commented="0" description=""
originalStyle="" points="" sourceX="368" sourceY="398"
status="0" style="defaultEdge" targetX="366" targetY="461"
transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
(xpath:{/workflow/inputs/contentLibrary}!=null && !xpath:{/workflow/inputs/contentLibrary}.isEmpty());"/>
</transition>
<transition activity="CommServDBQuery_4" commented="0"
description="" originalStyle="" points="" sourceX="368"
sourceY="398" status="0" style="defaultEdge" targetX="481"
targetY="412" transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
(xpath:{/workflow/inputs/contentLibrary}==null || xpath:{/workflow/inputs/contentLibrary}.isEmpty());"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="1"
created="1590140924290" description=""
displayName="Assign VM To CG" height="34" interactive="0"
jobMode="0" maxRestarts="0" name="ClientGroup"
namespaceUri="commvault.cte.workflow.activities.cmd.modify"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.cmd.modify.ModifyClientGroup"
uniqueName="ClientGroup_1" waitSetting="0" width="129" x="790" y="52">
<inputs val="<inputs><operation class="workflow.types.cmd.AddDelete" _list_="false">add</operation><client class="commvault.msgs.CvEntities.ClientEntity" _list_="false">xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmClientname"]}</client><clientGroup class="java.lang.String" _list_="false">xpath:{/workflow/variables/proxiesClientGroup}</clientGroup><argumentFilepath class="java.lang.String" _list_="false" /><sessionOptions class="workflow.types.cmd.SessionOptions" _list_="false"><useImpersonatedAccount class="java.lang.Boolean" _list_="false">true</useImpersonatedAccount><tokenFile class="java.lang.String" _list_="false" /><token class="java.lang.String" _list_="false" /></sessionOptions></inputs>"/>
<transition activity="HttpClient_10" commented="0"
description="" originalStyle="" points="" sourceX="813"
sourceY="75" status="0" style="defaultEdge" targetX="1124"
targetY="86" transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1590259275847" description=""
displayName="Set Firewall" height="34" interactive="0"
jobMode="0" name="ExecuteScript"
namespaceUri="commvault.cte.workflow.activities.cmd.operation"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.cmd.operation.OperationExecScript"
uniqueName="ExecuteScript_4" waitSetting="0" width="110" x="798" y="139">
<inputs val="<inputs><scriptName class="java.lang.String" _list_="false">QS_SetFirewallConfigOnClient.sql </scriptName><arguments class="java.lang.String" _list_="false">-si c=xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmClientname"]}</arguments><sessionOptions class="workflow.types.cmd.SessionOptions" _list_="false"><useImpersonatedAccount class="java.lang.Boolean" _list_="false">true</useImpersonatedAccount><tokenFile class="java.lang.String" _list_="false" /><token class="java.lang.String" _list_="false" /></sessionOptions></inputs>"/>
<transition activity="ClientGroup_1" commented="0"
description="" originalStyle="" points="" sourceX="815"
sourceY="157" status="0" style="defaultEdge" targetX="812"
targetY="85" transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1590388593835" description="" displayName="Refresh DC"
height="34" interactive="0" jobMode="0" name="Execute"
namespaceUri="commvault.cte.workflow.activities.cmd.operation"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.cmd.operation.OperationExecute"
uniqueName="Execute_2" waitSetting="0" width="100" x="15" y="131">
<inputs val="<inputs><inputXml class="java.lang.String" _list_="false">&lt;?xml version="1.0" encoding="UTF-8" standalone="no" ?&gt;&lt;EVGui_RefreshTemplateInformationReq clientId="0" flags="1" instanceId="xpath:{/workflow/CommServDBQuery_3/resultSets/row[1]/col[@name="instanceId"]}"/&gt;</inputXml><escapeXml class="java.lang.Boolean" _list_="false">false</escapeXml><commandArgs class="java.lang.String" _list_="false" /><sessionOptions class="workflow.types.cmd.SessionOptions" _list_="false"><useImpersonatedAccount class="java.lang.Boolean" _list_="false">true</useImpersonatedAccount><tokenFile class="java.lang.String" _list_="false" /><token class="java.lang.String" _list_="false" /></sessionOptions></inputs>"/>
<transition activity="CommServDBQuery_5" commented="0"
description="" originalStyle="" points="" sourceX="165"
sourceY="89" status="0" style="defaultEdge" targetX="163"
targetY="162" transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/CommServDBQuery_3/resultSets/row[1]/col[@name="errorCode"]}==0;"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1590419334592" description="performs http operations"
displayName="Associate VM to Company" height="28"
interactive="0" jobMode="0" name="HttpClient"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.HttpClientActivity"
uniqueName="HttpClient_10" waitSetting="0" width="178" x="1060" y="24">
<inputs val="<inputs><request><url>/company/xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="companyId"]}/company-association</url><method>PUT</method><postType>Raw</postType><postContent>&lt;Api_AssociateCompanyReq&gt;&lt;entities clientName="xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmClientname"]}" clientId="xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmClientId"]}" _type_="3" /&gt;&lt;/Api_AssociateCompanyReq&gt;</postContent><postContentType>application/xml; charset=UTF-8</postContentType><headers><name>Authtoken</name><value>QSDKONLY xpath:{/workflow/system/token}</value></headers><headers><name>Accept</name><value>application/xml</value></headers></request></inputs>"/>
<transition activity="ExecuteScript_1" commented="0"
description="" originalStyle="" points="" sourceX="949"
sourceY="158" status="0" style="defaultEdge" targetX="1025"
targetY="81" transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
(xpath:{/workflow/inputs/contentLibrary}==null || xpath:{/workflow/inputs/contentLibrary}.isEmpty());"/>
</transition>
<transition activity="Docking_XML" commented="0" description=""
originalStyle="" points="" sourceX="1149" sourceY="38"
status="0" style="defaultEdge" targetX="1102" targetY="98"
transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
(xpath:{/workflow/inputs/contentLibrary}!=null && !xpath:{/workflow/inputs/contentLibrary}.isEmpty());"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="1"
created="1590573063885"
description="This operation used to execute script on guest os in the provided VM"
displayName="Disable Firewall on the node if there is no CV Firewall set"
height="42" interactive="0" jobMode="0" maxRestarts="5"
name="ExecuteScriptInGuestOS"
namespaceUri="commvault.cte.workflow.activities.VMUtilities"
originalStyle="" restartInterval="1" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.VMUtilities.ExecuteScriptInGuestOS"
uniqueName="ExecuteScriptInGuestOS_FW" waitSetting="0"
width="200" x="1625" y="69">
<onExit language="1" script="if(xpath:{/workflow/ExecuteScriptInGuestOS_1/errorCode}!=0 || xpath:{/workflow/ExecuteScriptInGuestOS_1/exitCode}!=0)
 workflow.setVariable("failureMessage","Failed to run ");"/>
<inputs val="<inputs><vmClientName class="commvault.msgs.CvEntities.ClientEntity" _list_="false"><clientName class="java.lang.String" _list_="false" /><clientId class="java.lang.Integer" _list_="false" /><clientName class="java.lang.String" _list_="false" /><hostName class="java.lang.String" _list_="false" /><clientGUID class="java.lang.String" _list_="false" /><displayName class="java.lang.String" _list_="false" /><commCellName class="java.lang.String" _list_="false" /><csGUID class="java.lang.String" _list_="false" /><type class="commvault.msgs.CvEntities.CommCellType" _list_="false" /><flags class="commvault.msgs.CvEntities.EntityFlags" _list_="false" /><GUID class="java.lang.String" _list_="false" /><newName class="java.lang.String" _list_="false" /></vmClientName><vmName class="java.lang.String" _list_="false">xpath:{/workflow/inputs/vmName}</vmName><vmGUID class="java.lang.String" _list_="false">xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmGUID"]}</vmGUID><virtualizationClient class="commvault.msgs.CvEntities.ClientEntity" _list_="false">xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="hypervisorName"]}</virtualizationClient><isUNCPath class="java.lang.Boolean" _list_="false">false</isUNCPath><scriptPath class="java.lang.String" _list_="false">xpath:{/workflow/variables/scriptPath_FW}</scriptPath><scriptLog class="java.lang.String" _list_="false">xpath:{/workflow/variables/scriptLogPath_FW}</scriptLog><uncPathUserName class="java.lang.String" _list_="false" /><uncPathPassword class="workflow.types.EncryptedString" _list_="false" /><guestOSUserName class="java.lang.String" _list_="false">xpath:{/workflow/CommServDBQuery_1/resultSets/row/col[@name="vmUsername"]}</guestOSUserName><guestOSPassword class="workflow.types.EncryptedString" _list_="false">xpath:{/workflow/variables/vmPassword}</guestOSPassword><vsaProxyClient class="commvault.msgs.CvEntities.ClientEntity" _list_="false">xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="vsaProxy"]}</vsaProxyClient><timeOutInSeconds class="java.lang.Integer" _list_="false">480</timeOutInSeconds><sessionOptions class="workflow.types.cmd.SessionOptions" _list_="false"><useImpersonatedAccount class="java.lang.Boolean" _list_="false">true</useImpersonatedAccount><tokenFile class="java.lang.String" _list_="false" /><token class="java.lang.String" _list_="false" /></sessionOptions></inputs>"/>
<transition activity="XPathQuery_28" commented="0"
description="" originalStyle="" points="" sourceX="1660"
sourceY="132" status="0" style="defaultEdge" targetX="1493"
targetY="250" transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1590574088254"
description="retrieves a list of values from xml"
displayName="Get ErrorCode" height="34" interactive="0"
jobMode="0" name="XPathQuery"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0" style="label;image=XPathQuery"
uniqueName="XPathQuery_28" waitSetting="0" width="133" x="1637" y="150">
<inputs val="<inputs><xml class="java.lang.String">xpath:{/workflow/ExecuteScriptInGuestOS_FW/commandOutput}</xml><xpath class="java.lang.String">/TMMsg_GenericResp/errorCode</xpath><outputType class="workflow.types.SimpleType">Integer</outputType><outputAsList class="java.lang.Boolean">false</outputAsList></inputs>"/>
<transition activity="XPathQuery_29" commented="0"
description="" originalStyle="" points="" sourceX="1493"
sourceY="250" status="0" style="defaultEdge" targetX="1486"
targetY="310" transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1590574088274"
description="retrieves a list of values from xml"
displayName="Get ErrorMessage" height="34" interactive="0"
jobMode="0" name="XPathQuery"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0" style="label;image=XPathQuery"
uniqueName="XPathQuery_29" waitSetting="0" width="133" x="1635" y="225">
<onExit language="1" script="if(xpath:{/workflow/XPathQuery_26/result}!=0){
 if(xpath:{/workflow/XPathQuery_25/result}!=null && xpath:{/workflow/XPathQuery_25/result}.length() > 0){
 workflow.setVariable("failureMessage",xpath:{/workflow/XPathQuery_25/result});
 }else{
 workflow.setVariable("failureMessage","Failed to register client to commserve at guest os");
 }
}
"/>
<inputs val="<inputs><xml class="java.lang.String">xpath:{/workflow/ExecuteScriptInGuestOS_FW/commandOutput}</xml><xpath class="java.lang.String">/TMMsg_GenericResp/errorMessage</xpath><outputType class="workflow.types.SimpleType">String</outputType><outputAsList class="java.lang.Boolean">false</outputAsList></inputs>"/>
<transition activity="Email_3" commented="0" description=""
displayName="Success" originalStyle="" points=""
sourceX="1486" sourceY="310" status="0" style="defaultEdge"
targetX="1586" targetY="355" transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/ExecuteScriptInGuestOS_FW/exitCode}==0 && xpath:{/workflow/XPathQuery_28/result}==0;"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="1"
created="1590574638881"
description="Execute a script on a remote machine"
displayName="Prepare FW Script" height="34" interactive="0"
jobMode="0" maxRestarts="0" name="ExecuteScript"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.ExecuteScript"
uniqueName="ExecuteScript_6" waitSetting="0" width="141"
x="1355" y="73">
<inputs val="<inputs><client class="commvault.msgs.CvEntities.ClientEntity" _list_="false">xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="vsaProxy"]}</client><impersonateUserName class="java.lang.String" _list_="false" /><impersonateUserPassword class="workflow.types.EncryptedString" _list_="false" /><startUpPath class="java.lang.String" _list_="false" /><scriptType class="commvault.msgs.App.ScriptType" _list_="false">xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="scriptType"]}</scriptType><script class="java.lang.String" _list_="false">xpath:{/workflow/variables/firewallStop} &gt; xpath:{/workflow/variables/scriptPath_FW}</script><arguments class="java.lang.String" _list_="false" /><waitForProcessCompletion class="java.lang.Boolean" _list_="false">true</waitForProcessCompletion></inputs>"/>
<transition activity="ExecuteScriptInGuestOS_FW" commented="0"
description="" displayName="Success" originalStyle=""
points="" sourceX="1355" sourceY="85" status="0"
style="defaultEdge" targetX="1661" targetY="129"
transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/ExecuteScript_6/exitCode}==0 && xpath:{/workflow/ExecuteScript_6/errorCode}==0;"/>
</transition>
<transition activity="Email_2" commented="0" description=""
displayName="Failed" offsetX="191" offsetY="-158"
originalStyle="" points="1419.0,492.0" sourceX="1425"
sourceY="90" status="0" style="defaultEdge" targetX="1079"
targetY="358" transitionIndex="0" x="0" y="0">
<condition language="1" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
xpath:{/workflow/ExecuteScript_6/exitCode}!=0 || xpath:{/workflow/ExecuteScript_6/errorCode}!=0;"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1614840091570"
description="creates a super process group"
displayName="ProcessBlock" height="250" interactive="0"
jobMode="0" maxRestarts="5" name="ProcessBlock"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" restartInterval="1" skipAttempt="0"
style="swimlane" uniqueName="ProcessBlock_1" waitSetting="0"
width="745" x="341" y="544">
<inputs val="<inputs><inputs /></inputs>"/>
<superProcess>
<Start commented="0" continueOnFailure="0"
created="1614840091570" description=""
displayName="Start" height="30" interactive="0"
jobMode="0" name="Start" originalStyle=""
skipAttempt="0"
style="label;fillColor=#FFFF33;gradientColor=#FFFF00"
uniqueName="Start_2" waitSetting="0" width="120" x="18" y="30">
<inputs val="<inputs />"/>
<transition activity="Script_1" commented="0"
description="" originalStyle="" points=""
sourceX="78" sourceY="45" status="0"
style="defaultEdge" targetX="74" targetY="117"
transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Start>
<Activity commented="0" continueOnFailure="0"
created="1614840108750"
description="activity to execute code snippets in the selected language"
displayName="Encode" height="34" interactive="0"
jobMode="0" name="Script"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.ScriptActivity"
uniqueName="Script_1" waitSetting="0" width="100" x="24" y="100">
<inputs val="<inputs><script language="4" script="&#xD;&#xA;String username= xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name=&quot;username&quot;]};&#xD;&#xA;&#xD;&#xA;String password =utils.decryptString(xpath:{/workflow/CommServDBQuery_5/resultSets/row/col});&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;stringToEncode = username+&quot;:&quot;+password;;&#xD;&#xA;encodedString = Base64.getEncoder().encodeToString(stringToEncode.getBytes());&#xD;&#xA;auth = &quot;Basic &quot;+ encodedString;&#xD;&#xA;return auth;" /></inputs>"/>
<transition activity="HttpClient_1" commented="0"
description="" originalStyle="" points=""
sourceX="74" sourceY="117" status="0"
style="defaultEdge" targetX="77" targetY="180"
transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1614840366012"
description="performs http operations"
displayName="Login" height="34" interactive="0"
jobMode="0" maxRestarts="50" name="HttpClient"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" restartInterval="1" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.HttpClientActivity"
uniqueName="HttpClient_1" waitSetting="0" width="100"
x="26" y="165">
<onExit language="4" script="import org.json.JSONArray;
import org.json.JSONObject;
import java.util.concurrent.TimeUnit;

JSONObject jo = new JSONObject(xpath:{/workflow/HttpClient_1/output});
workflow.setVariable("sessionId",jo.get("value"));
"/>
<inputs val="<inputs><request><url>https://xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="vcentername"]}/rest/com/vmware/cis/session</url><method>POST</method><postType>Raw</postType><postContent></postContent><postContentType>application/xml; charset=UTF-8</postContentType><headers><name>Authtoken</name><value>QSDKONLY xpath:{/workflow/system/token}</value></headers><headers><name>Accept</name><value>application/json</value></headers><headers><name>Authorization</name><value>xpath:{/workflow/Script_1/output}</value></headers></request></inputs>"/>
<transition activity="HttpClient_2" commented="0"
description="" originalStyle="" points=""
sourceX="239" sourceY="52" status="0"
style="defaultEdge" targetX="238" targetY="108"
transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1614848664770"
description="performs http operations"
displayName="Fetch DC" height="34" interactive="0"
jobMode="0" maxRestarts="50" name="HttpClient"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" restartInterval="1" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.HttpClientActivity"
uniqueName="HttpClient_2" waitSetting="0" width="100"
x="178" y="36">
<onExit language="4" script="import org.json.JSONArray;
import org.json.JSONObject;
import java.util.concurrent.TimeUnit;

JSONObject jo = new JSONObject(xpath:{/workflow/HttpClient_2/output});
JSONArray ja = jo.getJSONArray("value");
String id = ja.getJSONObject(0).get("datacenter");
workflow.setVariable("datacenterId",id);
logger.info(workflow.getVariable("datacenterId"));
"/>
<inputs val="<inputs><request><url>https://xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="vcentername"]}/rest/vcenter/datacenter</url><method>GET</method><postType>Raw</postType><postContent></postContent><postContentType>application/xml; charset=UTF-8</postContentType><parameters><name>filter.names</name><value>xpath:{/workflow/inputs/dataCenterName}</value></parameters><headers><name>Authtoken</name><value>QSDKONLY xpath:{/workflow/system/token}</value></headers><headers><name>Accept</name><value>application/json</value></headers><headers><name>vmware-api-session-id</name><value>xpath:{/workflow/variables/sessionId}</value></headers></request></inputs>"/>
<transition activity="HttpClient_3" commented="0"
description="" originalStyle="" points=""
sourceX="254" sourceY="115" status="0"
style="defaultEdge" targetX="368" targetY="98"
transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1614853696950"
description="performs http operations"
displayName="Fetch DS" height="34" interactive="0"
jobMode="0" maxRestarts="50" name="HttpClient"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" restartInterval="1" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.HttpClientActivity"
uniqueName="HttpClient_3" waitSetting="0" width="100"
x="173" y="101">
<onExit language="4" script="import org.json.JSONArray;
import org.json.JSONObject;
import java.util.concurrent.TimeUnit;

JSONObject jo = new JSONObject(xpath:{/workflow/HttpClient_3/output});
JSONArray ja = jo.getJSONArray("value");
String id = ja.getJSONObject(0).get("datastore");
workflow.setVariable("datastoreId",id);
logger.info(workflow.getVariable("datastoreId"));
"/>
<inputs val="<inputs><request><url>https://xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="vcentername"]}/rest/vcenter/datastore</url><method>GET</method><postType>Raw</postType><postContent></postContent><postContentType>application/xml; charset=UTF-8</postContentType><parameters><name>filter.names</name><value>xpath:{/workflow/inputs/dataStore}</value></parameters><parameters><name>filter.datacenters</name><value>xpath:{/workflow/variables/datacenterId}</value></parameters><headers><name>Authtoken</name><value>QSDKONLY xpath:{/workflow/system/token}</value></headers><headers><name>Accept</name><value>application/json</value></headers><headers><name>vmware-api-session-id</name><value>xpath:{/workflow/variables/sessionId}</value></headers></request></inputs>"/>
<transition activity="HttpClient_4" commented="0"
description="" originalStyle="" points=""
sourceX="366" sourceY="48" status="0"
style="defaultEdge" targetX="370" targetY="103"
transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1614854006739"
description="performs http operations"
displayName="Fetch ResourcePool" height="34"
interactive="0" jobMode="0" maxRestarts="50"
name="HttpClient"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" restartInterval="1" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.HttpClientActivity"
uniqueName="HttpClient_4" waitSetting="0" width="144"
x="164" y="162">
<onExit language="4" script="import org.json.JSONArray;
import org.json.JSONObject;
import java.util.concurrent.TimeUnit;

JSONObject jo = new JSONObject(xpath:{/workflow/HttpClient_4/output});
JSONArray ja = jo.getJSONArray("value");
String id = ja.getJSONObject(0).get("resource_pool");
workflow.setVariable("resourcepoolId",id);
logger.info(workflow.getVariable("resourcepoolId"));
"/>
<inputs val="<inputs><request><url>https://xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="vcentername"]}/rest/vcenter/resource-pool</url><method>GET</method><postType>Raw</postType><postContent></postContent><postContentType>application/xml; charset=UTF-8</postContentType><parameters><name>filter.names</name><value>xpath:{/workflow/inputs/resourcePool}</value></parameters><parameters><name>filter.datacenters</name><value>xpath:{/workflow/variables/datacenterId}</value></parameters><headers><name>Authtoken</name><value>QSDKONLY xpath:{/workflow/system/token}</value></headers><headers><name>Accept</name><value>application/json</value></headers><headers><name>vmware-api-session-id</name><value>xpath:{/workflow/variables/sessionId}</value></headers></request></inputs>"/>
<transition activity="HttpClient_5" commented="0"
description="" originalStyle="" points="298.0,117.0"
sourceX="384" sourceY="108" status="0"
style="defaultEdge" targetX="474" targetY="67"
transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1614854179289"
description="performs http operations"
displayName="Fetch Network" height="34" interactive="0"
jobMode="0" maxRestarts="50" name="HttpClient"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" restartInterval="1" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.HttpClientActivity"
uniqueName="HttpClient_5" waitSetting="0" width="144"
x="323" y="37">
<onExit language="4" script="import org.json.JSONArray;
import org.json.JSONObject;
import java.util.concurrent.TimeUnit;

JSONObject jo = new JSONObject(xpath:{/workflow/HttpClient_5/output});
JSONArray ja = jo.getJSONArray("value");
String id = ja.getJSONObject(0).get("network");
workflow.setVariable("networkId",id);
logger.info(workflow.getVariable("networkId"));
"/>
<inputs val="<inputs><request><url>https://xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="vcentername"]}/rest/vcenter/network</url><method>GET</method><postType>Raw</postType><postContent></postContent><postContentType>application/xml; charset=UTF-8</postContentType><parameters><name>filter.names</name><value>xpath:{/workflow/inputs/vmNetwork}</value></parameters><parameters><name>filter.datacenters</name><value>xpath:{/workflow/variables/datacenterId}</value></parameters><headers><name>Authtoken</name><value>QSDKONLY xpath:{/workflow/system/token}</value></headers><headers><name>Accept</name><value>application/json</value></headers><headers><name>vmware-api-session-id</name><value>xpath:{/workflow/variables/sessionId}</value></headers></request></inputs>"/>
<transition activity="HttpClient_6" commented="0"
description="" originalStyle="" points=""
sourceX="525" sourceY="49" status="0"
style="defaultEdge" targetX="539" targetY="106"
transitionIndex="0" x="0" y="0">
<condition language="4" script="/*
The expression should return a boolean. Use the variable name "activity" to refer to the previous activity object. Example:
activity.exitCode==0;
*/
"/>
</transition>
</Activity>
<Activity commented="0" continueOnFailure="0"
created="1614855822411"
description="performs http operations"
displayName="Fetch Library" height="34" interactive="0"
jobMode="0" maxRestarts="50" name="HttpClient"
namespaceUri="commvault.cte.workflow.activities"
originalStyle="" restartInterval="1" skipAttempt="0"
style="label;image=commvault.cte.workflow.activities.HttpClientActivity"
uniqueName="HttpClient_6" waitSetting="0" width="123"
x="332" y="95">
<onExit language="4" script="import org.json.JSONArray;
import org.json.JSONObject;
import java.util.concurrent.TimeUnit;

JSONObject jo = new JSONObject(xpath:{/workflow/HttpClient_6/output});
ar = jo.get("value");
workflow.setVariable("libraryId",ar[0]);
logger.info(workflow.getVariable("libraryId"));
"/>
<inputs val="<inputs><request><url>https://xpath:{/workflow/CommServDBQuery_3/resultSets/row/col[@name="vcentername"]}/rest/com/vmware/content/library?~action=find</url><method>POST</method><postType>Raw</postType><postContent>{
 "spec": {
 "name": "xpath:{/workflow/inputs/contentLibrary}"
 }
}</postContent><postContentType>application/json; charset=UTF-8</postContentType><headers><name>Authtoken</name><value>QSDKONLY xpath:{/workflow/system/token}</value></headers><headers><name>Accept</name><value>application/json</value></headers><headers><name>vmware-api-session-id</name><value>xpath:{/workflow/variables/sessionId}</value></headers></request></inputs>"/>
<transition activity="HttpClient_11" commented="0"
description="" originalStyle="" points=""
sourceX="393" sourceY="112" status="0"
style="defaultEdge" targetX="395" targetY="175"