protected void instantiateVmFromNewCreate(final InstantiateNewCreatedVmInstanceMsg msg, final SyncTaskChain taskChain) {
refreshVO();
ErrorCode error = validateOperationByState(msg, self.getState(), SysErrors.OPERATION_ERROR);
if (error != null) {
throw new OperationFailureException(error);
}
error = extEmitter.preStartNewCreatedVm(msg.getVmInstanceInventory());
if (error != null) {
throw new OperationFailureException(error);
}
InstantiateNewCreatedVmInstanceReply reply = new InstantiateNewCreatedVmInstanceReply();
instantiateVmFromNewCreate(InstantiateVmFromNewCreatedStruct.fromMessage(msg), new Completion(msg, taskChain) {
@Override
public void success() {
self = dbf.reload(self);
reply.setVmInventory(getSelfInventory());
bus.reply(msg, reply);
taskChain.next();
}
@Override
public void fail(ErrorCode errorCode) {
reply.setError(errorCode);
bus.reply(msg, reply);
taskChain.next();
}
});
}