Skip to content

Commit 550f4fb

Browse files
committed
create template/primary data store is done
1 parent 573d13d commit 550f4fb

46 files changed

Lines changed: 682 additions & 189 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

developer/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
<mainClass>com.cloud.upgrade.DatabaseCreator</mainClass>
146146
<arguments>
147147
<argument>${basedir}/target/db/create-schema.sql</argument>
148+
<argument>${basedir}/target/db/4.1-new-db-schema.sql</argument>
148149
<argument>${basedir}/target/db/create-schema-premium.sql</argument>
149150
<argument>com.cloud.upgrade.DatabaseUpgradeChecker</argument>
150151
</arguments>

engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VolumeEntity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,5 @@ public interface VolumeEntity extends CloudStackEntity {
8282
VolumeType getType();
8383
StorageEntity getDataStore();
8484
void setPath(String path);
85+
boolean createVolumeFromTemplate(long dataStoreId, VolumeDiskType diskType, TemplateEntity template);
8586
}

engine/storage/src/org/apache/cloudstack/storage/StorageOrchestratorImpl.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ protected Volume copyVolumeFromBackupStorage(VolumeVO volume, DataStore destStor
110110
if (!ds.contains(volume)) {
111111
throw new CloudRuntimeException("volume: " + volume + "doesn't exist on backup storage");
112112
}
113-
113+
/*
114114
VolumeProfile vp = ds.prepareVolume(volume, destStore);
115115
116116
VolumeStrategy vs = destStore.getVolumeStrategy();
@@ -130,12 +130,15 @@ protected Volume copyVolumeFromBackupStorage(VolumeVO volume, DataStore destStor
130130
txn.commit();
131131
132132
return destVolume;
133+
*/
134+
return null;
133135
}
134136

135137
@DB
136138
protected Volume migrateVolume(VolumeVO volume, DataStore srcStore, DataStore destStore, String reservationId) throws NoTransitionException {
137139
Transaction txn = Transaction.currentTxn();
138140
txn.start();
141+
/*
139142
volume.setReservationId(reservationId);
140143
volume = _volumeMgr.processEvent(volume, Volume.Event.MigrationRequested);
141144
Volume destVolume = _volumeMgr.allocateDuplicateVolume(volume);
@@ -156,12 +159,15 @@ protected Volume migrateVolume(VolumeVO volume, DataStore srcStore, DataStore de
156159
157160
_volumeMgr.processEvent(volume, Volume.Event.OperationSucceeded);
158161
return destVolume;
162+
*/
163+
return null;
159164
}
160165

161166
@DB
162167
protected Volume recreateVolume(VolumeVO srcVolume, DataStore destStore, String reservationId) throws NoTransitionException {
163168
Transaction txn = Transaction.currentTxn();
164169
txn.start();
170+
/*
165171
srcVolume.setReservationId(reservationId);
166172
srcVolume = _volumeMgr.processEvent(srcVolume, Volume.Event.CopyRequested);
167173
Volume destVolume = _volumeMgr.allocateDuplicateVolume(srcVolume);
@@ -185,10 +191,13 @@ protected Volume recreateVolume(VolumeVO srcVolume, DataStore destStore, String
185191
_volumeMgr.processEvent(srcVolume, Volume.Event.OperationSucceeded);
186192
187193
return destVolume;
194+
*/
195+
return null;
188196
}
189197

190198
protected Volume createVolumeOnStorage(Volume volume, DataStore destStore, String reservationId) throws NoTransitionException {
191199
VolumeStrategy vs = destStore.getVolumeStrategy();
200+
/*
192201
volume.setReservationId(reservationId);
193202
volume = _volumeMgr.processEvent(volume, Volume.Event.CreateRequested);
194203
@@ -208,6 +217,8 @@ protected Volume createVolumeOnStorage(Volume volume, DataStore destStore, Strin
208217
209218
volume = _volumeMgr.processEvent(volume, Volume.Event.OperationSucceeded);
210219
return volume;
220+
*/
221+
return null;
211222
}
212223

213224
@DB

engine/storage/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStoreImpl.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
1313
import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType;
1414
import org.apache.cloudstack.storage.HypervisorHostEndPoint;
15-
import org.apache.cloudstack.storage.datastore.db.DataStoreVO;
15+
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreVO;
1616
import org.apache.cloudstack.storage.datastore.driver.PrimaryDataStoreDriver;
1717
import org.apache.cloudstack.storage.image.TemplateInfo;
1818
import org.apache.cloudstack.storage.image.TemplateObject;
@@ -38,16 +38,16 @@
3838
public class DefaultPrimaryDataStoreImpl implements PrimaryDataStore {
3939
private static final Logger s_logger = Logger.getLogger(DefaultPrimaryDataStoreImpl.class);
4040
protected PrimaryDataStoreDriver driver;
41-
protected DataStoreVO pdsv;
41+
protected PrimaryDataStoreVO pdsv;
4242
protected PrimaryDataStoreInfo pdsInfo;
4343
@Inject
4444
private VolumeDao volumeDao;
45-
@Inject
45+
//@Inject
4646
private HostDao hostDao;
4747
@Inject
4848
TemplatePrimaryDataStoreManager templatePrimaryStoreMgr;
4949

50-
public DefaultPrimaryDataStoreImpl(PrimaryDataStoreDriver driver, DataStoreVO pdsv, PrimaryDataStoreInfo pdsInfo) {
50+
public DefaultPrimaryDataStoreImpl(PrimaryDataStoreDriver driver, PrimaryDataStoreVO pdsv, PrimaryDataStoreInfo pdsInfo) {
5151
this.driver = driver;
5252
this.pdsv = pdsv;
5353
this.pdsInfo = pdsInfo;
@@ -56,7 +56,7 @@ public DefaultPrimaryDataStoreImpl(PrimaryDataStoreDriver driver, DataStoreVO pd
5656
@Override
5757
public VolumeInfo getVolume(long id) {
5858
VolumeVO volumeVO = volumeDao.findById(id);
59-
VolumeObject vol = new VolumeObject(this, volumeVO);
59+
VolumeObject vol = VolumeObject.getVolumeObject(this, volumeVO);
6060
return vol;
6161
}
6262

@@ -155,8 +155,7 @@ public VolumeDiskType getDefaultDiskType() {
155155

156156
@Override
157157
public long getId() {
158-
// TODO Auto-generated method stub
159-
return 0;
158+
return pdsv.getId();
160159
}
161160

162161
@Override

engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@
2525

2626
import com.cloud.utils.db.GenericDao;
2727

28-
public interface PrimaryDataStoreDao extends GenericDao<DataStoreVO, Long> {
28+
public interface PrimaryDataStoreDao extends GenericDao<PrimaryDataStoreVO, Long> {
2929

3030
/**
3131
* @param datacenterId
3232
* -- the id of the datacenter (availability zone)
3333
*/
34-
List<DataStoreVO> listByDataCenterId(long datacenterId);
34+
List<PrimaryDataStoreVO> listByDataCenterId(long datacenterId);
3535

3636
/**
3737
* @param datacenterId
3838
* -- the id of the datacenter (availability zone)
3939
*/
40-
List<DataStoreVO> listBy(long datacenterId, long podId, Long clusterId);
40+
List<PrimaryDataStoreVO> listBy(long datacenterId, long podId, Long clusterId);
4141

4242
/**
4343
* Set capacity of storage pool in bytes
@@ -59,7 +59,7 @@ public interface PrimaryDataStoreDao extends GenericDao<DataStoreVO, Long> {
5959
*/
6060
void updateAvailable(long id, long available);
6161

62-
DataStoreVO persist(DataStoreVO pool, Map<String, String> details);
62+
PrimaryDataStoreVO persist(PrimaryDataStoreVO pool, Map<String, String> details);
6363

6464
/**
6565
* Find pool by name.
@@ -68,7 +68,7 @@ public interface PrimaryDataStoreDao extends GenericDao<DataStoreVO, Long> {
6868
* name of pool.
6969
* @return the single StoragePoolVO
7070
*/
71-
List<DataStoreVO> findPoolByName(String name);
71+
List<PrimaryDataStoreVO> findPoolByName(String name);
7272

7373
/**
7474
* Find pools by the pod that matches the details.
@@ -79,9 +79,9 @@ public interface PrimaryDataStoreDao extends GenericDao<DataStoreVO, Long> {
7979
* details to match. All must match for the pool to be returned.
8080
* @return List of StoragePoolVO
8181
*/
82-
List<DataStoreVO> findPoolsByDetails(long dcId, long podId, Long clusterId, Map<String, String> details);
82+
List<PrimaryDataStoreVO> findPoolsByDetails(long dcId, long podId, Long clusterId, Map<String, String> details);
8383

84-
List<DataStoreVO> findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared);
84+
List<PrimaryDataStoreVO> findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared);
8585

8686
/**
8787
* Find pool by UUID.
@@ -90,27 +90,27 @@ public interface PrimaryDataStoreDao extends GenericDao<DataStoreVO, Long> {
9090
* uuid of pool.
9191
* @return the single StoragePoolVO
9292
*/
93-
DataStoreVO findPoolByUUID(String uuid);
93+
PrimaryDataStoreVO findPoolByUUID(String uuid);
9494

95-
List<DataStoreVO> listByStorageHost(String hostFqdnOrIp);
95+
List<PrimaryDataStoreVO> listByStorageHost(String hostFqdnOrIp);
9696

97-
DataStoreVO findPoolByHostPath(long dcId, Long podId, String host, String path, String uuid);
97+
PrimaryDataStoreVO findPoolByHostPath(long dcId, Long podId, String host, String path, String uuid);
9898

99-
List<DataStoreVO> listPoolByHostPath(String host, String path);
99+
List<PrimaryDataStoreVO> listPoolByHostPath(String host, String path);
100100

101101
void updateDetails(long poolId, Map<String, String> details);
102102

103103
Map<String, String> getDetails(long poolId);
104104

105105
List<String> searchForStoragePoolDetails(long poolId, String value);
106106

107-
List<DataStoreVO> findIfDuplicatePoolsExistByUUID(String uuid);
107+
List<PrimaryDataStoreVO> findIfDuplicatePoolsExistByUUID(String uuid);
108108

109-
List<DataStoreVO> listByStatus(DataStoreStatus status);
109+
List<PrimaryDataStoreVO> listByStatus(DataStoreStatus status);
110110

111111
long countPoolsByStatus(DataStoreStatus... statuses);
112112

113-
List<DataStoreVO> listByStatusInZone(long dcId, DataStoreStatus status);
113+
List<PrimaryDataStoreVO> listByStatusInZone(long dcId, DataStoreStatus status);
114114

115-
List<DataStoreVO> listPoolsByCluster(long clusterId);
115+
List<PrimaryDataStoreVO> listPoolsByCluster(long clusterId);
116116
}

0 commit comments

Comments
 (0)