use of org.apache.cloudstack.storage.command.IntroduceObjectAnswer in project cloudstack by apache.
the class XenServerStorageProcessor method forgetObject.
@Override
public Answer forgetObject(final ForgetObjectCmd cmd) {
try {
final Connection conn = hypervisorResource.getConnection();
final DataTO data = cmd.getDataTO();
final VDI vdi = VDI.getByUuid(conn, data.getPath());
vdi.forget(conn);
return new IntroduceObjectAnswer(cmd.getDataTO());
} catch (final Exception e) {
s_logger.debug("Failed to introduce object", e);
return new Answer(cmd, false, e.toString());
}
}
use of org.apache.cloudstack.storage.command.IntroduceObjectAnswer in project cloudstack by apache.
the class XenServerStorageProcessor method introduceObject.
@Override
public Answer introduceObject(final IntroduceObjectCmd cmd) {
try {
final Connection conn = hypervisorResource.getConnection();
final DataStoreTO store = cmd.getDataTO().getDataStore();
final SR poolSr = hypervisorResource.getStorageRepository(conn, store.getUuid());
poolSr.scan(conn);
return new IntroduceObjectAnswer(cmd.getDataTO());
} catch (final Exception e) {
s_logger.debug("Failed to introduce object", e);
return new Answer(cmd, false, e.toString());
}
}
use of org.apache.cloudstack.storage.command.IntroduceObjectAnswer in project cloudstack by apache.
the class HypervisorHelperImpl method introduceObject.
@Override
public DataTO introduceObject(DataTO object, Scope scope, Long storeId) {
EndPoint ep = selector.select(scope, storeId);
IntroduceObjectCmd cmd = new IntroduceObjectCmd(object);
Answer answer = null;
if (ep == null) {
String errMsg = "No remote endpoint to send command, check if host or ssvm is down?";
s_logger.error(errMsg);
answer = new Answer(cmd, false, errMsg);
} else {
answer = ep.sendMessage(cmd);
}
if (answer == null || !answer.getResult()) {
String errMsg = answer == null ? null : answer.getDetails();
throw new CloudRuntimeException("Failed to introduce object, due to " + errMsg);
}
IntroduceObjectAnswer introduceObjectAnswer = (IntroduceObjectAnswer) answer;
return introduceObjectAnswer.getDataTO();
}
Aggregations