use of com.cloud.engine.subsystem.api.storage.PrimaryDataStore in project cosmic by MissionCriticalCloud.
the class TemplateObject method getInstallPath.
@Override
public String getInstallPath() {
if (installPath != null) {
return installPath;
}
if (dataStore == null) {
return null;
}
// managed primary data stores should not have an install path
if (dataStore instanceof PrimaryDataStore) {
final PrimaryDataStore primaryDataStore = (PrimaryDataStore) dataStore;
final Map<String, String> details = primaryDataStore.getDetails();
final boolean managed = details != null && Boolean.parseBoolean(details.get(PrimaryDataStore.MANAGED));
if (managed) {
return null;
}
}
final DataObjectInStore obj = objectInStoreMgr.findObject(this, dataStore);
return obj.getInstallPath();
}
use of com.cloud.engine.subsystem.api.storage.PrimaryDataStore in project cosmic by MissionCriticalCloud.
the class SnapshotServiceImpl method revertSnapshot.
@Override
public boolean revertSnapshot(final SnapshotInfo snapshot) {
final SnapshotInfo snapshotOnPrimaryStore = _snapshotFactory.getSnapshot(snapshot.getId(), DataStoreRole.Primary);
if (snapshotOnPrimaryStore == null) {
throw new CloudRuntimeException("Cannot find an entry for snapshot " + snapshot.getId() + " on primary storage pools");
}
final PrimaryDataStore store = (PrimaryDataStore) snapshotOnPrimaryStore.getDataStore();
final AsyncCallFuture<SnapshotResult> future = new AsyncCallFuture<>();
final RevertSnapshotContext<CommandResult> context = new RevertSnapshotContext<>(null, snapshot, future);
final AsyncCallbackDispatcher<SnapshotServiceImpl, CommandResult> caller = AsyncCallbackDispatcher.create(this);
caller.setCallback(caller.getTarget().revertSnapshotCallback(null, null)).setContext(context);
((PrimaryDataStoreDriver) store.getDriver()).revertSnapshot(snapshot, snapshotOnPrimaryStore, caller);
SnapshotResult result = null;
try {
result = future.get();
if (result.isFailed()) {
throw new CloudRuntimeException(result.getResult());
}
return true;
} catch (final InterruptedException e) {
s_logger.debug("revert snapshot is failed: " + e.toString());
} catch (final ExecutionException e) {
s_logger.debug("revert snapshot is failed: " + e.toString());
}
return false;
}
Aggregations