mirror of https://github.com/apache/cloudstack.git
bug 10632: propagate to 2.2.9
This commit is contained in:
parent
6dc8e515f4
commit
109ef29e86
|
|
@ -335,9 +335,9 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
VolumeVO allocateDuplicateVolume(VolumeVO oldVol, Long templateId) {
|
||||
VolumeVO newVol = new VolumeVO(oldVol.getVolumeType(), oldVol.getName(), oldVol.getDataCenterId(), oldVol.getDomainId(), oldVol.getAccountId(), oldVol.getDiskOfferingId(), oldVol.getSize());
|
||||
if(templateId != null){
|
||||
newVol.setTemplateId(templateId);
|
||||
newVol.setTemplateId(templateId);
|
||||
}else{
|
||||
newVol.setTemplateId(oldVol.getTemplateId());
|
||||
newVol.setTemplateId(oldVol.getTemplateId());
|
||||
}
|
||||
newVol.setDeviceId(oldVol.getDeviceId());
|
||||
newVol.setInstanceId(oldVol.getInstanceId());
|
||||
|
|
@ -356,7 +356,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<StoragePoolVO> ListByDataCenterHypervisor(long datacenterId, HypervisorType type) {
|
||||
List<StoragePoolVO> pools = _storagePoolDao.listByDataCenterId(datacenterId);
|
||||
|
|
@ -627,7 +627,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
return new Pair<String, String>(null, "Unable to upgrade snapshot from 2.1 to 2.2 for " + snapshot.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( snapshot.getSwiftName() != null ) {
|
||||
_snapshotMgr.downloadSnapshotsFromSwift(snapshot);
|
||||
}
|
||||
|
|
@ -738,7 +738,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
}
|
||||
|
||||
if (created == null) {
|
||||
return null;
|
||||
return null;
|
||||
} else {
|
||||
volume.setFolder(pool.getPath());
|
||||
volume.setPath(created.getPath());
|
||||
|
|
@ -847,13 +847,13 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
UpHostsInPoolSearch.done();
|
||||
|
||||
StoragePoolSearch = _vmInstanceDao.createSearchBuilder();
|
||||
|
||||
|
||||
SearchBuilder<VolumeVO> volumeSearch = _volumeDao.createSearchBuilder();
|
||||
volumeSearch.and("volumeType", volumeSearch.entity().getVolumeType(), SearchCriteria.Op.EQ);
|
||||
volumeSearch.and("poolId", volumeSearch.entity().getPoolId(), SearchCriteria.Op.EQ);
|
||||
StoragePoolSearch.join("vmVolume", volumeSearch, volumeSearch.entity().getInstanceId(), StoragePoolSearch.entity().getId(), JoinBuilder.JoinType.INNER);
|
||||
StoragePoolSearch.done();
|
||||
|
||||
|
||||
LocalStorageSearch = _storagePoolDao.createSearchBuilder();
|
||||
SearchBuilder<StoragePoolHostVO> storageHostSearch = _storagePoolHostDao.createSearchBuilder();
|
||||
storageHostSearch.and("hostId", storageHostSearch.entity().getHostId(), SearchCriteria.Op.EQ);
|
||||
|
|
@ -957,7 +957,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VMTemplateHostVO getTemplateHostRef(long zoneId, long tmpltId, boolean readyOnly) {
|
||||
List<HostVO> hosts = _hostDao.listSecondaryStorageHosts(zoneId);
|
||||
|
|
@ -999,7 +999,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
int index = rn.nextInt(size);
|
||||
return hosts.get(index);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<HostVO> getSecondaryStorageHosts(long zoneId) {
|
||||
List<HostVO> hosts = _hostDao.listSecondaryStorageHosts(zoneId);
|
||||
|
|
@ -1463,13 +1463,13 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
if (answer == null) {
|
||||
throw new StorageUnavailableException("Unable to get an answer to the modify storage pool command", pool.getId());
|
||||
}
|
||||
|
||||
|
||||
if (!answer.getResult()) {
|
||||
String msg = "Add host failed due to ModifyStoragePoolCommand failed" + answer.getDetails();
|
||||
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, pool.getDataCenterId(), pool.getPodId(), msg, msg);
|
||||
throw new StorageUnavailableException("Unable establish connection from storage head to storage pool " + pool.getId() + " due to " + answer.getDetails(), pool.getId());
|
||||
}
|
||||
|
||||
|
||||
assert (answer instanceof ModifyStoragePoolAnswer) : "Well, now why won't you actually return the ModifyStoragePoolAnswer when it's ModifyStoragePoolCommand? Pool=" + pool.getId() + "Host=" + hostId;
|
||||
ModifyStoragePoolAnswer mspAnswer = (ModifyStoragePoolAnswer) answer;
|
||||
|
||||
|
|
@ -1483,7 +1483,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
pool.setAvailableBytes(mspAnswer.getPoolInfo().getAvailableBytes());
|
||||
pool.setCapacityBytes(mspAnswer.getPoolInfo().getCapacityBytes());
|
||||
_storagePoolDao.update(pool.getId(), pool);
|
||||
|
||||
|
||||
s_logger.info("Connection established between " + pool + " host + " + hostId);
|
||||
}
|
||||
|
||||
|
|
@ -1658,7 +1658,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
} else {
|
||||
_configMgr.checkDiskOfferingAccess(account, diskOffering);
|
||||
}
|
||||
|
||||
|
||||
if (diskOffering.getDiskSize() > 0) {
|
||||
size = diskOffering.getDiskSize();
|
||||
}
|
||||
|
|
@ -1672,11 +1672,10 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
if (snapshotCheck == null) {
|
||||
throw new InvalidParameterValueException("unable to find a snapshot with id " + snapshotId);
|
||||
}
|
||||
|
||||
|
||||
if (snapshotCheck.getStatus() != Snapshot.Status.BackedUp) {
|
||||
throw new InvalidParameterValueException("Snapshot id=" + snapshotId + " is not in " + Snapshot.Status.BackedUp + " state yet and can't be used for volume creation");
|
||||
}
|
||||
|
||||
}
|
||||
diskOfferingId = (cmd.getDiskOfferingId() != null) ? cmd.getDiskOfferingId() : snapshotCheck.getDiskOfferingId();
|
||||
zoneId = snapshotCheck.getDataCenterId();
|
||||
size = snapshotCheck.getSize(); // ; disk offering is used for tags purposes
|
||||
|
|
@ -2037,7 +2036,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
throw new CloudRuntimeException("Only one storage pool in a cluster can be in PrepareForMaintenance mode, " + sp.getId() + " is already in PrepareForMaintenance mode " );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!primaryStorage.getStatus().equals(StoragePoolStatus.Up) && !primaryStorage.getStatus().equals(StoragePoolStatus.ErrorInMaintenance)) {
|
||||
throw new InvalidParameterValueException("Primary storage with id " + primaryStorageId + " is not ready for migration, as the status is:" + primaryStorage.getStatus().toString());
|
||||
}
|
||||
|
|
@ -2634,10 +2633,10 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
|
||||
for (VolumeVO vol : recreateVols) {
|
||||
VolumeVO newVol;
|
||||
if (vol.getState() == Volume.State.Allocated) {
|
||||
if (vol.getState() == Volume.State.Allocated || vol.getState() == Volume.State.Creating) {
|
||||
newVol = vol;
|
||||
} else {
|
||||
newVol = switchVolume(vol, vm);
|
||||
newVol = switchVolume(vol, vm);
|
||||
// update the volume->storagePool map since volumeId has changed
|
||||
if (dest.getStorageForDisks() != null && dest.getStorageForDisks().containsKey(vol)) {
|
||||
StoragePool poolWithOldVol = dest.getStorageForDisks().get(vol);
|
||||
|
|
@ -2690,8 +2689,8 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
try {
|
||||
txn.start();
|
||||
_volsDao.update(existingVolume, Volume.Event.Destroy);
|
||||
|
||||
Long templateIdToUse = null;
|
||||
|
||||
Long templateIdToUse = null;
|
||||
Long volTemplateId = existingVolume.getTemplateId();
|
||||
long vmTemplateId = vm.getTemplateId();
|
||||
if (volTemplateId != null && volTemplateId.longValue() != vmTemplateId) {
|
||||
|
|
@ -2979,9 +2978,9 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
public VMTemplateHostVO findVmTemplateHost(long templateId, StoragePool pool) {
|
||||
long dcId = pool.getDataCenterId();
|
||||
Long podId = pool.getPodId();
|
||||
|
||||
|
||||
List<HostVO> secHosts = _hostDao.listSecondaryStorageHosts(dcId);
|
||||
|
||||
|
||||
//FIXME, for cloudzone, the local secondary storoge
|
||||
if (pool.isLocal() && pool.getPoolType() == StoragePoolType.Filesystem && secHosts.isEmpty()) {
|
||||
List<StoragePoolHostVO> sphs = _storagePoolHostDao.listByPoolId(pool.getId());
|
||||
|
|
@ -2992,7 +2991,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (secHosts.size() == 1) {
|
||||
VMTemplateHostVO templateHostVO = _templateHostDao.findByHostTemplate(secHosts.get(0).getId(), templateId);
|
||||
return templateHostVO;
|
||||
|
|
@ -3011,7 +3010,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@DB
|
||||
|
|
|
|||
Loading…
Reference in New Issue