Esempio n. 1
0
def disable_indications(env):
    """ CIMOM callback."""
    IndicationManager.get_instance().disable_indications(env)
Esempio n. 2
0
def authorize_filter(env, fltr, ns, classes, owner):
    """ CIMOM callback."""
    IndicationManager.get_instance().authorize_filter(
            env, fltr, ns, classes, owner)
Esempio n. 3
0
def deactivate_filter(env, fltr, ns, classes, last_activation):
    """ CIMOM callback."""
    IndicationManager.get_instance().deactivate_filter(
            env, fltr, ns, classes, last_activation)
Esempio n. 4
0
def get_providers(env):
    """
        CIMOM callback. Initialize OpenLMI and return dictionary of all
        providers we implement.
    """
    # allow **magic here
    # pylint: disable-msg=W0142
    log_manager = cmpi_logging.LogManager(env)

    config = StorageConfiguration()
    config.load()
    log_manager.set_config(config)

    cmpi_logging.logger.info("Provider init.")

    # initialize the timer manager
    timer_manager = TimerManager.get_instance(env)

    indication_manager = IndicationManager.get_instance(
            env, "Storage", config.namespace)

    manager = ProviderManager()
    setting_manager = SettingManager(config, timer_manager)
    setting_manager.load()
    storage = init_anaconda(log_manager, config)

    job_manager = JobManager('Storage', config.namespace,
            indication_manager, timer_manager)

    providers = {}
    # common construction options
    opts = {'storage': storage,
            'config': config,
            'provider_manager': manager,
            'setting_manager': setting_manager,
            'job_manager' : job_manager}

    # StorageDevice providers
    provider = LMI_StorageExtent(**opts)
    manager.add_device_provider(provider)
    providers['LMI_StorageExtent'] = provider

    provider = LMI_MDRAIDStorageExtent(**opts)
    manager.add_device_provider(provider)
    providers['LMI_MDRAIDStorageExtent'] = provider
    setting_provider = SettingHelperProvider(
            setting_helper=provider,
            setting_classname="LMI_MDRAIDStorageSetting",
            **opts)
    manager.add_setting_provider(setting_provider)
    providers['LMI_MDRAIDStorageSetting'] = setting_provider
    assoc_provider = ElementSettingDataProvider(
            setting_provider=setting_provider,
            managed_element_classname="LMI_MDRAIDStorageExtent",
            setting_data_classname="LMI_MDRAIDStorageSetting",
            **opts)
    providers['LMI_MDRAIDElementSettingData'] = assoc_provider

    provider = LMI_DiskPartition(**opts)
    manager.add_device_provider(provider)
    providers['LMI_DiskPartition'] = provider

    provider = LMI_GenericDiskPartition(**opts)
    manager.add_device_provider(provider)
    providers['LMI_GenericDiskPartition'] = provider

    provider = LMI_LVStorageExtent(**opts)
    manager.add_device_provider(provider)
    providers['LMI_LVStorageExtent'] = provider
    setting_provider = SettingHelperProvider(
            setting_helper=provider,
            setting_classname="LMI_LVStorageSetting",
            **opts)
    manager.add_setting_provider(setting_provider)
    providers['LMI_LVStorageSetting'] = setting_provider
    assoc_provider = ElementSettingDataProvider(
            setting_provider=setting_provider,
            managed_element_classname="LMI_LVStorageExtent",
            setting_data_classname="LMI_LVStorageSetting",
            **opts)
    providers['LMI_LVElementSettingData'] = assoc_provider

    provider = LMI_VGStoragePool(**opts)
    manager.add_device_provider(provider)
    providers['LMI_VGStoragePool'] = provider
    setting_provider = SettingHelperProvider(
            setting_helper=provider,
            setting_classname="LMI_VGStorageSetting",
            **opts)
    manager.add_setting_provider(setting_provider)
    providers['LMI_VGStorageSetting'] = setting_provider
    assoc_provider = ElementSettingDataProvider(
            setting_provider=setting_provider,
            managed_element_classname="LMI_VGStoragePool",
            setting_data_classname="LMI_VGStorageSetting",
            **opts)
    providers['LMI_VGElementSettingData'] = assoc_provider
    cap_provider = LMI_LVStorageCapabilities(**opts)
    manager.add_capabilities_provider(cap_provider)
    providers['LMI_LVStorageCapabilities'] = cap_provider
    assoc_provider = LMI_LVElementCapabilities(
            "LMI_LVElementCapabilities",
            cap_provider, provider, **opts)
    providers['LMI_LVElementCapabilities'] = assoc_provider

    # mounting
    provider = LMI_MountedFileSystem(**opts)
    providers['LMI_MountedFileSystem'] = provider

    setting_provider = SettingHelperProvider(
            setting_helper=provider,
            setting_classname="LMI_MountedFileSystemSetting",
            **opts)
    manager.add_setting_provider(setting_provider)
    providers['LMI_MountedFileSystemSetting'] = setting_provider

    assoc_provider = ElementSettingDataProvider(
            setting_provider=setting_provider,
            managed_element_classname="LMI_MountedFileSystem",
            setting_data_classname="LMI_MountedFileSystemSetting",
            **opts)
    providers['LMI_MountedFileSystemElementSettingData'] = assoc_provider

    provider = LMI_HostedMount(**opts)
    providers['LMI_HostedMount'] = provider

    provider = LMI_MountPoint(**opts)
    providers['LMI_MountPoint'] = provider

    provider = LMI_AttachedFileSystem(**opts)
    providers['LMI_AttachedFileSystem'] = provider

    service_provider = LMI_MountConfigurationService(**opts)
    manager.add_service_provider(service_provider)
    providers['LMI_MountConfigurationService'] = service_provider

    cap_provider = LMI_MountedFileSystemCapabilities(**opts)
    manager.add_capabilities_provider(cap_provider)
    providers['LMI_MountedFileSystemCapabilities'] = cap_provider

    assoc_provider = ElementCapabilitiesProvider(
            'LMI_MountElementCapabilities',
            cap_provider, service_provider, **opts)
    providers['LMI_MountElementCapabilities'] = assoc_provider

    # settings
    setting_provider = LMI_DiskPartitionConfigurationSetting(
            ** opts)
    manager.add_setting_provider(setting_provider)
    providers['LMI_DiskPartitionConfigurationSetting'] = setting_provider
    assoc_provider = ElementSettingDataProvider(
            setting_provider=setting_provider,
            managed_element_classname="CIM_DiskPartition",
            setting_data_classname="LMI_DiskPartitionConfigurationSetting",
            **opts)
    providers['LMI_DiskPartitionElementSettingData'] = assoc_provider


    # services & capabilities
    service_provider = LMI_StorageConfigurationService(**opts)
    manager.add_service_provider(service_provider)
    providers['LMI_StorageConfigurationService'] = service_provider
    cap_provider = LMI_VGStorageCapabilities(**opts)
    manager.add_capabilities_provider(cap_provider)
    providers['LMI_VGStorageCapabilities'] = cap_provider
    assoc_provider = ElementCapabilitiesProvider(
            "LMI_VGElementCapabilities",
            cap_provider, service_provider, **opts)
    providers['LMI_VGElementCapabilities'] = assoc_provider

    cap_provider = LMI_MDRAIDStorageCapabilities(**opts)
    manager.add_capabilities_provider(cap_provider)
    providers['LMI_MDRAIDStorageCapabilities'] = cap_provider
    assoc_provider = ElementCapabilitiesProvider(
            "LMI_MDRAIDElementCapabilities",
            cap_provider, service_provider, **opts)
    providers['LMI_MDRAIDElementCapabilities'] = assoc_provider


    service_provider = LMI_DiskPartitionConfigurationService(
            ** opts)

    manager.add_service_provider(service_provider)
    providers['LMI_DiskPartitionConfigurationService'] = service_provider

    cap_provider = LMI_DiskPartitionConfigurationCapabilities(
            ** opts)
    manager.add_capabilities_provider(cap_provider)
    providers['LMI_DiskPartitionConfigurationCapabilities'] = cap_provider
    assoc_provider = ElementCapabilitiesProvider(
            "LMI_DiskPartitionElementCapabilities",
            cap_provider, service_provider, **opts)
    providers['LMI_DiskPartitionElementCapabilities'] = assoc_provider


    # Associations
    provider = LMI_PartitionBasedOn(**opts)
    providers['LMI_PartitionBasedOn'] = provider

    provider = LMI_MDRAIDBasedOn(**opts)
    providers['LMI_MDRAIDBasedOn'] = provider

    provider = LMI_LVBasedOn(**opts)
    providers['LMI_LVBasedOn'] = provider

    provider = LMI_LVAllocatedFromStoragePool(**opts)
    providers['LMI_LVAllocatedFromStoragePool'] = provider

    provider = LMI_VGAssociatedComponentExtent(**opts)
    providers['LMI_VGAssociatedComponentExtent'] = provider

    provider = LMI_HostedStorageService(**opts)
    providers['LMI_HostedStorageService'] = provider

    provider = LMI_SystemStorageDevice(**opts)
    providers['LMI_SystemStorageDevice'] = provider

    provider = LMI_InstalledPartitionTable(**opts)
    providers['LMI_InstalledPartitionTable'] = provider

    fmt = LMI_DataFormatProvider(**opts)
    manager.add_format_provider(fmt)
    providers['LMI_DataFormat'] = fmt

    fmt = LMI_MDRAIDFormatProvider(**opts)
    manager.add_format_provider(fmt)
    providers['LMI_MDRAIDFormat'] = fmt

    fmt = LMI_PVFormatProvider(**opts)
    manager.add_format_provider(fmt)
    providers['LMI_PVFormat'] = fmt

    fmt = LMI_LocalFileSystem(**opts)
    manager.add_format_provider(fmt)
    providers['LMI_LocalFileSystem'] = fmt
    setting_provider = SettingHelperProvider(
            setting_helper=fmt,
            setting_classname="LMI_FileSystemSetting",
            **opts)
    manager.add_setting_provider(setting_provider)
    providers['LMI_FileSystemSetting'] = setting_provider
    assoc_provider = ElementSettingDataProvider(
            setting_provider=setting_provider,
            managed_element_classname="LMI_LocalFileSystem",
            setting_data_classname="LMI_FileSystemSetting",
            **opts)
    providers['LMI_FileSystemElementSettingData'] = assoc_provider

    service_provider = LMI_FileSystemConfigurationService(**opts)
    manager.add_service_provider(service_provider)
    providers['LMI_FileSystemConfigurationService'] = service_provider
    cap_provider = LMI_FileSystemConfigurationCapabilities(
            ** opts)
    manager.add_capabilities_provider(cap_provider)
    providers['LMI_FileSystemConfigurationCapabilities'] = cap_provider
    assoc_provider = ElementCapabilitiesProvider(
            "LMI_FileSystemConfigurationElementCapabilities",
            cap_provider, service_provider, **opts)
    providers['LMI_FileSystemConfigurationElementCapabilities'] = assoc_provider

    provider = LMI_ResidesOnExtent(**opts)
    providers['LMI_ResidesOnExtent'] = provider

    job_providers = job_manager.get_providers()
    providers.update(job_providers)

    provider = LMI_HostedFileSystem(**opts)
    providers['LMI_HostedFileSystem'] = provider

    cmpi_logging.logger.trace_info("Registered providers: %s"
            % (str(providers)))
    return providers