mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Merge branch 'master' of ssh://git.cloud.com/var/lib/git/cloudstack-oss
This commit is contained in:
commit
8a2d12f2bf
@ -98,10 +98,14 @@ public class ApiDispatcher {
|
||||
Throwable cause = ite.getCause();
|
||||
if (cause instanceof InvalidParameterValueException) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, cause.getMessage());
|
||||
} else if (cause instanceof IllegalArgumentException) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, cause.getMessage());
|
||||
} else if (cause instanceof PermissionDeniedException) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, cause.getMessage());
|
||||
} else if (cause instanceof ResourceAllocationException){
|
||||
throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, cause.getMessage());
|
||||
} else if (cause instanceof ServerApiException) {
|
||||
throw (ServerApiException)cause;
|
||||
}
|
||||
s_logger.warn("Exception executing method " + methodName + " for command " + cmd.getClass().getSimpleName(), ite);
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Unable to execute method " + methodName + " for command " + cmd.getClass().getSimpleName() + ", internal error in the implementation.");
|
||||
@ -149,6 +153,8 @@ public class ApiDispatcher {
|
||||
}
|
||||
if (cause instanceof InvalidParameterValueException) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, cause.getMessage());
|
||||
} else if (cause instanceof IllegalArgumentException) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, cause.getMessage());
|
||||
} else if (cause instanceof PermissionDeniedException) {
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, cause.getMessage());
|
||||
} else if (cause instanceof ServerApiException) {
|
||||
|
||||
@ -97,6 +97,7 @@ import com.cloud.utils.component.Inject;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.vm.VMInstanceVO;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
|
||||
@ -237,8 +238,12 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
||||
@Override @DB
|
||||
public SnapshotVO createSnapshotImpl(long volumeId, long policyId) throws InvalidParameterValueException, ResourceAllocationException {
|
||||
Long userId = UserContext.current().getUserId();
|
||||
SnapshotVO createdSnapshot = null;
|
||||
|
||||
VolumeVO volume = _volsDao.findById(volumeId);
|
||||
VolumeVO volume = _volsDao.lock(volumeId, true);
|
||||
if (volume == null) {
|
||||
throw new CloudRuntimeException("Failed to lock volume " + volumeId + " for creating a snapshot.");
|
||||
}
|
||||
|
||||
if (!shouldRunSnapshot(userId, volume, policyId)) {
|
||||
// A null snapshot is interpreted as snapshot creation failed which
|
||||
@ -246,7 +251,6 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
SnapshotVO createdSnapshot = null;
|
||||
Long id = null;
|
||||
|
||||
// Determine the name for this snapshot
|
||||
@ -271,9 +275,9 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
||||
|
||||
// Send a ManageSnapshotCommand to the agent
|
||||
String vmName = _storageMgr.getVmNameOnVolume(volume);
|
||||
|
||||
|
||||
long preId = _snapshotDao.getLastSnapshot(volumeId, id);
|
||||
|
||||
|
||||
String preSnapshotPath = null;
|
||||
// half of maxsnaps are delta snapshot
|
||||
// when there are half of maxsnaps or presnapshot has not backed up , create a full snapshot
|
||||
@ -298,9 +302,9 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
||||
createdSnapshot = _snapshotDao.findById(id);
|
||||
// delete from the snapshots table
|
||||
_snapshotDao.expunge(id);
|
||||
|
||||
|
||||
createdSnapshot.setStatus(Status.EmptySnapshot);
|
||||
|
||||
|
||||
} else {
|
||||
long preSnapshotId = 0;
|
||||
if( preSnapshotVO != null && preSnapshotVO.getBackupSnapshotId() != null) {
|
||||
@ -357,9 +361,9 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
||||
createdSnapshot = _snapshotDao.findById(id);
|
||||
// delete from the snapshots table
|
||||
_snapshotDao.expunge(id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return createdSnapshot;
|
||||
}
|
||||
|
||||
@ -368,16 +372,18 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
||||
SnapshotVO snapshot = _snapshotDao.findById(cmd.getId());
|
||||
Long snapshotId = null;
|
||||
boolean backedUp = false;
|
||||
if (snapshot != null && snapshot.getStatus() == Snapshot.Status.CreatedOnPrimary) {
|
||||
snapshotId = snapshot.getId();
|
||||
backedUp = backupSnapshotToSecondaryStorage(snapshot, cmd.getStartEventId());
|
||||
if (!backedUp) {
|
||||
throw new InternalErrorException("Created snapshot: " + snapshotId + " on primary but failed to backup on secondary");
|
||||
if (snapshot != null) {
|
||||
if (snapshot.getStatus() == Snapshot.Status.CreatedOnPrimary) {
|
||||
snapshotId = snapshot.getId();
|
||||
backedUp = backupSnapshotToSecondaryStorage(snapshot, cmd.getStartEventId());
|
||||
if (!backedUp) {
|
||||
throw new InternalErrorException("Created snapshot: " + snapshotId + " on primary but failed to backup on secondary");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup jobs to do after the snapshot has been created.
|
||||
postCreateSnapshot(cmd.getVolumeId(), snapshotId, Snapshot.MANUAL_POLICY_ID, backedUp);
|
||||
// Cleanup jobs to do after the snapshot has been created.
|
||||
postCreateSnapshot(cmd.getVolumeId(), snapshotId, Snapshot.MANUAL_POLICY_ID, backedUp);
|
||||
}
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
@ -2685,6 +2685,8 @@ a:hover.search_button {
|
||||
background:url(../images/consoletb_box.gif) no-repeat top left;
|
||||
margin:0;
|
||||
padding:0;
|
||||
cursor:pointer;
|
||||
cursor:hand;
|
||||
}
|
||||
|
||||
.vm_liveconsole {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user