Add new column last_id to the table volumes (#9759)

Co-authored-by: João Jandre <48719461+JoaoJandre@users.noreply.github.com>
This commit is contained in:
Felipe 2024-11-28 13:51:53 -03:00 committed by GitHub
parent 37eec06166
commit a8cb7abca3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 0 deletions

View File

@ -48,6 +48,9 @@ public class VolumeVO implements Volume {
@Column(name = "id")
long id;
@Column(name = "last_id")
private long lastId;
@Column(name = "name")
String name;
@ -677,4 +680,12 @@ public class VolumeVO implements Volume {
public String getEncryptFormat() { return encryptFormat; }
public void setEncryptFormat(String encryptFormat) { this.encryptFormat = encryptFormat; }
public long getLastId() {
return lastId;
}
public void setLastId(long lastId) {
this.lastId = lastId;
}
}

View File

@ -70,3 +70,6 @@ CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.user_data', 'removed', 'datetime COM
UPDATE `cloud`.`configuration` SET
`options` = 'FirstFitRouting,RandomAllocator,TestingAllocator,FirstFitAllocator,RecreateHostAllocator'
WHERE `name` = 'host.allocators.order';
-- Add last_id to the volumes table
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('volumes','last_id', 'bigint(20) unsigned DEFAULT NULL');

View File

@ -2292,6 +2292,8 @@ public class StorageSystemDataMotionStrategy implements DataMotionStrategy {
if (success) {
VolumeVO volumeVO = _volumeDao.findById(destVolumeInfo.getId());
volumeVO.setFormat(ImageFormat.QCOW2);
volumeVO.setLastId(srcVolumeInfo.getId());
_volumeDao.update(volumeVO.getId(), volumeVO);
_volumeService.copyPoliciesBetweenVolumesAndDestroySourceVolumeAfterMigration(Event.OperationSuccessed, null, srcVolumeInfo, destVolumeInfo, false);

View File

@ -1720,6 +1720,7 @@ public class VolumeServiceImpl implements VolumeService {
newVol.setPassphraseId(volume.getPassphraseId());
newVol.setEncryptFormat(volume.getEncryptFormat());
}
newVol.setLastId(volume.getId());
return volDao.persist(newVol);
}