mirror of https://github.com/apache/cloudstack.git
bug 9597: Fixed the recreatable problem. Also added the 2.2.1 upgrade step
This commit is contained in:
parent
f6258dae08
commit
d5c7258b71
|
|
@ -335,6 +335,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
}
|
||||
newVol.setDeviceId(oldVol.getDeviceId());
|
||||
newVol.setInstanceId(oldVol.getInstanceId());
|
||||
newVol.setRecreatable(oldVol.isRecreatable());
|
||||
return _volsDao.persist(newVol);
|
||||
}
|
||||
|
||||
|
|
@ -2532,11 +2533,9 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
for (VolumeVO vol : recreateVols) {
|
||||
VolumeVO newVol;
|
||||
if (vol.getState() == Volume.State.Allocated) {
|
||||
vol.setRecreatable(true);
|
||||
newVol = vol;
|
||||
} else {
|
||||
newVol = switchVolume(vol, vm);
|
||||
newVol.setRecreatable(true);
|
||||
// update the volume->storagePool map since volumeId has changed
|
||||
if (dest.getStorageForDisks() != null && dest.getStorageForDisks().containsKey(vol)) {
|
||||
StoragePool poolWithOldVol = dest.getStorageForDisks().get(vol);
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
|
|||
_upgradeMap.put("2.1.7", new DbUpgrade[] { new Upgrade217to218(), new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to223(), new Upgrade222to224() });
|
||||
_upgradeMap.put("2.1.8", new DbUpgrade[] { new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to223(), new Upgrade222to224(), new Upgrade218to224DomainVlans() });
|
||||
_upgradeMap.put("2.1.9", new DbUpgrade[] { new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to223(), new Upgrade222to224(), new Upgrade218to224DomainVlans() });
|
||||
_upgradeMap.put("2.2.1", new DbUpgrade[] { new Upgrade221to222(), new Upgrade222to224()});
|
||||
_upgradeMap.put("2.2.2", new DbUpgrade[] { new Upgrade222to224() });
|
||||
_upgradeMap.put("2.2.3", new DbUpgrade[] { new Upgrade222to224() });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,15 +60,20 @@ public class Upgrade222to224 implements DbUpgrade {
|
|||
|
||||
@Override
|
||||
public void performDataMigration(Connection conn) {
|
||||
updateClusterIdInOpHostCapacity(conn);
|
||||
updateGuestOsType(conn);
|
||||
updateNicsWithMode(conn);
|
||||
updateUserStatsWithNetwork(conn);
|
||||
dropIndexIfExists(conn);
|
||||
fixBasicZoneNicCount(conn);
|
||||
updateTotalCPUInOpHostCapacity(conn);
|
||||
upgradeGuestOs(conn);
|
||||
upgradeAccountVlanMap(conn);
|
||||
try {
|
||||
updateClusterIdInOpHostCapacity(conn);
|
||||
updateGuestOsType(conn);
|
||||
updateNicsWithMode(conn);
|
||||
updateUserStatsWithNetwork(conn);
|
||||
dropIndexIfExists(conn);
|
||||
fixBasicZoneNicCount(conn);
|
||||
updateTotalCPUInOpHostCapacity(conn);
|
||||
upgradeGuestOs(conn);
|
||||
upgradeAccountVlanMap(conn);
|
||||
fixRecreatableVolumesProblem(conn);
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Unable to perform data migration", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -100,6 +105,17 @@ public class Upgrade222to224 implements DbUpgrade {
|
|||
throw new CloudRuntimeException("Unable to update the guest os type for default template as a part of 222 to 224 upgrade", e);
|
||||
}
|
||||
}
|
||||
|
||||
// fixes bug 9597
|
||||
private void fixRecreatableVolumesProblem(Connection conn) throws SQLException {
|
||||
PreparedStatement pstmt = conn.prepareStatement("UPDATE volumes as v SET recreatable=(SELECT recreatable FROM disk_offering d WHERE d.id = v.disk_offering_id)");
|
||||
pstmt.execute();
|
||||
pstmt.close();
|
||||
|
||||
pstmt = conn.prepareStatement("UPDATE volumes SET recreatable=0 WHERE disk_offering_id is NULL");
|
||||
pstmt.execute();
|
||||
pstmt.close();
|
||||
}
|
||||
|
||||
private void updateClusterIdInOpHostCapacity(Connection conn) {
|
||||
PreparedStatement pstmt = null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue