forked from apache/cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVolumeDao.java
More file actions
executable file
·92 lines (64 loc) · 3.07 KB
/
Copy pathVolumeDao.java
File metadata and controls
executable file
·92 lines (64 loc) · 3.07 KB
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
// 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.storage.dao;
import java.util.List;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.Volume;
import com.cloud.storage.VolumeVO;
import com.cloud.utils.Pair;
import com.cloud.utils.db.GenericDao;
import com.cloud.utils.fsm.StateDao;
public interface VolumeDao extends GenericDao<VolumeVO, Long>, StateDao<Volume.State, Volume.Event, Volume> {
List<VolumeVO> findDetachedByAccount(long accountId);
List<VolumeVO> findByAccount(long accountId);
Pair<Long, Long> getCountAndTotalByPool(long poolId);
Pair<Long, Long> getNonDestroyedCountAndTotalByPool(long poolId);
List<VolumeVO> findByInstance(long id);
List<VolumeVO> findByInstanceAndType(long id, Volume.Type vType);
List<VolumeVO> findByInstanceIdDestroyed(long vmId);
List<VolumeVO> findByAccountAndPod(long accountId, long podId);
List<VolumeVO> findByTemplateAndZone(long templateId, long zoneId);
void deleteVolumesByInstance(long instanceId);
void attachVolume(long volumeId, long vmId, long deviceId);
void detachVolume(long volumeId);
boolean isAnyVolumeActivelyUsingTemplateOnPool(long templateId, long poolId);
List<VolumeVO> findCreatedByInstance(long id);
List<VolumeVO> findByPoolId(long poolId);
List<VolumeVO> findByInstanceAndDeviceId(long instanceId, long deviceId);
List<VolumeVO> findUsableVolumesForInstance(long instanceId);
Long countAllocatedVolumesForAccount(long accountId);
HypervisorType getHypervisorType(long volumeId);
List<VolumeVO> listVolumesToBeDestroyed();
ImageFormat getImageFormat(Long volumeId);
List<VolumeVO> findReadyRootVolumesByInstance(long instanceId);
List<Long> listPoolIdsByVolumeCount(long dcId, Long podId, Long clusterId, long accountId);
/**
* Gets the Total Primary Storage space allocated for an account
*
* @param account
* @return total Primary Storage space (in bytes) used
*/
long primaryStorageUsedForAccount(long accountId);
/**
* Gets the Total Secondary Storage space used by volumes allocated for an account
*
* @param account
* @return total Secondary Storage space (in bytes) used
*/
long secondaryStorageUsedForAccount(long accountId);
}