FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cloudstack/server/src/com/cloud/api/ApiDBUtils.java at vmsync · kwanggithub/cloudstack · GitHub
This repository was archived by the owner on Jan 15, 2020. It is now read-only.
kwanggithub
/
cloudstack
Public archive
forked from
apache/cloudstack
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cloudstack
/
server
/
src
/
com
/
cloud
/
api
/
ApiDBUtils.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
1679 lines (1444 loc) · 67.1 KB
Breadcrumbs
cloudstack
/
server
/
src
/
com
/
cloud
/
api
/
ApiDBUtils.java
Copy path
File metadata and controls
executable file
·
1679 lines (1444 loc) · 67.1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package
com
.
cloud
.
api
;
import
java
.
util
.
ArrayList
;
import
java
.
util
.
EnumSet
;
import
java
.
util
.
List
;
import
java
.
util
.
Map
;
import
java
.
util
.
Set
;
import
javax
.
annotation
.
PostConstruct
;
import
javax
.
inject
.
Inject
;
import
org
.
apache
.
cloudstack
.
affinity
.
AffinityGroup
;
import
org
.
apache
.
cloudstack
.
affinity
.
AffinityGroupResponse
;
import
org
.
apache
.
cloudstack
.
affinity
.
dao
.
AffinityGroupDao
;
import
org
.
apache
.
cloudstack
.
api
.
ApiCommandJobType
;
import
org
.
apache
.
cloudstack
.
api
.
ApiConstants
.
HostDetails
;
import
org
.
apache
.
cloudstack
.
api
.
ApiConstants
.
VMDetails
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
AccountResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
AsyncJobResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
DiskOfferingResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
DomainRouterResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
EventResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
HostForMigrationResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
HostResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
ImageStoreResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
InstanceGroupResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
ProjectAccountResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
ProjectInvitationResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
ProjectResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
ResourceTagResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
SecurityGroupResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
ServiceOfferingResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
StoragePoolResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
TemplateResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
UserResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
UserVmResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
VolumeResponse
;
import
org
.
apache
.
cloudstack
.
api
.
response
.
ZoneResponse
;
import
org
.
apache
.
cloudstack
.
framework
.
jobs
.
AsyncJob
;
import
org
.
apache
.
cloudstack
.
framework
.
jobs
.
AsyncJobManager
;
import
org
.
apache
.
cloudstack
.
framework
.
jobs
.
dao
.
AsyncJobDao
;
import
org
.
apache
.
cloudstack
.
lb
.
dao
.
ApplicationLoadBalancerRuleDao
;
import
org
.
apache
.
cloudstack
.
storage
.
datastore
.
db
.
PrimaryDataStoreDao
;
import
org
.
apache
.
cloudstack
.
storage
.
datastore
.
db
.
StoragePoolVO
;
import
com
.
cloud
.
api
.
query
.
dao
.
AccountJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
AffinityGroupJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
AsyncJobJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
DataCenterJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
DiskOfferingJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
DomainRouterJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
HostJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
ImageStoreJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
InstanceGroupJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
ProjectAccountJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
ProjectInvitationJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
ProjectJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
ResourceTagJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
SecurityGroupJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
ServiceOfferingJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
StoragePoolJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
TemplateJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
UserAccountJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
UserVmJoinDao
;
import
com
.
cloud
.
api
.
query
.
dao
.
VolumeJoinDao
;
import
com
.
cloud
.
api
.
query
.
vo
.
AccountJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
AffinityGroupJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
AsyncJobJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
DataCenterJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
DiskOfferingJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
DomainRouterJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
EventJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
HostJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
ImageStoreJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
InstanceGroupJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
ProjectAccountJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
ProjectInvitationJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
ProjectJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
ResourceTagJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
SecurityGroupJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
ServiceOfferingJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
StoragePoolJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
TemplateJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
UserAccountJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
UserVmJoinVO
;
import
com
.
cloud
.
api
.
query
.
vo
.
VolumeJoinVO
;
import
com
.
cloud
.
capacity
.
CapacityVO
;
import
com
.
cloud
.
capacity
.
dao
.
CapacityDao
;
import
com
.
cloud
.
capacity
.
dao
.
CapacityDaoImpl
.
SummedCapacity
;
import
com
.
cloud
.
configuration
.
Config
;
import
com
.
cloud
.
configuration
.
ConfigurationService
;
import
com
.
cloud
.
configuration
.
Resource
.
ResourceType
;
import
com
.
cloud
.
configuration
.
dao
.
ConfigurationDao
;
import
com
.
cloud
.
dc
.
AccountVlanMapVO
;
import
com
.
cloud
.
dc
.
ClusterDetailsDao
;
import
com
.
cloud
.
dc
.
ClusterDetailsVO
;
import
com
.
cloud
.
dc
.
ClusterVO
;
import
com
.
cloud
.
dc
.
DataCenter
;
import
com
.
cloud
.
dc
.
DataCenterVO
;
import
com
.
cloud
.
dc
.
HostPodVO
;
import
com
.
cloud
.
dc
.
Vlan
;
import
com
.
cloud
.
dc
.
VlanVO
;
import
com
.
cloud
.
dc
.
dao
.
AccountVlanMapDao
;
import
com
.
cloud
.
dc
.
dao
.
ClusterDao
;
import
com
.
cloud
.
dc
.
dao
.
DataCenterDao
;
import
com
.
cloud
.
dc
.
dao
.
HostPodDao
;
import
com
.
cloud
.
dc
.
dao
.
VlanDao
;
import
com
.
cloud
.
domain
.
DomainVO
;
import
com
.
cloud
.
domain
.
dao
.
DomainDao
;
import
com
.
cloud
.
event
.
Event
;
import
com
.
cloud
.
event
.
dao
.
EventJoinDao
;
import
com
.
cloud
.
exception
.
InvalidParameterValueException
;
import
com
.
cloud
.
ha
.
HighAvailabilityManager
;
import
com
.
cloud
.
host
.
Host
;
import
com
.
cloud
.
host
.
HostStats
;
import
com
.
cloud
.
host
.
HostVO
;
import
com
.
cloud
.
host
.
dao
.
HostDao
;
import
com
.
cloud
.
host
.
dao
.
HostDetailsDao
;
import
com
.
cloud
.
hypervisor
.
Hypervisor
.
HypervisorType
;
import
com
.
cloud
.
network
.
IpAddress
;
import
com
.
cloud
.
network
.
Network
;
import
com
.
cloud
.
network
.
Network
.
Capability
;
import
com
.
cloud
.
network
.
Network
.
Provider
;
import
com
.
cloud
.
network
.
Network
.
Service
;
import
com
.
cloud
.
network
.
NetworkManager
;
import
com
.
cloud
.
network
.
NetworkModel
;
import
com
.
cloud
.
network
.
NetworkProfile
;
import
com
.
cloud
.
network
.
Networks
.
TrafficType
;
import
com
.
cloud
.
network
.
PhysicalNetworkServiceProvider
;
import
com
.
cloud
.
network
.
as
.
AutoScalePolicy
;
import
com
.
cloud
.
network
.
as
.
AutoScalePolicyConditionMapVO
;
import
com
.
cloud
.
network
.
as
.
AutoScalePolicyVO
;
import
com
.
cloud
.
network
.
as
.
AutoScaleVmGroupPolicyMapVO
;
import
com
.
cloud
.
network
.
as
.
AutoScaleVmGroupVO
;
import
com
.
cloud
.
network
.
as
.
AutoScaleVmProfileVO
;
import
com
.
cloud
.
network
.
as
.
ConditionVO
;
import
com
.
cloud
.
network
.
as
.
CounterVO
;
import
com
.
cloud
.
network
.
as
.
dao
.
AutoScalePolicyConditionMapDao
;
import
com
.
cloud
.
network
.
as
.
dao
.
AutoScalePolicyDao
;
import
com
.
cloud
.
network
.
as
.
dao
.
AutoScaleVmGroupDao
;
import
com
.
cloud
.
network
.
as
.
dao
.
AutoScaleVmGroupPolicyMapDao
;
import
com
.
cloud
.
network
.
as
.
dao
.
AutoScaleVmProfileDao
;
import
com
.
cloud
.
network
.
as
.
dao
.
ConditionDao
;
import
com
.
cloud
.
network
.
as
.
dao
.
CounterDao
;
import
com
.
cloud
.
network
.
dao
.
AccountGuestVlanMapDao
;
import
com
.
cloud
.
network
.
dao
.
AccountGuestVlanMapVO
;
import
com
.
cloud
.
network
.
dao
.
FirewallRulesCidrsDao
;
import
com
.
cloud
.
network
.
dao
.
FirewallRulesDao
;
import
com
.
cloud
.
network
.
dao
.
IPAddressDao
;
import
com
.
cloud
.
network
.
dao
.
IPAddressVO
;
import
com
.
cloud
.
network
.
dao
.
LoadBalancerDao
;
import
com
.
cloud
.
network
.
dao
.
LoadBalancerVO
;
import
com
.
cloud
.
network
.
dao
.
NetworkDao
;
import
com
.
cloud
.
network
.
dao
.
NetworkDomainDao
;
import
com
.
cloud
.
network
.
dao
.
NetworkDomainVO
;
import
com
.
cloud
.
network
.
dao
.
NetworkRuleConfigDao
;
import
com
.
cloud
.
network
.
dao
.
NetworkRuleConfigVO
;
import
com
.
cloud
.
network
.
dao
.
NetworkVO
;
import
com
.
cloud
.
network
.
dao
.
PhysicalNetworkDao
;
import
com
.
cloud
.
network
.
dao
.
PhysicalNetworkServiceProviderDao
;
import
com
.
cloud
.
network
.
dao
.
PhysicalNetworkServiceProviderVO
;
import
com
.
cloud
.
network
.
dao
.
PhysicalNetworkTrafficTypeDao
;
import
com
.
cloud
.
network
.
dao
.
PhysicalNetworkTrafficTypeVO
;
import
com
.
cloud
.
network
.
dao
.
PhysicalNetworkVO
;
import
com
.
cloud
.
network
.
dao
.
Site2SiteCustomerGatewayDao
;
import
com
.
cloud
.
network
.
dao
.
Site2SiteCustomerGatewayVO
;
import
com
.
cloud
.
network
.
dao
.
Site2SiteVpnGatewayDao
;
import
com
.
cloud
.
network
.
dao
.
Site2SiteVpnGatewayVO
;
import
com
.
cloud
.
network
.
router
.
VirtualRouter
;
import
com
.
cloud
.
network
.
rules
.
FirewallRuleVO
;
import
com
.
cloud
.
network
.
rules
.
LoadBalancer
;
import
com
.
cloud
.
network
.
security
.
SecurityGroup
;
import
com
.
cloud
.
network
.
security
.
SecurityGroupManager
;
import
com
.
cloud
.
network
.
security
.
SecurityGroupVO
;
import
com
.
cloud
.
network
.
security
.
dao
.
SecurityGroupDao
;
import
com
.
cloud
.
network
.
vpc
.
NetworkACL
;
import
com
.
cloud
.
network
.
vpc
.
StaticRouteVO
;
import
com
.
cloud
.
network
.
vpc
.
VpcGatewayVO
;
import
com
.
cloud
.
network
.
vpc
.
VpcManager
;
import
com
.
cloud
.
network
.
vpc
.
VpcOffering
;
import
com
.
cloud
.
network
.
vpc
.
VpcProvisioningService
;
import
com
.
cloud
.
network
.
vpc
.
VpcVO
;
import
com
.
cloud
.
network
.
vpc
.
dao
.
NetworkACLDao
;
import
com
.
cloud
.
network
.
vpc
.
dao
.
StaticRouteDao
;
import
com
.
cloud
.
network
.
vpc
.
dao
.
VpcDao
;
import
com
.
cloud
.
network
.
vpc
.
dao
.
VpcGatewayDao
;
import
com
.
cloud
.
network
.
vpc
.
dao
.
VpcOfferingDao
;
import
com
.
cloud
.
offering
.
DiskOffering
;
import
com
.
cloud
.
offering
.
NetworkOffering
;
import
com
.
cloud
.
offering
.
ServiceOffering
;
import
com
.
cloud
.
offerings
.
NetworkOfferingVO
;
import
com
.
cloud
.
offerings
.
dao
.
NetworkOfferingDao
;
import
com
.
cloud
.
projects
.
Project
;
import
com
.
cloud
.
projects
.
ProjectAccount
;
import
com
.
cloud
.
projects
.
ProjectInvitation
;
import
com
.
cloud
.
projects
.
ProjectService
;
import
com
.
cloud
.
region
.
ha
.
GlobalLoadBalancingRulesService
;
import
com
.
cloud
.
resource
.
ResourceManager
;
import
com
.
cloud
.
server
.
Criteria
;
import
com
.
cloud
.
server
.
ManagementServer
;
import
com
.
cloud
.
server
.
ResourceTag
;
import
com
.
cloud
.
server
.
ResourceTag
.
TaggedResourceType
;
import
com
.
cloud
.
server
.
StatsCollector
;
import
com
.
cloud
.
server
.
TaggedResourceService
;
import
com
.
cloud
.
service
.
ServiceOfferingVO
;
import
com
.
cloud
.
service
.
dao
.
ServiceOfferingDao
;
import
com
.
cloud
.
storage
.
DiskOfferingVO
;
import
com
.
cloud
.
storage
.
GuestOS
;
import
com
.
cloud
.
storage
.
GuestOSCategoryVO
;
import
com
.
cloud
.
storage
.
ImageStore
;
import
com
.
cloud
.
storage
.
Snapshot
;
import
com
.
cloud
.
storage
.
SnapshotVO
;
import
com
.
cloud
.
storage
.
Storage
.
ImageFormat
;
import
com
.
cloud
.
storage
.
StorageManager
;
import
com
.
cloud
.
storage
.
StoragePool
;
import
com
.
cloud
.
storage
.
StorageStats
;
import
com
.
cloud
.
storage
.
UploadVO
;
import
com
.
cloud
.
storage
.
VMTemplateS3VO
;
import
com
.
cloud
.
storage
.
VMTemplateSwiftVO
;
import
com
.
cloud
.
storage
.
VMTemplateVO
;
import
com
.
cloud
.
storage
.
Volume
;
import
com
.
cloud
.
storage
.
Volume
.
Type
;
import
com
.
cloud
.
storage
.
VolumeManager
;
import
com
.
cloud
.
storage
.
VolumeVO
;
import
com
.
cloud
.
storage
.
dao
.
DiskOfferingDao
;
import
com
.
cloud
.
storage
.
dao
.
GuestOSCategoryDao
;
import
com
.
cloud
.
storage
.
dao
.
GuestOSDao
;
import
com
.
cloud
.
storage
.
dao
.
SnapshotDao
;
import
com
.
cloud
.
storage
.
dao
.
SnapshotPolicyDao
;
import
com
.
cloud
.
storage
.
dao
.
UploadDao
;
import
com
.
cloud
.
storage
.
dao
.
VMTemplateDao
;
import
com
.
cloud
.
storage
.
dao
.
VMTemplateDetailsDao
;
import
com
.
cloud
.
storage
.
dao
.
VMTemplateS3Dao
;
import
com
.
cloud
.
storage
.
dao
.
VMTemplateSwiftDao
;
import
com
.
cloud
.
storage
.
dao
.
VolumeDao
;
import
com
.
cloud
.
storage
.
snapshot
.
SnapshotPolicy
;
import
com
.
cloud
.
template
.
TemplateManager
;
import
com
.
cloud
.
template
.
VirtualMachineTemplate
;
import
com
.
cloud
.
user
.
Account
;
import
com
.
cloud
.
user
.
AccountDetailsDao
;
import
com
.
cloud
.
user
.
AccountVO
;
import
com
.
cloud
.
user
.
ResourceLimitService
;
import
com
.
cloud
.
user
.
SSHKeyPairVO
;
import
com
.
cloud
.
user
.
User
;
import
com
.
cloud
.
user
.
UserAccount
;
import
com
.
cloud
.
user
.
UserStatisticsVO
;
import
com
.
cloud
.
user
.
UserVO
;
import
com
.
cloud
.
user
.
dao
.
AccountDao
;
import
com
.
cloud
.
user
.
dao
.
SSHKeyPairDao
;
import
com
.
cloud
.
user
.
dao
.
UserDao
;
import
com
.
cloud
.
user
.
dao
.
UserStatisticsDao
;
import
com
.
cloud
.
uservm
.
UserVm
;
import
com
.
cloud
.
utils
.
EnumUtils
;
import
com
.
cloud
.
utils
.
NumbersUtil
;
import
com
.
cloud
.
utils
.
Pair
;
import
com
.
cloud
.
vm
.
ConsoleProxyVO
;
import
com
.
cloud
.
vm
.
DomainRouterVO
;
import
com
.
cloud
.
vm
.
InstanceGroup
;
import
com
.
cloud
.
vm
.
InstanceGroupVO
;
import
com
.
cloud
.
vm
.
NicProfile
;
import
com
.
cloud
.
vm
.
UserVmDetailVO
;
import
com
.
cloud
.
vm
.
UserVmManager
;
import
com
.
cloud
.
vm
.
UserVmVO
;
import
com
.
cloud
.
vm
.
VMInstanceVO
;
import
com
.
cloud
.
vm
.
VirtualMachine
;
import
com
.
cloud
.
vm
.
VmStats
;
import
com
.
cloud
.
vm
.
dao
.
ConsoleProxyDao
;
import
com
.
cloud
.
vm
.
dao
.
DomainRouterDao
;
import
com
.
cloud
.
vm
.
dao
.
NicSecondaryIpDao
;
import
com
.
cloud
.
vm
.
dao
.
NicSecondaryIpVO
;
import
com
.
cloud
.
vm
.
dao
.
UserVmDao
;
import
com
.
cloud
.
vm
.
dao
.
UserVmDetailsDao
;
import
com
.
cloud
.
vm
.
dao
.
VMInstanceDao
;
import
com
.
cloud
.
vm
.
snapshot
.
VMSnapshot
;
import
com
.
cloud
.
vm
.
snapshot
.
dao
.
VMSnapshotDao
;
public
class
ApiDBUtils
{
private
static
ManagementServer
_ms
;
static
AsyncJobManager
_asyncMgr
;
static
SecurityGroupManager
_securityGroupMgr
;
static
StorageManager
_storageMgr
;
static
VolumeManager
_volumeMgr
;
static
UserVmManager
_userVmMgr
;
static
NetworkModel
_networkModel
;
static
NetworkManager
_networkMgr
;
static
TemplateManager
_templateMgr
;
static
StatsCollector
_statsCollector
;
static
AccountDao
_accountDao
;
static
AccountVlanMapDao
_accountVlanMapDao
;
static
ClusterDao
_clusterDao
;
static
CapacityDao
_capacityDao
;
static
DiskOfferingDao
_diskOfferingDao
;
static
DiskOfferingJoinDao
_diskOfferingJoinDao
;
static
DataCenterJoinDao
_dcJoinDao
;
static
DomainDao
_domainDao
;
static
DomainRouterDao
_domainRouterDao
;
static
DomainRouterJoinDao
_domainRouterJoinDao
;
static
GuestOSDao
_guestOSDao
;
static
GuestOSCategoryDao
_guestOSCategoryDao
;
static
HostDao
_hostDao
;
static
AccountGuestVlanMapDao
_accountGuestVlanMapDao
;
static
IPAddressDao
_ipAddressDao
;
static
LoadBalancerDao
_loadBalancerDao
;
static
SecurityGroupDao
_securityGroupDao
;
static
SecurityGroupJoinDao
_securityGroupJoinDao
;
static
ServiceOfferingJoinDao
_serviceOfferingJoinDao
;
static
NetworkRuleConfigDao
_networkRuleConfigDao
;
static
HostPodDao
_podDao
;
static
ServiceOfferingDao
_serviceOfferingDao
;
static
SnapshotDao
_snapshotDao
;
static
PrimaryDataStoreDao
_storagePoolDao
;
static
VMTemplateDao
_templateDao
;
static
VMTemplateDetailsDao
_templateDetailsDao
;
static
VMTemplateSwiftDao
_templateSwiftDao
;
static
VMTemplateS3Dao
_templateS3Dao
;
static
UploadDao
_uploadDao
;
static
UserDao
_userDao
;
static
UserStatisticsDao
_userStatsDao
;
static
UserVmDao
_userVmDao
;
static
UserVmJoinDao
_userVmJoinDao
;
static
VlanDao
_vlanDao
;
static
VolumeDao
_volumeDao
;
static
Site2SiteVpnGatewayDao
_site2SiteVpnGatewayDao
;
static
Site2SiteCustomerGatewayDao
_site2SiteCustomerGatewayDao
;
static
DataCenterDao
_zoneDao
;
static
NetworkOfferingDao
_networkOfferingDao
;
static
NetworkDao
_networkDao
;
static
PhysicalNetworkDao
_physicalNetworkDao
;
static
ConfigurationService
_configMgr
;
static
ConfigurationDao
_configDao
;
static
ConsoleProxyDao
_consoleProxyDao
;
static
FirewallRulesCidrsDao
_firewallCidrsDao
;
static
VMInstanceDao
_vmDao
;
static
ResourceLimitService
_resourceLimitMgr
;
static
ProjectService
_projectMgr
;
static
ResourceManager
_resourceMgr
;
static
AccountDetailsDao
_accountDetailsDao
;
static
NetworkDomainDao
_networkDomainDao
;
static
HighAvailabilityManager
_haMgr
;
static
VpcManager
_vpcMgr
;
static
TaggedResourceService
_taggedResourceService
;
static
UserVmDetailsDao
_userVmDetailsDao
;
static
SSHKeyPairDao
_sshKeyPairDao
;
static
ConditionDao
_asConditionDao
;
static
AutoScalePolicyConditionMapDao
_asPolicyConditionMapDao
;
static
AutoScaleVmGroupPolicyMapDao
_asVmGroupPolicyMapDao
;
static
AutoScalePolicyDao
_asPolicyDao
;
static
AutoScaleVmProfileDao
_asVmProfileDao
;
static
AutoScaleVmGroupDao
_asVmGroupDao
;
static
CounterDao
_counterDao
;
static
ResourceTagJoinDao
_tagJoinDao
;
static
EventJoinDao
_eventJoinDao
;
static
InstanceGroupJoinDao
_vmGroupJoinDao
;
static
UserAccountJoinDao
_userAccountJoinDao
;
static
ProjectJoinDao
_projectJoinDao
;
static
ProjectAccountJoinDao
_projectAccountJoinDao
;
static
ProjectInvitationJoinDao
_projectInvitationJoinDao
;
static
HostJoinDao
_hostJoinDao
;
static
VolumeJoinDao
_volJoinDao
;
static
StoragePoolJoinDao
_poolJoinDao
;
static
ImageStoreJoinDao
_imageStoreJoinDao
;
static
AccountJoinDao
_accountJoinDao
;
static
AsyncJobJoinDao
_jobJoinDao
;
static
TemplateJoinDao
_templateJoinDao
;
static
PhysicalNetworkTrafficTypeDao
_physicalNetworkTrafficTypeDao
;
static
PhysicalNetworkServiceProviderDao
_physicalNetworkServiceProviderDao
;
static
FirewallRulesDao
_firewallRuleDao
;
static
StaticRouteDao
_staticRouteDao
;
static
VpcGatewayDao
_vpcGatewayDao
;
static
VpcDao
_vpcDao
;
static
VpcOfferingDao
_vpcOfferingDao
;
static
SnapshotPolicyDao
_snapshotPolicyDao
;
static
AsyncJobDao
_asyncJobDao
;
static
HostDetailsDao
_hostDetailsDao
;
static
VMSnapshotDao
_vmSnapshotDao
;
static
ClusterDetailsDao
_clusterDetailsDao
;
static
NicSecondaryIpDao
_nicSecondaryIpDao
;
static
VpcProvisioningService
_vpcProvSvc
;
static
AffinityGroupDao
_affinityGroupDao
;
static
AffinityGroupJoinDao
_affinityGroupJoinDao
;
static
GlobalLoadBalancingRulesService
_gslbService
;
static
NetworkACLDao
_networkACLDao
;
@
Inject
private
ManagementServer
ms
;
@
Inject
public
AsyncJobManager
asyncMgr
;
@
Inject
private
SecurityGroupManager
securityGroupMgr
;
@
Inject
private
StorageManager
storageMgr
;
@
Inject
private
UserVmManager
userVmMgr
;
@
Inject
private
NetworkModel
networkModel
;
@
Inject
private
NetworkManager
networkMgr
;
@
Inject
private
StatsCollector
statsCollector
;
@
Inject
private
TemplateManager
templateMgr
;
@
Inject
private
VolumeManager
volumeMgr
;
@
Inject
private
AccountDao
accountDao
;
@
Inject
private
AccountVlanMapDao
accountVlanMapDao
;
@
Inject
private
ClusterDao
clusterDao
;
@
Inject
private
CapacityDao
capacityDao
;
@
Inject
private
DataCenterJoinDao
dcJoinDao
;
@
Inject
private
DiskOfferingDao
diskOfferingDao
;
@
Inject
private
DiskOfferingJoinDao
diskOfferingJoinDao
;
@
Inject
private
DomainDao
domainDao
;
@
Inject
private
DomainRouterDao
domainRouterDao
;
@
Inject
private
DomainRouterJoinDao
domainRouterJoinDao
;
@
Inject
private
GuestOSDao
guestOSDao
;
@
Inject
private
GuestOSCategoryDao
guestOSCategoryDao
;
@
Inject
private
HostDao
hostDao
;
@
Inject
private
AccountGuestVlanMapDao
accountGuestVlanMapDao
;
@
Inject
private
IPAddressDao
ipAddressDao
;
@
Inject
private
LoadBalancerDao
loadBalancerDao
;
@
Inject
private
SecurityGroupDao
securityGroupDao
;
@
Inject
private
SecurityGroupJoinDao
securityGroupJoinDao
;
@
Inject
private
ServiceOfferingJoinDao
serviceOfferingJoinDao
;
@
Inject
private
NetworkRuleConfigDao
networkRuleConfigDao
;
@
Inject
private
HostPodDao
podDao
;
@
Inject
private
ServiceOfferingDao
serviceOfferingDao
;
@
Inject
private
SnapshotDao
snapshotDao
;
@
Inject
private
PrimaryDataStoreDao
storagePoolDao
;
@
Inject
private
VMTemplateDao
templateDao
;
@
Inject
private
VMTemplateDetailsDao
templateDetailsDao
;
@
Inject
private
VMTemplateSwiftDao
templateSwiftDao
;
@
Inject
private
VMTemplateS3Dao
templateS3Dao
;
@
Inject
private
UploadDao
uploadDao
;
@
Inject
private
UserDao
userDao
;
@
Inject
private
UserStatisticsDao
userStatsDao
;
@
Inject
private
UserVmDao
userVmDao
;
@
Inject
private
UserVmJoinDao
userVmJoinDao
;
@
Inject
private
VlanDao
vlanDao
;
@
Inject
private
VolumeDao
volumeDao
;
@
Inject
private
Site2SiteVpnGatewayDao
site2SiteVpnGatewayDao
;
@
Inject
private
Site2SiteCustomerGatewayDao
site2SiteCustomerGatewayDao
;
@
Inject
private
DataCenterDao
zoneDao
;
@
Inject
private
NetworkOfferingDao
networkOfferingDao
;
@
Inject
private
NetworkDao
networkDao
;
@
Inject
private
PhysicalNetworkDao
physicalNetworkDao
;
@
Inject
private
ConfigurationService
configMgr
;
@
Inject
private
ConfigurationDao
configDao
;
@
Inject
private
ConsoleProxyDao
consoleProxyDao
;
@
Inject
private
FirewallRulesCidrsDao
firewallCidrsDao
;
@
Inject
private
VMInstanceDao
vmDao
;
@
Inject
private
ResourceLimitService
resourceLimitMgr
;
@
Inject
private
ProjectService
projectMgr
;
@
Inject
private
ResourceManager
resourceMgr
;
@
Inject
private
AccountDetailsDao
accountDetailsDao
;
@
Inject
private
NetworkDomainDao
networkDomainDao
;
@
Inject
private
HighAvailabilityManager
haMgr
;
@
Inject
private
VpcManager
vpcMgr
;
@
Inject
private
TaggedResourceService
taggedResourceService
;
@
Inject
private
UserVmDetailsDao
userVmDetailsDao
;
@
Inject
private
SSHKeyPairDao
sshKeyPairDao
;
@
Inject
private
ConditionDao
asConditionDao
;
@
Inject
private
AutoScalePolicyConditionMapDao
asPolicyConditionMapDao
;
@
Inject
private
AutoScaleVmGroupPolicyMapDao
asVmGroupPolicyMapDao
;
@
Inject
private
AutoScalePolicyDao
asPolicyDao
;
@
Inject
private
AutoScaleVmProfileDao
asVmProfileDao
;
@
Inject
private
AutoScaleVmGroupDao
asVmGroupDao
;
@
Inject
private
CounterDao
counterDao
;
@
Inject
private
ResourceTagJoinDao
tagJoinDao
;
@
Inject
private
EventJoinDao
eventJoinDao
;
@
Inject
private
InstanceGroupJoinDao
vmGroupJoinDao
;
@
Inject
private
UserAccountJoinDao
userAccountJoinDao
;
@
Inject
private
ProjectJoinDao
projectJoinDao
;
@
Inject
private
ProjectAccountJoinDao
projectAccountJoinDao
;
@
Inject
private
ProjectInvitationJoinDao
projectInvitationJoinDao
;
@
Inject
private
HostJoinDao
hostJoinDao
;
@
Inject
private
VolumeJoinDao
volJoinDao
;
@
Inject
private
StoragePoolJoinDao
poolJoinDao
;
@
Inject
private
ImageStoreJoinDao
imageStoreJoinDao
;
@
Inject
private
AccountJoinDao
accountJoinDao
;
@
Inject
private
AsyncJobJoinDao
jobJoinDao
;
@
Inject
private
TemplateJoinDao
templateJoinDao
;
@
Inject
private
PhysicalNetworkTrafficTypeDao
physicalNetworkTrafficTypeDao
;
@
Inject
private
PhysicalNetworkServiceProviderDao
physicalNetworkServiceProviderDao
;
@
Inject
private
FirewallRulesDao
firewallRuleDao
;
@
Inject
private
StaticRouteDao
staticRouteDao
;
@
Inject
private
VpcGatewayDao
vpcGatewayDao
;
@
Inject
private
VpcDao
vpcDao
;
@
Inject
private
VpcOfferingDao
vpcOfferingDao
;
@
Inject
private
SnapshotPolicyDao
snapshotPolicyDao
;
@
Inject
private
AsyncJobDao
asyncJobDao
;
@
Inject
private
HostDetailsDao
hostDetailsDao
;
@
Inject
private
ClusterDetailsDao
clusterDetailsDao
;
@
Inject
private
VMSnapshotDao
vmSnapshotDao
;
@
Inject
private
NicSecondaryIpDao
nicSecondaryIpDao
;
@
Inject
private
VpcProvisioningService
vpcProvSvc
;
@
Inject
private
ApplicationLoadBalancerRuleDao
_appLbDao
;
@
Inject
private
AffinityGroupDao
affinityGroupDao
;
@
Inject
private
AffinityGroupJoinDao
affinityGroupJoinDao
;
@
Inject
private
GlobalLoadBalancingRulesService
gslbService
;
@
Inject
private
NetworkACLDao
networkACLDao
;
@
PostConstruct
void
init
() {
_ms
=
ms
;
_asyncMgr
=
asyncMgr
;
_securityGroupMgr
=
securityGroupMgr
;
_storageMgr
=
storageMgr
;
_userVmMgr
=
userVmMgr
;
_networkModel
=
networkModel
;
_networkMgr
=
networkMgr
;
_configMgr
=
configMgr
;
_templateMgr
=
templateMgr
;
_accountDao
=
accountDao
;
_accountGuestVlanMapDao
=
accountGuestVlanMapDao
;
_accountVlanMapDao
=
accountVlanMapDao
;
_clusterDao
=
clusterDao
;
_capacityDao
=
capacityDao
;
_dcJoinDao
=
dcJoinDao
;
_diskOfferingDao
=
diskOfferingDao
;
_diskOfferingJoinDao
=
diskOfferingJoinDao
;
_domainDao
=
domainDao
;
_domainRouterDao
=
domainRouterDao
;
_domainRouterJoinDao
=
domainRouterJoinDao
;
_guestOSDao
=
guestOSDao
;
_guestOSCategoryDao
=
guestOSCategoryDao
;
_hostDao
=
hostDao
;
_ipAddressDao
=
ipAddressDao
;
_loadBalancerDao
=
loadBalancerDao
;
_networkRuleConfigDao
=
networkRuleConfigDao
;
_podDao
=
podDao
;
_serviceOfferingDao
=
serviceOfferingDao
;
_serviceOfferingJoinDao
=
serviceOfferingJoinDao
;
_snapshotDao
=
snapshotDao
;
_storagePoolDao
=
storagePoolDao
;
_templateDao
=
templateDao
;
_templateDetailsDao
=
templateDetailsDao
;
_templateSwiftDao
=
templateSwiftDao
;
_templateS3Dao
=
templateS3Dao
;
_uploadDao
=
uploadDao
;
_userDao
=
userDao
;
_userStatsDao
=
userStatsDao
;
_userVmDao
=
userVmDao
;
_userVmJoinDao
=
userVmJoinDao
;
_vlanDao
=
vlanDao
;
_volumeDao
=
volumeDao
;
_site2SiteVpnGatewayDao
=
site2SiteVpnGatewayDao
;
_site2SiteCustomerGatewayDao
=
site2SiteCustomerGatewayDao
;
_zoneDao
=
zoneDao
;
_securityGroupDao
=
securityGroupDao
;
_securityGroupJoinDao
=
securityGroupJoinDao
;
_networkOfferingDao
=
networkOfferingDao
;
_networkDao
=
networkDao
;
_physicalNetworkDao
=
physicalNetworkDao
;
_configDao
=
configDao
;
_consoleProxyDao
=
consoleProxyDao
;
_firewallCidrsDao
=
firewallCidrsDao
;
_vmDao
=
vmDao
;
_resourceLimitMgr
=
resourceLimitMgr
;
_projectMgr
=
projectMgr
;
_resourceMgr
=
resourceMgr
;
_accountDetailsDao
=
accountDetailsDao
;
_networkDomainDao
=
networkDomainDao
;
_haMgr
=
haMgr
;
_vpcMgr
=
vpcMgr
;
_taggedResourceService
=
taggedResourceService
;
_sshKeyPairDao
=
sshKeyPairDao
;
_userVmDetailsDao
=
userVmDetailsDao
;
_asConditionDao
=
asConditionDao
;
_asPolicyDao
=
asPolicyDao
;
_asPolicyConditionMapDao
=
asPolicyConditionMapDao
;
_counterDao
=
counterDao
;
_asVmGroupPolicyMapDao
=
asVmGroupPolicyMapDao
;
_tagJoinDao
=
tagJoinDao
;
_vmGroupJoinDao
=
vmGroupJoinDao
;
_eventJoinDao
=
eventJoinDao
;
_userAccountJoinDao
=
userAccountJoinDao
;
_projectJoinDao
=
projectJoinDao
;
_projectAccountJoinDao
=
projectAccountJoinDao
;
_projectInvitationJoinDao
=
projectInvitationJoinDao
;
_hostJoinDao
=
hostJoinDao
;
_volJoinDao
=
volJoinDao
;
_poolJoinDao
=
poolJoinDao
;
_imageStoreJoinDao
=
imageStoreJoinDao
;
_accountJoinDao
=
accountJoinDao
;
_jobJoinDao
=
jobJoinDao
;
_templateJoinDao
=
templateJoinDao
;
_physicalNetworkTrafficTypeDao
=
physicalNetworkTrafficTypeDao
;
_physicalNetworkServiceProviderDao
=
physicalNetworkServiceProviderDao
;
_firewallRuleDao
=
firewallRuleDao
;
_staticRouteDao
=
staticRouteDao
;
_vpcGatewayDao
=
vpcGatewayDao
;
_asVmProfileDao
=
asVmProfileDao
;
_asVmGroupDao
=
asVmGroupDao
;
_vpcDao
=
vpcDao
;
_vpcOfferingDao
=
vpcOfferingDao
;
_snapshotPolicyDao
=
snapshotPolicyDao
;
_asyncJobDao
=
asyncJobDao
;
_hostDetailsDao
=
hostDetailsDao
;
_clusterDetailsDao
=
clusterDetailsDao
;
_vmSnapshotDao
=
vmSnapshotDao
;
_nicSecondaryIpDao
=
nicSecondaryIpDao
;
_vpcProvSvc
=
vpcProvSvc
;
_affinityGroupDao
=
affinityGroupDao
;
_affinityGroupJoinDao
=
affinityGroupJoinDao
;
_gslbService
=
gslbService
;
// Note: stats collector should already have been initialized by this time, otherwise a null instance is returned
_statsCollector
=
StatsCollector
.
getInstance
();
_networkACLDao
=
networkACLDao
;
}
// ///////////////////////////////////////////////////////////
// ManagementServer methods //
// ///////////////////////////////////////////////////////////
public
static
VMInstanceVO
findVMInstanceById
(
long
vmId
) {
return
_vmDao
.
findById
(
vmId
);
}
public
static
long
getMemoryOrCpuCapacitybyHost
(
Long
hostId
,
short
capacityType
) {
// TODO: This method is for the API only, but it has configuration values (ramSize for system vms)
// so if this Utils class can have some kind of config rather than a static initializer (maybe from
// management server instantiation?) then maybe the management server method can be moved entirely
// into this utils class.
return
_ms
.
getMemoryOrCpuCapacityByHost
(
hostId
,
capacityType
);
}
public
static
long
getStorageCapacitybyPool
(
Long
poolId
,
short
capacityType
) {
// TODO: This method is for the API only, but it has configuration values (ramSize for system vms)
// so if this Utils class can have some kind of config rather than a static initializer (maybe from
// management server instantiation?) then maybe the management server method can be moved entirely
// into this utils class.
return
_ms
.
getMemoryOrCpuCapacityByHost
(
poolId
,
capacityType
);
}
public
static
List
<
SummedCapacity
>
getCapacityByClusterPodZone
(
Long
zoneId
,
Long
podId
,
Long
clusterId
){
return
_capacityDao
.
findByClusterPodZone
(
zoneId
,
podId
,
clusterId
);
}
public
static
List
<
SummedCapacity
>
findNonSharedStorageForClusterPodZone
(
Long
zoneId
,
Long
podId
,
Long
clusterId
){
return
_capacityDao
.
findNonSharedStorageForClusterPodZone
(
zoneId
,
podId
,
clusterId
);
}
public
static
List
<
CapacityVO
>
getCapacityByPod
(){
return
null
;
}
public
static
Long
getPodIdForVlan
(
long
vlanDbId
) {
return
_networkModel
.
getPodIdForVlan
(
vlanDbId
);
}
public
static
String
getVersion
() {
return
_ms
.
getVersion
();
}
public
static
List
<
UserVmJoinVO
>
searchForUserVMs
(
Criteria
c
,
List
<
Long
>
permittedAccounts
) {
return
_userVmMgr
.
searchForUserVMs
(
c
,
_accountDao
.
findById
(
Account
.
ACCOUNT_ID_SYSTEM
),
null
,
false
,
permittedAccounts
,
false
,
null
,
null
).
first
();
}
public
static
List
<?
extends
StoragePoolVO
>
searchForStoragePools
(
Criteria
c
) {
return
_ms
.
searchForStoragePools
(
c
).
first
();
}
// ///////////////////////////////////////////////////////////
// Manager methods //
// ///////////////////////////////////////////////////////////
public
static
long
findCorrectResourceLimit
(
ResourceType
type
,
long
accountId
) {
AccountVO
account
=
_accountDao
.
findById
(
accountId
);
if
(
account
==
null
) {
return
-
1
;
}
return
_resourceLimitMgr
.
findCorrectResourceLimitForAccount
(
account
,
type
);
}
public
static
long
findCorrectResourceLimit
(
Long
limit
,
short
accountType
,
ResourceType
type
) {
return
_resourceLimitMgr
.
findCorrectResourceLimitForAccount
(
accountType
,
limit
,
type
);
}
public
static
long
getResourceCount
(
ResourceType
type
,
long
accountId
) {
AccountVO
account
=
_accountDao
.
findById
(
accountId
);
if
(
account
==
null
) {
return
-
1
;
}
return
_resourceLimitMgr
.
getResourceCount
(
account
,
type
);
}
public
static
String
getSecurityGroupsNamesForVm
(
long
vmId
) {
return
_securityGroupMgr
.
getSecurityGroupsNamesForVm
(
vmId
);
}
public
static
List
<
SecurityGroupVO
>
getSecurityGroupsForVm
(
long
vmId
) {
return
_securityGroupMgr
.
getSecurityGroupsForVm
(
vmId
);
}
public
static
String
getSnapshotIntervalTypes
(
long
snapshotId
) {
SnapshotVO
snapshot
=
_snapshotDao
.
findById
(
snapshotId
);
return
snapshot
.
getRecurringType
().
name
();
}
public
static
String
getStoragePoolTags
(
long
poolId
) {
return
_storageMgr
.
getStoragePoolTags
(
poolId
);
}
public
static
boolean
isLocalStorageActiveOnHost
(
Long
hostId
) {
return
_storageMgr
.
isLocalStorageActiveOnHost
(
hostId
);
}
public
static
InstanceGroupVO
findInstanceGroupForVM
(
long
vmId
) {
return
_userVmMgr
.
getGroupForVm
(
vmId
);
}
// ///////////////////////////////////////////////////////////
// Misc methods //
// ///////////////////////////////////////////////////////////
public
static
HostStats
getHostStatistics
(
long
hostId
) {
return
_statsCollector
.
getHostStats
(
hostId
);
}
public
static
StorageStats
getStoragePoolStatistics
(
long
id
) {
return
_statsCollector
.
getStoragePoolStats
(
id
);
}
public
static
VmStats
getVmStatistics
(
long
hostId
) {
return
_statsCollector
.
getVmStats
(
hostId
);
}
public
static
StorageStats
getSecondaryStorageStatistics
(
long
id
) {
return
_statsCollector
.
getStorageStats
(
id
);
}
public
static
CapacityVO
getStoragePoolUsedStats
(
Long
poolId
,
Long
clusterId
,
Long
podId
,
Long
zoneId
){
return
_storageMgr
.
getStoragePoolUsedStats
(
poolId
,
clusterId
,
podId
,
zoneId
);
}
public
static
CapacityVO
getSecondaryStorageUsedStats
(
Long
hostId
,
Long
zoneId
){
return
_storageMgr
.
getSecondaryStorageUsedStats
(
hostId
,
zoneId
);
}
// ///////////////////////////////////////////////////////////
// Dao methods //
// ///////////////////////////////////////////////////////////
public
static
Account
findAccountById
(
Long
accountId
) {
return
_accountDao
.
findByIdIncludingRemoved
(
accountId
);
}
public
static
Account
findAccountByIdIncludingRemoved
(
Long
accountId
) {
return
_accountDao
.
findByIdIncludingRemoved
(
accountId
);
}
public
static
Account
findAccountByNameDomain
(
String
accountName
,
Long
domainId
) {
return
_accountDao
.
findActiveAccount
(
accountName
,
domainId
);
}
public
static
ClusterVO
findClusterById
(
long
clusterId
) {
return
_clusterDao
.
findById
(
clusterId
);
}
public
static
ClusterDetailsVO
findClusterDetails
(
long
clusterId
,
String
name
){
return
_clusterDetailsDao
.
findDetail
(
clusterId
,
name
);
}
public
static
DiskOfferingVO
findDiskOfferingById
(
Long
diskOfferingId
) {
return
_diskOfferingDao
.
findByIdIncludingRemoved
(
diskOfferingId
);
}
public
static
DomainVO
findDomainById
(
Long
domainId
) {
return
_domainDao
.
findByIdIncludingRemoved
(
domainId
);
}
public
static
DomainVO
findDomainByIdIncludingRemoved
(
Long
domainId
) {
return
_domainDao
.
findByIdIncludingRemoved
(
domainId
);
}
public
static
boolean
isChildDomain
(
long
parentId
,
long
childId
) {
return
_domainDao
.
isChildDomain
(
parentId
,
childId
);
}
public
static
DomainRouterVO
findDomainRouterById
(
Long
routerId
) {
return
_domainRouterDao
.
findByIdIncludingRemoved
(
routerId
);
}
public
static
GuestOS
findGuestOSById
(
Long
id
) {
return
_guestOSDao
.
findByIdIncludingRemoved
(
id
);
}
public
static
GuestOS
findGuestOSByDisplayName
(
String
displayName
) {
return
_guestOSDao
.
listByDisplayName
(
displayName
);
}
public
static
HostVO
findHostById
(
Long
hostId
) {
return
_hostDao
.
findByIdIncludingRemoved
(
hostId
);
}
public
static
IPAddressVO
findIpAddressById
(
long
addressId
) {
return
_ipAddressDao
.
findById
(
addressId
);
}
public
static
GuestOSCategoryVO
getHostGuestOSCategory
(
long
hostId
) {
Long
guestOSCategoryID
=
_resourceMgr
.
getGuestOSCategoryId
(
hostId
);
if
(
guestOSCategoryID
!=
null
) {
return
_guestOSCategoryDao
.
findById
(
guestOSCategoryID
);
}
else
{
return
null
;
}
}
public
static
String
getHostTags
(
long
hostId
) {
return
_resourceMgr
.
getHostTags
(
hostId
);
}
public
static
LoadBalancerVO
findLoadBalancerById
(
Long
loadBalancerId
) {
return
_loadBalancerDao
.
findById
(
loadBalancerId
);
}
public
static
NetworkRuleConfigVO
findNetworkRuleById
(
Long
ruleId
) {
return
_networkRuleConfigDao
.
findById
(
ruleId
);
}
public
static
SecurityGroup
findSecurityGroupById
(
Long
groupId
) {
return
_securityGroupDao
.
findById
(
groupId
);
}
public
static
HostPodVO
findPodById
(
Long
podId
) {
return
_podDao
.
findById
(
podId
);
}
public
static
VolumeVO
findRootVolume
(
long
vmId
) {
List
<
VolumeVO
>
volumes
=
_volumeDao
.
findByInstanceAndType
(
vmId
,
Type
.
ROOT
);
if
(
volumes
!=
null
&&
volumes
.
size
() ==
1
) {
return
volumes
.
get
(
0
);
}
else
{
return
null
;
}
}
public
static
ServiceOffering
findServiceOfferingById
(
Long
serviceOfferingId
) {
return
_serviceOfferingDao
.
findByIdIncludingRemoved
(
serviceOfferingId
);
}
public
static
Snapshot
findSnapshotById
(
long
snapshotId
) {
SnapshotVO
snapshot
=
_snapshotDao
.
findById
(
snapshotId
);
if
(
snapshot
!=
null
&&
snapshot
.
getRemoved
() ==
null
&&
snapshot
.
getState
() ==
Snapshot
.
State
.
BackedUp
) {
return
snapshot
;
}
else
{
return
null
;
}
}
public
static
StoragePoolVO
findStoragePoolById
(
Long
storagePoolId
) {
return
_storagePoolDao
.
findByIdIncludingRemoved
(
storagePoolId
);
}
public
static
VMTemplateVO
findTemplateById
(
Long
templateId
) {
VMTemplateVO
template
=
_templateDao
.
findByIdIncludingRemoved
(
templateId
);
if
(
template
!=
null
) {
Map
details
=
_templateDetailsDao
.
findDetails
(
templateId
);
if
(
details
!=
null
&& !
details
.
isEmpty
())
template
.
setDetails
(
details
);
}
return
template
;
}
public
static
VMTemplateSwiftVO
findTemplateSwiftRef
(
long
templateId
) {
return
_templateSwiftDao
.
findOneByTemplateId
(
templateId
);
}
public
static
VMTemplateS3VO
findTemplateS3Ref
(
long
templateId
) {
return
_templateS3Dao
.
findOneByTemplateId
(
templateId
);
}
public
static
UploadVO
findUploadById
(
Long
id
) {
return
_uploadDao
.
findById
(
id
);
}
public
static
User
findUserById
(
Long
userId
) {
return
_userDao
.
findById
(
userId
);
}
public
static
UserVm
findUserVmById
(
Long
vmId
) {
return
_userVmDao
.
findById
(
vmId
);
}
public
static
VlanVO
findVlanById
(
long
vlanDbId
) {
return
_vlanDao
.
findById
(
vlanDbId
);
}
public
static
VolumeVO
findVolumeById
(
Long
volumeId
) {
return
_volumeDao
.
findByIdIncludingRemoved
(
volumeId
);
}
public
static
Site2SiteVpnGatewayVO
findVpnGatewayById
(
Long
vpnGatewayId
) {
return
_site2SiteVpnGatewayDao
.
findById
(
vpnGatewayId
);
}
public
static
Site2SiteCustomerGatewayVO
findCustomerGatewayById
(
Long
customerGatewayId
) {
return
_site2SiteCustomerGatewayDao
.
findById
(
customerGatewayId
);
}
public
static
List
<
UserVO
>
listUsersByAccount
(
long
accountId
) {
return
_userDao
.
listByAccount
(
accountId
);
}
public
static
DataCenterVO
findZoneById
(
Long
zoneId
) {
return
_zoneDao
.
findById
(
zoneId
);
}
public
static
Long
getAccountIdForVlan
(
long
vlanDbId
) {
List
<
AccountVlanMapVO
>
accountVlanMaps
=
_accountVlanMapDao
.
listAccountVlanMapsByVlan
(
vlanDbId
);
if
(
accountVlanMaps
.
isEmpty
()) {
return
null
;
}
else
{
return
accountVlanMaps
.
get
(
0
).
getAccountId
();
}
}
public
static
Long
getAccountIdForGuestVlan
(
long
vlanDbId
) {
List
<
AccountGuestVlanMapVO
>
accountGuestVlanMaps
=
_accountGuestVlanMapDao
.
listAccountGuestVlanMapsByVlan
(
vlanDbId
);
if
(
accountGuestVlanMaps
.
isEmpty
()) {
return
null
;
}
else
{
return
accountGuestVlanMaps
.
get
(
0
).
getAccountId
();
}
}
public
static
HypervisorType
getVolumeHyperType
(
long
volumeId
) {
return
_volumeDao
.
getHypervisorType
(
volumeId
);
}
public
static
HypervisorType
getHypervisorTypeFromFormat
(
ImageFormat
format
){
return
_storageMgr
.
getHypervisorTypeFromFormat
(
format
);
}
public
static
List
<
UserStatisticsVO
>
listUserStatsBy
(
Long
accountId
) {
return
_userStatsDao
.
listBy
(
accountId
);
}
public
static
List
<
UserVmVO
>
listUserVMsByHostId
(
long
hostId
) {
return
_userVmDao
.
listByHostId
(
hostId
);
}
public
static
List
<
DataCenterVO
>
listZones
() {
return
_zoneDao
.
listAll
();
}
public
static
boolean
volumeIsOnSharedStorage
(
long
volumeId
) {
// Check that the volume is valid
VolumeVO
volume
=
_volumeDao
.
findById
(
volumeId
);
if
(
volume
==
null
) {
throw
new
InvalidParameterValueException
(
"Please specify a valid volume ID."
);
}
return
_volumeMgr
.
volumeOnSharedStoragePool
(
volume
);
}
public
static
List
<
NicProfile
>
getNics
(
VirtualMachine
vm
) {
return
_networkMgr
.
getNicProfiles
(
vm
);
}
public
static
NetworkProfile
getNetworkProfile
(
long
networkId
) {
return
_networkMgr
.
convertNetworkToNetworkProfile
(
networkId
);
}
public
static
NetworkOfferingVO
findNetworkOfferingById
(
long
networkOfferingId
) {
return
_networkOfferingDao
.
findByIdIncludingRemoved
(
networkOfferingId
);
}
public
static
List
<?
extends
Vlan
>
listVlanByNetworkId
(
long
networkId
) {
return
_vlanDao
.
listVlansByNetworkId
(
networkId
);
}
public
static
PhysicalNetworkVO
findPhysicalNetworkById
(
long
id
) {
return
_physicalNetworkDao
.
findById
(
id
);
}
public
static
PhysicalNetworkTrafficTypeVO
findPhysicalNetworkTrafficTypeById
(
long
id
) {
return
_physicalNetworkTrafficTypeDao
.
findById
(
id
);
View remainder of file in raw view
Back
|
FazBrowse Home
|
New Git URL