Package org.rhq.core.domain.cloud.StorageClusterSettings

Examples of org.rhq.core.domain.cloud.StorageClusterSettings.RegularSnapshots


        }

        if (!settings.containsKey(SystemSetting.STORAGE_REGULAR_SNAPSHOTS)) {
            return null; // why?
        } else {
            RegularSnapshots rs = new RegularSnapshots();
            clusterSettings.setRegularSnapshots(rs);
            rs.setEnabled(Boolean.parseBoolean(settings.get(SystemSetting.STORAGE_REGULAR_SNAPSHOTS)));
            rs.setSchedule(settings.get(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_SCHEDULE));
            rs.setRetention(settings.get(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_RETENTION));
            rs.setCount(Integer.parseInt(settings.get(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_RETENTION_COUNT)));
            rs.setDeletion(settings.get(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_DELETION));
            rs.setLocation(settings.get(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_DELETION_LOCATION));
        }
        return clusterSettings;
    }
View Full Code Here


        if (clusterSettings.getPasswordHash() != null) {
            this.updateStorageClusterCredentials(clusterSettings);
            settings.put(SystemSetting.STORAGE_PASSWORD, clusterSettings.getPasswordHash());
        }
        if (clusterSettings.getRegularSnapshots() != null) {
            RegularSnapshots rs = clusterSettings.getRegularSnapshots();
            settings.put(SystemSetting.STORAGE_REGULAR_SNAPSHOTS, Boolean.toString(rs.getEnabled()));
            settings.put(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_SCHEDULE, rs.getSchedule());
            settings.put(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_RETENTION, rs.getRetention());
            settings.put(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_RETENTION_COUNT, Integer.toString(rs.getCount()));
            settings.put(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_DELETION, rs.getDeletion());
            settings.put(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_DELETION_LOCATION, rs.getLocation());
        }
        systemManager.setStorageClusterSettings(subject, settings);
        LookupUtil.getStorageNodeManager().scheduleSnapshotManagement(subject, clusterSettings);

    }
View Full Code Here

    @Override
    @RequiredPermission(Permission.MANAGE_SETTINGS)
    public void scheduleSnapshotManagementOperationsForStorageNode(Subject subject, StorageNode node,
        StorageClusterSettings settings) {
        Resource resource = node.getResource();
        RegularSnapshots rs = settings.getRegularSnapshots();
        log.info("Updating snapshot management schedules for " + node);
        try {
            List<ResourceOperationSchedule> schedules = operationManager.findScheduledResourceOperations(subject,
                resource.getId());
            if (log.isDebugEnabled()) {
                log.debug("Removing original scheduled operations on " + node);
            }
            for (ResourceOperationSchedule schedule : schedules) {
                if (REGULAR_SNAPSHOTS_SCHEDULE_DESCRIPTION.equals(schedule.getDescription())) {
                    if (log.isDebugEnabled()) {
                        log.debug("Found operation schedule, unscheduling " + schedule);
                    }
                    operationManager.unscheduleResourceOperation(subject, schedule.getJobId().toString(),
                        resource.getId());
                    // delete history items that have been scheduled but not yet started
                    ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
                    criteria.setPageControl(PageControl.getUnlimitedInstance());
                    criteria.addFilterJobId(schedule.getJobId());
                    criteria.addFilterStatus(OperationRequestStatus.INPROGRESS);
                    criteria.addFilterStartTime(Long.valueOf(0));
                    PageList<ResourceOperationHistory> historyItems = operationManager
                        .findResourceOperationHistoriesByCriteria(subject, criteria);
                    Iterator<ResourceOperationHistory> iter = historyItems.iterator();
                    if (iter.hasNext()) {
                        if (log.isDebugEnabled()) {
                            log.debug("Wiping out " + historyItems.getTotalSize()
                                    + " scheduled but not yet started history items");
                        }
                        while (iter.hasNext()) {
                            operationManager.deleteOperationHistory(subject, iter.next().getId(), true);
                        }
                    }

                }
            }
            if (rs != null && rs.getEnabled().booleanValue()) {
                Configuration parameters = Configuration.builder().addSimple("retentionStrategy", rs.getRetention())
                    .addSimple("count", rs.getCount()).addSimple("deletionStrategy", rs.getDeletion())
                    .addSimple("location", rs.getLocation()).build();

                ResourceOperationSchedule schedule = operationManager.scheduleResourceOperationUsingCron(subject,
                    resource.getId(), "takeSnapshot",
                    rs.getSchedule(), 0, parameters, REGULAR_SNAPSHOTS_SCHEDULE_DESCRIPTION);
                if (log.isDebugEnabled()) {
                    log.debug("Created new " + schedule);
                }
            }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.cloud.StorageClusterSettings.RegularSnapshots

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.