mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-4002: [Upgrade][2.2.16 to 4.2] After upgrade creation of
volume from a snapshot which was existing before upgrade, fails with NPE
This commit is contained in:
parent
d9cc453240
commit
4ccbbd029d
|
|
@ -193,7 +193,7 @@ public class SnapshotDataStoreVO implements StateObject<ObjectInDataStoreStateMa
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
return new StringBuilder("VolumeHost[").append(id).append("-").append(snapshotId).append("-")
|
||||
return new StringBuilder("SnapshotDataStore[").append(id).append("-").append(snapshotId).append("-")
|
||||
.append(dataStoreId).append(installPath).append("]").toString();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ public class TemplateDataStoreVO implements StateObject<ObjectInDataStoreStateMa
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new StringBuilder("TmplHost[").append(id).append("-").append(templateId).append("-").append(dataStoreId)
|
||||
return new StringBuilder("TmplDataStore[").append(id).append("-").append(templateId).append("-").append(dataStoreId)
|
||||
.append(installPath).append("]").toString();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ public class VolumeDataStoreVO implements StateObject<ObjectInDataStoreStateMach
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
return new StringBuilder("VolumeHost[").append(id).append("-").append(volumeId).append("-").append(dataStoreId)
|
||||
return new StringBuilder("VolumeDataStore[").append(id).append("-").append(volumeId).append("-").append(dataStoreId)
|
||||
.append(installPath).append("]").toString();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1892,7 +1892,7 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
try {
|
||||
|
||||
volStoreInsert = conn
|
||||
.prepareStatement("INSERT INTO `cloud`.`volume_store_ref` (store_id, volume_id, zone_id, created, last_updated, job_id, download_pct, size, physical_size, download_state, checksum, error_str, local_path, install_path, url, destroyed, state) select host_id, volume_id, zone_id, created, last_updated, job_id, download_pct, size, physical_size, download_state, checksum, error_str, local_path, install_path, url, destroyed, 'Allocated' from `cloud`.`volume_host_ref`");
|
||||
.prepareStatement("INSERT INTO `cloud`.`volume_store_ref` (store_id, volume_id, zone_id, created, last_updated, job_id, download_pct, size, physical_size, download_state, checksum, error_str, local_path, install_path, url, destroyed, update_count, ref_cnt, state) select host_id, volume_id, zone_id, created, last_updated, job_id, download_pct, size, physical_size, download_state, checksum, error_str, local_path, install_path, url, destroyed, 0, 0, 'Allocated' from `cloud`.`volume_host_ref`");
|
||||
volStoreInsert.executeUpdate();
|
||||
|
||||
volStoreUpdate = conn.prepareStatement("update `cloud`.`volume_store_ref` set state = 'Ready' where download_state = 'DOWNLOADED'");
|
||||
|
|
@ -1923,7 +1923,7 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
try {
|
||||
|
||||
tmplStoreInsert = conn
|
||||
.prepareStatement("INSERT INTO `cloud`.`template_store_ref` (store_id, template_id, created, last_updated, job_id, download_pct, size, physical_size, download_state, error_str, local_path, install_path, url, destroyed, is_copy, store_role, state) select host_id, template_id, created, last_updated, job_id, download_pct, size, physical_size, download_state, error_str, local_path, install_path, url, destroyed, is_copy, 'Image', 'Allocated' from `cloud`.`template_host_ref`");
|
||||
.prepareStatement("INSERT INTO `cloud`.`template_store_ref` (store_id, template_id, created, last_updated, job_id, download_pct, size, physical_size, download_state, error_str, local_path, install_path, url, destroyed, is_copy, update_count, ref_cnt, store_role, state) select host_id, template_id, created, last_updated, job_id, download_pct, size, physical_size, download_state, error_str, local_path, install_path, url, destroyed, is_copy, 0, 0, 'Image', 'Allocated' from `cloud`.`template_host_ref`");
|
||||
tmplStoreInsert.executeUpdate();
|
||||
|
||||
tmplStoreUpdate = conn.prepareStatement("update `cloud`.`template_store_ref` set state = 'Ready' where download_state = 'DOWNLOADED'");
|
||||
|
|
@ -1952,7 +1952,7 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
|
||||
try {
|
||||
snapshotStoreInsert = conn
|
||||
.prepareStatement("INSERT INTO `cloud`.`snapshot_store_ref` (store_id, snapshot_id, created, size, parent_snapshot_id, install_path, state) select sechost_id, id, created, size, prev_snap_id, path, 'Ready' from `cloud`.`snapshots` where status = 'BackedUp' and sechost_id is not null and removed is null");
|
||||
.prepareStatement("INSERT INTO `cloud`.`snapshot_store_ref` (store_id, snapshot_id, created, size, parent_snapshot_id, install_path, volume_id, update_count, ref_cnt, store_role, state) select sechost_id, id, created, size, prev_snap_id, path, volume_id, 0, 0, 'Image', 'Ready' from `cloud`.`snapshots` where status = 'BackedUp' and sechost_id is not null and removed is null");
|
||||
snapshotStoreInsert.executeUpdate();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue