use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeSnapshotActionVDSParameters in project ovirt-engine by oVirt.
the class DeactivateGlusterVolumeSnapshotCommand method executeCommand.
@Override
public void executeCommand() {
VDSReturnValue retVal = runVdsCommand(VDSCommandType.DeactivateGlusterVolumeSnapshot, new GlusterVolumeSnapshotActionVDSParameters(getUpServer().getId(), getGlusterVolumeName(), getParameters().getSnapshotName()));
setSucceeded(retVal.getSucceeded());
if (!getSucceeded()) {
handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_DEACTIVATE_FAILED, retVal.getVdsError().getMessage());
} else {
glusterVolumeSnapshotDao.updateSnapshotStatus(getSnapshot().getId(), GlusterSnapshotStatus.DEACTIVATED);
}
}
use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeSnapshotActionVDSParameters in project ovirt-engine by oVirt.
the class DeleteGlusterVolumeSnapshotCommand method deleteGlusterVolumeSnapshot.
private boolean deleteGlusterVolumeSnapshot(Guid serverId, String volumeName, String snapshotName) {
VDSReturnValue retVal = runVdsCommand(VDSCommandType.DeleteGlusterVolumeSnapshot, new GlusterVolumeSnapshotActionVDSParameters(serverId, volumeName, snapshotName));
setSucceeded(retVal.getSucceeded());
if (!getSucceeded()) {
handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_DELETE_FAILED, retVal.getVdsError().getMessage());
return false;
} else {
glusterVolumeSnapshotDao.remove(getSnapshot().getId());
}
return true;
}
use of org.ovirt.engine.core.common.vdscommands.gluster.GlusterVolumeSnapshotActionVDSParameters in project ovirt-engine by oVirt.
the class RestoreGlusterVolumeSnapshotCommand method restoreVolumeToSnapshot.
private boolean restoreVolumeToSnapshot(Guid upServerId, GlusterVolumeEntity volume, String snapshotName) {
if (volume != null) {
VDSReturnValue retVal = runVdsCommand(VDSCommandType.RestoreGlusterVolumeSnapshot, new GlusterVolumeSnapshotActionVDSParameters(upServerId, volume.getName(), snapshotName));
if (!retVal.getSucceeded()) {
handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_RESTORE_FAILED, retVal.getVdsError().getMessage());
setSucceeded(false);
return false;
} else {
glusterVolumeSnapshotDao.removeByName(volume.getId(), snapshotName);
// Sync the new bricks of the volume immediately
VDS upServer = glusterUtil.getRandomUpServer(volume.getClusterId());
VDSReturnValue volDetailsRetVal = runVdsCommand(VDSCommandType.GetGlusterVolumeInfo, new GlusterVolumeInfoVDSParameters(upServer.getId(), volume.getClusterId(), volume.getName()));
GlusterVolumeEntity fetchedVolume = ((Map<Guid, GlusterVolumeEntity>) volDetailsRetVal.getReturnValue()).get(volume.getId());
List<GlusterBrickEntity> fetchedBricks = fetchedVolume.getBricks();
if (fetchedBricks != null) {
glusterBrickDao.removeAllInBatch(volume.getBricks());
for (GlusterBrickEntity fetchdBrick : fetchedVolume.getBricks()) {
if (fetchdBrick.getServerId() != null) {
fetchdBrick.setStatus(GlusterStatus.UP);
glusterBrickDao.save(fetchdBrick);
} else {
log.warn("Invalid server details for brick " + fetchdBrick.getName() + ". Not adding now.");
}
}
}
}
}
return true;
}
Aggregations