Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
import static java.util.Arrays.asList;
import static org.zstack.core.Platform.*;
import static org.zstack.core.progress.ProgressReportService.*;
import static org.zstack.header.vm.VmErrors.ATTACH_VOLUME_ERROR;
import static org.zstack.utils.CollectionDSL.*;

public class VmInstanceBase extends AbstractVmInstance {
Expand Down Expand Up @@ -5155,6 +5156,10 @@ private void attachIso(final String isoUuid, String specifiedCdRomUuid, final Co
vmCdRomVO = dbf.findByUuid(specifiedCdRomUuid, VmCdRomVO.class);
} else {
vmCdRomVO = IsoOperator.getEmptyCdRom(self.getUuid());
if (vmCdRomVO == null) {
completion.fail(err(ATTACH_VOLUME_ERROR, "no available empty cdrom for VM[uuid:%s]", self.getUuid()));
return;
}
}

final VmCdRomVO targetVmCdRomVO = vmCdRomVO;
Expand Down Expand Up @@ -6943,7 +6948,7 @@ public void handle(ErrorCode errCode, Map data) {
protected void attachDataVolume(final AttachDataVolumeToVmMsg msg, final NoErrorCompletion completion) {
final AttachDataVolumeToVmReply reply = new AttachDataVolumeToVmReply();
refreshVO();
ErrorCode err = validateOperationByState(msg, self.getState(), VmErrors.ATTACH_VOLUME_ERROR);
ErrorCode err = validateOperationByState(msg, self.getState(), ATTACH_VOLUME_ERROR);
if (err != null) {
throw new OperationFailureException(err);
}
Expand Down Expand Up @@ -7001,7 +7006,7 @@ private void sendEvent() {
@Override
public void handle(final ErrorCode errCode, Map data) {
extEmitter.failedToAttachVolume(getSelfInventory(), volume, errCode, data);
reply.setError(err(VmErrors.ATTACH_VOLUME_ERROR, errCode, errCode.getDetails()));
reply.setError(err(ATTACH_VOLUME_ERROR, errCode, errCode.getDetails()));
bus.reply(msg, reply);
completion.done();
}
Expand Down