Skip to content

Commit ce77e48

Browse files
FelipeM525JoaoJandre
authored andcommitted
Add new column last_id to the table volumes (apache#9759)
Co-authored-by: João Jandre <[email protected]>
1 parent c028af7 commit ce77e48

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

engine/schema/src/main/java/com/cloud/storage/VolumeVO.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public class VolumeVO implements Volume {
5050
@Column(name = "id")
5151
long id;
5252

53+
@Column(name = "last_id")
54+
private long lastId;
55+
5356
@Column(name = "name")
5457
String name;
5558

@@ -690,4 +693,12 @@ public boolean isDeleteProtection() {
690693
public void setDeleteProtection(boolean deleteProtection) {
691694
this.deleteProtection = deleteProtection;
692695
}
696+
697+
public long getLastId() {
698+
return lastId;
699+
}
700+
701+
public void setLastId(long lastId) {
702+
this.lastId = lastId;
703+
}
693704
}

engine/schema/src/main/resources/META-INF/db/schema-41900to41910.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,6 @@ CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.user_data', 'removed', 'datetime COM
7070
UPDATE `cloud`.`configuration` SET
7171
`options` = 'FirstFitRouting,RandomAllocator,TestingAllocator,FirstFitAllocator,RecreateHostAllocator'
7272
WHERE `name` = 'host.allocators.order';
73+
74+
-- Add last_id to the volumes table
75+
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('volumes','last_id', 'bigint(20) unsigned DEFAULT NULL');

engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2293,6 +2293,8 @@ private void handlePostMigration(boolean success, Map<VolumeInfo, VolumeInfo> sr
22932293
if (success) {
22942294
VolumeVO volumeVO = _volumeDao.findById(destVolumeInfo.getId());
22952295
volumeVO.setFormat(ImageFormat.QCOW2);
2296+
volumeVO.setLastId(srcVolumeInfo.getId());
2297+
22962298
_volumeDao.update(volumeVO.getId(), volumeVO);
22972299

22982300
_volumeService.copyPoliciesBetweenVolumesAndDestroySourceVolumeAfterMigration(Event.OperationSuccessed, null, srcVolumeInfo, destVolumeInfo, false);

engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,6 +1753,7 @@ protected VolumeVO duplicateVolumeOnAnotherStorage(Volume volume, StoragePool po
17531753
newVol.setPassphraseId(volume.getPassphraseId());
17541754
newVol.setEncryptFormat(volume.getEncryptFormat());
17551755
}
1756+
newVol.setLastId(volume.getId());
17561757
return volDao.persist(newVol);
17571758
}
17581759

0 commit comments

Comments
 (0)