Merge branch '2.1.x' of ssh://git.cloud.com/var/lib/git/cloudstack-oss into 2.1.x

This commit is contained in:
will 2010-10-11 16:00:10 -07:00
commit 73c3d2c0c9
5 changed files with 44 additions and 37 deletions

View File

@ -3929,12 +3929,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
} finally {
sshConnection.close();
}
try {
// wait 2 seconds before call plugin
Thread.sleep(2000);
} catch (final InterruptedException ex) {
}
if (!setIptables()) {
s_logger.warn("set xenserver Iptable failed");
}

View File

@ -21,6 +21,7 @@ package com.cloud.vm;
import java.util.List;
import com.cloud.utils.fsm.StateMachine;
import com.cloud.vm.VirtualMachine.Event;
public enum State {
Creating(true),
@ -95,5 +96,6 @@ public enum State {
s_fsm.addTransition(State.Stopping, VirtualMachine.Event.StopRequested, State.Stopping);
s_fsm.addTransition(State.Expunging, VirtualMachine.Event.OperationFailed, State.Expunging);
s_fsm.addTransition(State.Expunging, VirtualMachine.Event.ExpungeOperation, State.Expunging);
s_fsm.addTransition(State.Error, VirtualMachine.Event.ExpungeOperation, State.Expunging);
}
}

View File

@ -910,10 +910,12 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
Long dcId = host.getDataCenterId();
ReadyCommand ready = new ReadyCommand(dcId);
Answer answer = easySend(hostId, ready);
Answer answer = easySend(hostId, ready);
if (answer == null) {
// this is tricky part for secondary storage
// make it as disconnected, wait for secondary storage VM to be up
// return the attache instead of null, even it is disconnectede
handleDisconnect(attache, Event.AgentDisconnected, false);
return null;
}
_hostDao.updateStatus(host, Event.Ready, _nodeId);

View File

@ -382,41 +382,46 @@ public class SnapshotManagerImpl implements SnapshotManager {
txn = Transaction.currentTxn();
txn.start();
// Update the snapshot in the database
if ((answer != null) && answer.getResult()) {
// The snapshot was successfully created
if( preSnapshotPath != null && preSnapshotPath == answer.getSnapshotPath() ){
//empty snapshot
s_logger.debug("CreateSnapshot: this is empty snapshot, remove it ");
try {
// Update the snapshot in the database
if ((answer != null) && answer.getResult()) {
// The snapshot was successfully created
if (preSnapshotPath != null && preSnapshotPath == answer.getSnapshotPath()) {
// empty snapshot
s_logger.debug("CreateSnapshot: this is empty snapshot, remove it ");
// delete from the snapshots table
_snapshotDao.delete(id);
throw new CloudRuntimeException(
" There is no change since last snapshot, please use last snapshot " + preSnapshotPath);
} else {
createdSnapshot = updateDBOnCreate(id, answer.getSnapshotPath());
}
} else {
String msg = "createSnapshotCommand returns null";
if (answer != null) {
msg = answer.getDetails();
s_logger.error(msg);
}
// delete from the snapshots table
_snapshotDao.delete(id);
throw new CloudRuntimeException(" There is no change since last snapshot, please use last snapshot " + preSnapshotPath);
} else {
createdSnapshot = updateDBOnCreate(id, answer.getSnapshotPath());
throw new CloudRuntimeException(" CreateSnapshot failed due to " + msg);
}
} else {
if (answer != null) {
s_logger.error(answer.getDetails());
// Update async status after snapshot creation and before backup
if (asyncExecutor != null) {
AsyncJobVO job = asyncExecutor.getJob();
if (s_logger.isDebugEnabled())
s_logger.debug("CreateSnapshot created a new instance " + id + ", update async job-" + job.getId()
+ " progress status");
_asyncMgr.updateAsyncJobAttachment(job.getId(), "snapshot", id);
_asyncMgr.updateAsyncJobStatus(job.getId(), BaseCmd.PROGRESS_INSTANCE_CREATED, id);
}
// The snapshot was not successfully created
createdSnapshot = _snapshotDao.findById(id);
// delete from the snapshots table
_snapshotDao.delete(id);
} finally {
txn.commit();
}
// Update async status after snapshot creation and before backup
if(asyncExecutor != null) {
AsyncJobVO job = asyncExecutor.getJob();
if(s_logger.isDebugEnabled())
s_logger.debug("CreateSnapshot created a new instance " + id + ", update async job-" + job.getId() + " progress status");
_asyncMgr.updateAsyncJobAttachment(job.getId(), "snapshot", id);
_asyncMgr.updateAsyncJobStatus(job.getId(), BaseCmd.PROGRESS_INSTANCE_CREATED, id);
}
txn.commit();
return createdSnapshot;
}

View File

@ -633,6 +633,9 @@ public class TemplateManagerImpl implements TemplateManager {
// Check if there are any snapshots for the template in the template host ref's zone
List<VolumeVO> volumes = _volumeDao.findByTemplateAndZone(templateId, zoneId);
if( volumes.size() > 0 ) {
return false;
}
for (VolumeVO volume : volumes) {
List<SnapshotVO> snapshots = _snapshotDao.listByVolumeId(volume.getId());
if (!snapshots.isEmpty()) {