Exemplo n.º 1
0
    def ready(self):
        from waldur_core.structure import signals as structure_signals
        from waldur_mastermind.marketplace import handlers as marketplace_handlers
        from waldur_mastermind.marketplace import models as marketplace_models
        from waldur_mastermind.marketplace.plugins import manager, Component
        from waldur_rancher.apps import RancherConfig
        from waldur_rancher import models as rancher_models

        from . import handlers, PLUGIN_NAME, processors

        USAGE = marketplace_models.OfferingComponent.BillingTypes.USAGE
        manager.register(
            offering_type=PLUGIN_NAME,
            create_resource_processor=processors.RancherCreateProcessor,
            delete_resource_processor=processors.RancherDeleteProcessor,
            components=(Component(type='node',
                                  name='K8S node',
                                  measured_unit='',
                                  billing_type=USAGE), ),
            service_type=RancherConfig.service_name,
            resource_model=rancher_models.Cluster,
        )

        marketplace_handlers.connect_resource_metadata_handlers(
            rancher_models.Cluster)
        marketplace_handlers.connect_resource_handlers(rancher_models.Cluster)

        structure_signals.resource_imported.connect(
            handlers.create_marketplace_resource_for_imported_cluster,
            sender=rancher_models.Cluster,
            dispatch_uid='waldur_mastermind.marketpace_rancher.'
            'create_resource_for_imported_cluster',
        )
Exemplo n.º 2
0
    def ready(self):
        from waldur_core.structure import signals as structure_signals
        from waldur_mastermind.marketplace import handlers as marketplace_handlers
        from waldur_mastermind.marketplace import models as marketplace_models
        from waldur_mastermind.marketplace.plugins import manager, Component
        from waldur_rancher.apps import RancherConfig
        from waldur_rancher import models as rancher_models

        from . import handlers, PLUGIN_NAME, processors, registrators

        registrators.RancherRegistrator.connect()

        USAGE = marketplace_models.OfferingComponent.BillingTypes.USAGE
        manager.register(
            offering_type=PLUGIN_NAME,
            create_resource_processor=processors.RancherCreateProcessor,
            delete_resource_processor=processors.RancherDeleteProcessor,
            components=(Component(
                type='node',
                name='K8S node',
                measured_unit='nodes',
                billing_type=USAGE,
            ), ),
            service_type=RancherConfig.service_name,
            get_importable_resources_backend_method='get_importable_clusters',
            import_resource_backend_method='import_cluster',
        )

        marketplace_handlers.connect_resource_metadata_handlers(
            rancher_models.Cluster)
        marketplace_handlers.connect_resource_handlers(rancher_models.Cluster)

        structure_signals.resource_imported.connect(
            handlers.create_marketplace_resource_for_imported_cluster,
            sender=rancher_models.Cluster,
            dispatch_uid='waldur_mastermind.marketplace_rancher.'
            'create_resource_for_imported_cluster',
        )

        signals.post_save.connect(
            handlers.update_node_usage,
            sender=rancher_models.Node,
            dispatch_uid=
            'waldur_mastermind.marketplace_rancher.update_node_usage',
        )

        signals.post_save.connect(
            handlers.create_offering_user_for_rancher_user,
            sender=rancher_models.RancherUser,
            dispatch_uid=
            'waldur_mastermind.marketplace_rancher.create_offering_user_for_rancher_user',
        )

        signals.pre_delete.connect(
            handlers.drop_offering_user_for_rancher_user,
            sender=rancher_models.RancherUser,
            dispatch_uid=
            'waldur_mastermind.marketplace_rancher.drop_offering_user_for_rancher_user',
        )
Exemplo n.º 3
0
    def ready(self):
        from waldur_mastermind.marketplace.plugins import Component
        from waldur_mastermind.marketplace.plugins import manager
        from waldur_mastermind.marketplace import handlers as marketplace_handlers
        from waldur_mastermind.invoices import registrators
        from waldur_mastermind.marketplace import models as marketplace_models
        from waldur_vmware import models as vmware_models
        from waldur_vmware import signals as vmware_signals
        from waldur_vmware.apps import VMwareConfig

        from . import handlers, registrators as vmware_registrators, processors, VIRTUAL_MACHINE_TYPE

        resource_models = (
            vmware_models.VirtualMachine,
        )

        marketplace_handlers.connect_resource_handlers(*resource_models)
        marketplace_handlers.connect_resource_metadata_handlers(*resource_models)

        USAGE = marketplace_models.OfferingComponent.BillingTypes.USAGE
        manager.register(offering_type=VIRTUAL_MACHINE_TYPE,
                         create_resource_processor=processors.VirtualMachineCreateProcessor,
                         service_type=VMwareConfig.service_name,
                         components=(
                             Component(type='cpu', name='CPU', measured_unit='vCPU', billing_type=USAGE),
                             # Price is stored per GiB but size is stored per MiB
                             # therefore we need to divide size by factor when price estimate is calculated.
                             Component(type='ram', name='RAM', measured_unit='GB', billing_type=USAGE, factor=1024),
                             Component(type='disk', name='Disk', measured_unit='GB', billing_type=USAGE, factor=1024),
                         ))

        registrators.RegistrationManager.add_registrator(
            vmware_models.VirtualMachine,
            vmware_registrators.VirtualMachineRegistrator
        )

        vmware_signals.vm_created.connect(
            handlers.add_new_vm_to_invoice,
            dispatch_uid='marketplace_vmware.handlers.add_new_vm_to_invoice',
        )

        signals.pre_delete.connect(
            handlers.terminate_invoice_when_vm_deleted,
            sender=vmware_models.VirtualMachine,
            dispatch_uid='marketplace_vmware.handlers.terminate_invoice_when_vm_deleted',
        )

        vmware_signals.vm_updated.connect(
            handlers.create_invoice_item_when_vm_is_updated,
            dispatch_uid='marketplace_vmware.handlers.create_invoice_item_when_vm_is_updated',
        )

        vmware_signals.vm_updated.connect(
            handlers.update_marketplace_resource_limits_when_vm_is_updated,
            dispatch_uid='marketplace_vmware.handlers.'
                         'update_marketplace_resource_limits_when_vm_is_updated',
        )
Exemplo n.º 4
0
    def ready(self):
        from waldur_mastermind.marketplace.plugins import Component, manager
        from waldur_mastermind.marketplace import models as marketplace_models
        from waldur_mastermind.marketplace import handlers as marketplace_handlers
        from waldur_mastermind.marketplace_slurm import PLUGIN_NAME
        from waldur_slurm import models as slurm_models
        from waldur_slurm.apps import SlurmConfig

        from . import handlers, processor

        signals.post_save.connect(
            handlers.create_slurm_package,
            sender=marketplace_models.PlanComponent,
            dispatch_uid=
            'waldur_mastermind.marketpace_slurm.create_slurm_package',
        )

        signals.post_save.connect(
            handlers.create_slurm_usage,
            sender=slurm_models.AllocationUsage,
            dispatch_uid=
            'waldur_mastermind.marketpace_slurm.create_slurm_usage',
        )

        signals.post_save.connect(
            handlers.update_component_quota,
            sender=slurm_models.Allocation,
            dispatch_uid=
            'waldur_mastermind.marketpace_slurm.update_component_quota',
        )

        marketplace_handlers.connect_resource_handlers(slurm_models.Allocation)
        marketplace_handlers.connect_resource_metadata_handlers(
            slurm_models.Allocation)

        USAGE = marketplace_models.OfferingComponent.BillingTypes.USAGE
        manager.register(
            PLUGIN_NAME,
            create_resource_processor=processor.CreateAllocationProcessor,
            delete_resource_processor=processor.DeleteAllocationProcessor,
            components=(
                Component(type='cpu',
                          name='CPU',
                          measured_unit='hours',
                          billing_type=USAGE),
                Component(type='gpu',
                          name='GPU',
                          measured_unit='hours',
                          billing_type=USAGE),
                Component(type='ram',
                          name='RAM',
                          measured_unit='GB',
                          billing_type=USAGE),
            ),
            service_type=SlurmConfig.service_name)
Exemplo n.º 5
0
    def ready(self):
        from waldur_azure import models as azure_models
        from waldur_azure.apps import AzureConfig
        from waldur_mastermind.marketplace.plugins import manager
        from waldur_mastermind.marketplace import handlers as marketplace_handlers
        from waldur_core.structure import signals as structure_signals

        from . import handlers, processors, VIRTUAL_MACHINE_TYPE, SQL_SERVER_TYPE

        resource_models = (
            azure_models.VirtualMachine,
            azure_models.SQLServer,
            azure_models.SQLDatabase,
        )

        marketplace_handlers.connect_resource_handlers(*resource_models)
        marketplace_handlers.connect_resource_metadata_handlers(
            *resource_models)

        signals.post_save.connect(
            handlers.synchronize_nic,
            sender=azure_models.NetworkInterface,
            dispatch_uid='waldur_mastermind.marketplace_azure.synchronize_nic',
        )

        signals.post_save.connect(
            handlers.synchronize_public_ip,
            sender=azure_models.PublicIP,
            dispatch_uid=
            'waldur_mastermind.marketplace_azure.synchronize_public_ip',
        )

        manager.register(
            offering_type=VIRTUAL_MACHINE_TYPE,
            create_resource_processor=processors.VirtualMachineCreateProcessor,
            delete_resource_processor=processors.VirtualMachineDeleteProcessor,
            service_type=AzureConfig.service_name,
            get_importable_resources_backend_method=
            'get_importable_virtual_machines',
            import_resource_backend_method='import_virtual_machine',
        )

        manager.register(
            offering_type=SQL_SERVER_TYPE,
            create_resource_processor=processors.SQLServerCreateProcessor,
            delete_resource_processor=processors.SQLServerDeleteProcessor,
            service_type=AzureConfig.service_name,
        )

        structure_signals.resource_imported.connect(
            handlers.create_marketplace_resource_for_imported_resources,
            sender=azure_models.VirtualMachine,
            dispatch_uid='waldur_mastermind.marketplace_azure.'
            'create_resource_for_imported_vm',
        )
Exemplo n.º 6
0
    def ready(self):
        from waldur_core.quotas import models as quota_models
        from waldur_core.structure import models as structure_models
        from waldur_core.structure import signals as structure_signals
        from waldur_openstack.openstack import models as openstack_models
        from waldur_openstack.openstack.apps import OpenStackConfig
        from waldur_openstack.openstack_tenant import models as tenant_models
        from waldur_mastermind.invoices import registrators
        from waldur_mastermind.marketplace import models as marketplace_models
        from waldur_mastermind.marketplace import filters as marketplace_filters
        from waldur_mastermind.marketplace import handlers as marketplace_handlers
        from waldur_mastermind.marketplace import signals as marketplace_signals
        from waldur_mastermind.marketplace.plugins import manager
        from waldur_mastermind.marketplace.plugins import Component
        from waldur_mastermind.marketplace_openstack.registrators import MarketplaceItemRegistrator
        from waldur_mastermind.packages import models as package_models

        from . import (filters, handlers, processors, INSTANCE_TYPE,
                       VOLUME_TYPE, PACKAGE_TYPE, RAM_TYPE, CORES_TYPE,
                       STORAGE_TYPE, AVAILABLE_LIMITS)

        marketplace_filters.ExternalOfferingFilterBackend.register(
            filters.VpcExternalFilter())

        signals.post_save.connect(
            handlers.create_offering_from_tenant,
            sender=openstack_models.Tenant,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.create_offering_from_tenant',
        )

        signals.pre_delete.connect(
            handlers.archive_offering,
            sender=structure_models.ServiceSettings,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.archive_offering',
        )

        resource_models = (tenant_models.Instance, tenant_models.Volume,
                           openstack_models.Tenant)
        marketplace_handlers.connect_resource_metadata_handlers(
            *resource_models)
        marketplace_handlers.connect_resource_handlers(*resource_models)

        signals.post_save.connect(
            handlers.create_template_for_plan,
            sender=marketplace_models.Plan,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.create_template_for_plan',
        )

        signals.post_save.connect(
            handlers.update_template_for_plan,
            sender=marketplace_models.Plan,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.update_template_for_plan',
        )

        signals.post_save.connect(
            handlers.update_plan_for_template,
            sender=package_models.PackageTemplate,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.update_plan_for_template',
        )

        signals.post_save.connect(
            handlers.synchronize_plan_component,
            sender=marketplace_models.PlanComponent,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.synchronize_plan_component',
        )

        FIXED = marketplace_models.OfferingComponent.BillingTypes.FIXED
        manager.register(
            offering_type=PACKAGE_TYPE,
            create_resource_processor=processors.PackageCreateProcessor,
            update_resource_processor=processors.PackageUpdateProcessor,
            delete_resource_processor=processors.PackageDeleteProcessor,
            components=(
                Component(type=CORES_TYPE,
                          name='Cores',
                          measured_unit='cores',
                          billing_type=FIXED),
                # Price is stored per GiB but size is stored per MiB
                # therefore we need to divide size by factor when price estimate is calculated.
                Component(type=RAM_TYPE,
                          name='RAM',
                          measured_unit='GB',
                          billing_type=FIXED,
                          factor=1024),
                Component(type=STORAGE_TYPE,
                          name='Storage',
                          measured_unit='GB',
                          billing_type=FIXED,
                          factor=1024),
            ),
            service_type=OpenStackConfig.service_name,
            secret_attributes=get_secret_attributes,
            available_limits=AVAILABLE_LIMITS,
            resource_model=openstack_models.Tenant)

        manager.register(
            offering_type=INSTANCE_TYPE,
            create_resource_processor=processors.InstanceCreateProcessor,
            delete_resource_processor=processors.InstanceDeleteProcessor)

        manager.register(
            offering_type=VOLUME_TYPE,
            create_resource_processor=processors.VolumeCreateProcessor,
            delete_resource_processor=processors.VolumeDeleteProcessor)

        signals.post_save.connect(
            handlers.synchronize_volume_metadata,
            sender=tenant_models.Volume,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.synchronize_volume_metadata',
        )

        signals.post_save.connect(
            handlers.synchronize_instance_metadata,
            sender=tenant_models.Instance,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.synchronize_instance_metadata',
        )

        signals.post_save.connect(
            handlers.synchronize_internal_ips,
            sender=tenant_models.InternalIP,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.synchronize_internal_ips',
        )

        signals.post_save.connect(
            handlers.synchronize_floating_ips,
            sender=tenant_models.FloatingIP,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.synchronize_floating_ips',
        )

        signals.post_delete.connect(
            handlers.synchronize_internal_ips_on_delete,
            sender=tenant_models.InternalIP,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.synchronize_internal_ips_on_delete',
        )

        signals.post_delete.connect(
            handlers.synchronize_floating_ips_on_delete,
            sender=tenant_models.FloatingIP,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.synchronize_floating_ips_on_delete',
        )

        signals.post_save.connect(
            handlers.create_resource_of_volume_if_instance_created,
            sender=marketplace_models.Resource,
            dispatch_uid='waldur_mastermind.marketpace_openstack.'
            'create_resource_of_volume_if_instance_created',
        )

        for model in [
                tenant_models.Instance, tenant_models.Volume,
                openstack_models.Tenant
        ]:
            structure_signals.resource_imported.connect(
                handlers.create_marketplace_resource_for_imported_resources,
                sender=model,
                dispatch_uid='waldur_mastermind.marketpace_openstack.'
                'create_resource_for_imported_%s' % model,
            )

        signals.post_save.connect(
            handlers.import_resource_metadata_when_resource_is_created,
            sender=marketplace_models.Resource,
            dispatch_uid='waldur_mastermind.marketpace_openstack.'
            'import_resource_metadata_when_resource_is_created',
        )

        signals.post_save.connect(
            handlers.update_openstack_tenant_usages,
            sender=quota_models.Quota,
            dispatch_uid='waldur_mastermind.marketpace_openstack.'
            'update_openstack_tenant_usages',
        )

        registrators.RegistrationManager.add_registrator(
            marketplace_models.Resource,
            MarketplaceItemRegistrator,
        )

        marketplace_signals.resource_creation_succeeded.connect(
            handlers.update_invoice_when_resource_is_created,
            sender=marketplace_models.Resource,
            dispatch_uid='waldur_mastermind.marketplace.'
            'update_invoice_when_resource_is_created',
        )

        marketplace_signals.limit_update_succeeded.connect(
            handlers.update_invoice_when_resource_is_updated,
            sender=marketplace_models.Resource,
            dispatch_uid='waldur_mastermind.marketplace.'
            'update_invoice_when_resource_is_updated',
        )

        marketplace_signals.resource_deletion_succeeded.connect(
            handlers.update_invoice_when_resource_is_deleted,
            sender=marketplace_models.Resource,
            dispatch_uid='waldur_mastermind.marketplace.'
            'update_invoice_when_resource_is_deleted',
        )
Exemplo n.º 7
0
    def ready(self):
        from waldur_core.structure import models as structure_models
        from waldur_openstack.openstack import models as openstack_models
        from waldur_openstack.openstack.apps import OpenStackConfig
        from waldur_openstack.openstack_tenant import models as tenant_models
        from waldur_mastermind.marketplace import models as marketplace_models
        from waldur_mastermind.marketplace import handlers as marketplace_handlers
        from waldur_mastermind.marketplace.plugins import manager
        from waldur_mastermind.marketplace.plugins import Component

        from . import (
            handlers,
            processors,
            INSTANCE_TYPE,
            VOLUME_TYPE,
            PACKAGE_TYPE,
            RAM_TYPE,
            CORES_TYPE,
            STORAGE_TYPE,
        )

        signals.post_save.connect(
            handlers.create_offering_from_tenant,
            sender=openstack_models.Tenant,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.create_offering_from_tenant',
        )

        signals.pre_delete.connect(
            handlers.archive_offering,
            sender=structure_models.ServiceSettings,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.archive_offering',
        )

        resource_models = (tenant_models.Instance, tenant_models.Volume,
                           openstack_models.Tenant)
        marketplace_handlers.connect_resource_metadata_handlers(
            *resource_models)
        marketplace_handlers.connect_resource_handlers(*resource_models)

        signals.post_save.connect(
            handlers.create_template_for_plan,
            sender=marketplace_models.Plan,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.create_template_for_plan',
        )

        signals.post_save.connect(
            handlers.synchronize_plan_component,
            sender=marketplace_models.PlanComponent,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.synchronize_plan_component',
        )

        FIXED = marketplace_models.OfferingComponent.BillingTypes.FIXED
        manager.register(
            offering_type=PACKAGE_TYPE,
            create_resource_processor=processors.PackageCreateProcessor,
            update_resource_processor=processors.PackageUpdateProcessor,
            delete_resource_processor=processors.PackageDeleteProcessor,
            components=(
                Component(type=RAM_TYPE,
                          name='RAM',
                          measured_unit='GB',
                          billing_type=FIXED),
                Component(type=CORES_TYPE,
                          name='Cores',
                          measured_unit='cores',
                          billing_type=FIXED),
                Component(type=STORAGE_TYPE,
                          name='Storage',
                          measured_unit='GB',
                          billing_type=FIXED),
            ),
            service_type=OpenStackConfig.service_name)

        manager.register(
            offering_type=INSTANCE_TYPE,
            create_resource_processor=processors.InstanceCreateProcessor,
            delete_resource_processor=processors.InstanceDeleteProcessor)

        manager.register(
            offering_type=VOLUME_TYPE,
            create_resource_processor=processors.VolumeCreateProcessor,
            delete_resource_processor=processors.VolumeDeleteProcessor)

        signals.post_save.connect(
            handlers.synchronize_volume_metadata,
            sender=tenant_models.Volume,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.synchronize_volume_metadata',
        )

        signals.post_save.connect(
            handlers.synchronize_instance_metadata,
            sender=tenant_models.Instance,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.synchronize_instance_metadata',
        )

        signals.post_save.connect(
            handlers.synchronize_internal_ips,
            sender=tenant_models.InternalIP,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.synchronize_internal_ips',
        )

        signals.post_save.connect(
            handlers.synchronize_floating_ips,
            sender=tenant_models.FloatingIP,
            dispatch_uid=
            'waldur_mastermind.marketpace_openstack.synchronize_floating_ips',
        )
Exemplo n.º 8
0
    def ready(self):
        from waldur_core.quotas import models as quota_models
        from waldur_core.structure import models as structure_models
        from waldur_core.structure import signals as structure_signals
        from waldur_openstack.openstack import models as openstack_models
        from waldur_openstack.openstack import signals as openstack_signals
        from waldur_openstack.openstack.apps import OpenStackConfig
        from waldur_openstack.openstack_tenant import (
            models as tenant_models,
            executors as tenant_executors,
        )
        from waldur_mastermind.marketplace import models as marketplace_models
        from waldur_mastermind.marketplace import filters as marketplace_filters
        from waldur_mastermind.marketplace import handlers as marketplace_handlers
        from waldur_mastermind.marketplace.plugins import manager
        from waldur_mastermind.marketplace.plugins import Component
        from waldur_mastermind.marketplace_openstack.registrators import (
            OpenStackRegistrator, )

        from . import (
            filters,
            handlers,
            processors,
            INSTANCE_TYPE,
            VOLUME_TYPE,
            TENANT_TYPE,
            RAM_TYPE,
            CORES_TYPE,
            STORAGE_TYPE,
            AVAILABLE_LIMITS,
        )

        marketplace_filters.ExternalOfferingFilterBackend.register(
            filters.VpcExternalFilter())

        signals.post_save.connect(
            handlers.create_offering_from_tenant,
            sender=openstack_models.Tenant,
            dispatch_uid=
            'waldur_mastermind.marketplace_openstack.create_offering_from_tenant',
        )

        signals.pre_delete.connect(
            handlers.archive_offering,
            sender=structure_models.ServiceSettings,
            dispatch_uid=
            'waldur_mastermind.marketplace_openstack.archive_offering',
        )

        resource_models = (
            tenant_models.Instance,
            tenant_models.Volume,
            openstack_models.Tenant,
        )
        marketplace_handlers.connect_resource_metadata_handlers(
            *resource_models)
        marketplace_handlers.connect_resource_handlers(*resource_models)

        LIMIT = marketplace_models.OfferingComponent.BillingTypes.LIMIT
        manager.register(
            offering_type=TENANT_TYPE,
            create_resource_processor=processors.TenantCreateProcessor,
            update_resource_processor=processors.TenantUpdateProcessor,
            delete_resource_processor=processors.TenantDeleteProcessor,
            components=(
                Component(
                    type=CORES_TYPE,
                    name='Cores',
                    measured_unit='cores',
                    billing_type=LIMIT,
                ),
                # Price is stored per GiB but size is stored per MiB
                # therefore we need to divide size by factor when price estimate is calculated.
                Component(
                    type=RAM_TYPE,
                    name='RAM',
                    measured_unit='GB',
                    billing_type=LIMIT,
                    factor=1024,
                ),
                Component(
                    type=STORAGE_TYPE,
                    name='Storage',
                    measured_unit='GB',
                    billing_type=LIMIT,
                    factor=1024,
                ),
            ),
            service_type=OpenStackConfig.service_name,
            secret_attributes=get_secret_attributes,
            components_filter=components_filter,
            available_limits=AVAILABLE_LIMITS,
            can_update_limits=True,
            get_importable_resources_backend_method='get_importable_tenants',
            import_resource_backend_method='import_tenant',
        )

        manager.register(
            offering_type=INSTANCE_TYPE,
            create_resource_processor=processors.InstanceCreateProcessor,
            delete_resource_processor=processors.InstanceDeleteProcessor,
            get_importable_resources_backend_method='get_importable_instances',
            import_resource_backend_method='import_instance',
            import_resource_executor=tenant_executors.InstancePullExecutor,
        )

        manager.register(
            offering_type=VOLUME_TYPE,
            create_resource_processor=processors.VolumeCreateProcessor,
            delete_resource_processor=processors.VolumeDeleteProcessor,
            get_importable_resources_backend_method='get_importable_volumes',
            import_resource_backend_method='import_volume',
        )

        signals.post_save.connect(
            handlers.synchronize_volume_metadata,
            sender=tenant_models.Volume,
            dispatch_uid=
            'waldur_mastermind.marketplace_openstack.synchronize_volume_metadata',
        )

        signals.post_save.connect(
            handlers.synchronize_tenant_name,
            sender=openstack_models.Tenant,
            dispatch_uid=
            'waldur_mastermind.marketplace_openstack.synchronize_tenant_name',
        )

        signals.post_save.connect(
            handlers.synchronize_instance_name,
            sender=tenant_models.Instance,
            dispatch_uid=
            'waldur_mastermind.marketplace_openstack.synchronize_instance_name',
        )

        signals.post_save.connect(
            handlers.synchronize_instance_after_pull,
            sender=tenant_models.Instance,
            dispatch_uid=
            'waldur_mastermind.marketplace_openstack.synchronize_instance_after_pull',
        )

        signals.post_save.connect(
            handlers.synchronize_internal_ips,
            sender=tenant_models.InternalIP,
            dispatch_uid=
            'waldur_mastermind.marketplace_openstack.synchronize_internal_ips',
        )

        signals.post_save.connect(
            handlers.synchronize_floating_ips,
            sender=tenant_models.FloatingIP,
            dispatch_uid=
            'waldur_mastermind.marketplace_openstack.synchronize_floating_ips',
        )

        signals.post_delete.connect(
            handlers.synchronize_internal_ips_on_delete,
            sender=tenant_models.InternalIP,
            dispatch_uid=
            'waldur_mastermind.marketplace_openstack.synchronize_internal_ips_on_delete',
        )

        signals.post_delete.connect(
            handlers.synchronize_floating_ips_on_delete,
            sender=tenant_models.FloatingIP,
            dispatch_uid=
            'waldur_mastermind.marketplace_openstack.synchronize_floating_ips_on_delete',
        )

        signals.post_save.connect(
            handlers.create_resource_of_volume_if_instance_created,
            sender=marketplace_models.Resource,
            dispatch_uid='waldur_mastermind.marketplace_openstack.'
            'create_resource_of_volume_if_instance_created',
        )

        for model in [
                tenant_models.Instance,
                tenant_models.Volume,
                openstack_models.Tenant,
        ]:
            structure_signals.resource_imported.connect(
                handlers.create_marketplace_resource_for_imported_resources,
                sender=model,
                dispatch_uid='waldur_mastermind.marketplace_openstack.'
                'create_resource_for_imported_%s' % model,
            )

        signals.post_save.connect(
            handlers.import_resource_metadata_when_resource_is_created,
            sender=marketplace_models.Resource,
            dispatch_uid='waldur_mastermind.marketplace_openstack.'
            'import_resource_metadata_when_resource_is_created',
        )

        signals.post_save.connect(
            handlers.update_openstack_tenant_usages,
            sender=quota_models.Quota,
            dispatch_uid='waldur_mastermind.marketplace_openstack.'
            'update_openstack_tenant_usages',
        )

        OpenStackRegistrator.connect()

        signals.post_save.connect(
            handlers.create_offering_component_for_volume_type,
            sender=openstack_models.VolumeType,
            dispatch_uid='waldur_mastermind.marketplace_openstack.'
            'create_offering_component_for_volume_type',
        )

        signals.post_delete.connect(
            handlers.delete_offering_component_for_volume_type,
            sender=openstack_models.VolumeType,
            dispatch_uid='waldur_mastermind.marketplace_openstack.'
            'delete_offering_component_for_volume_type',
        )

        signals.post_save.connect(
            handlers.synchronize_limits_when_storage_mode_is_switched,
            sender=marketplace_models.Offering,
            dispatch_uid='waldur_mastermind.marketplace_openstack.'
            'synchronize_limits_when_storage_mode_is_switched',
        )

        structure_signals.resource_imported.connect(
            handlers.import_instances_and_volumes_if_tenant_has_been_imported,
            sender=openstack_models.Tenant,
            dispatch_uid='waldur_mastermind.marketplace_openstack.'
            'import_instances_and_volumes_if_tenant_has_been_imported',
        )

        openstack_signals.tenant_pull_succeeded.connect(
            handlers.import_instances_and_volumes_if_tenant_has_been_imported,
            sender=openstack_models.Tenant,
            dispatch_uid='waldur_mastermind.marketplace_openstack.'
            'import_instances_and_volumes_if_tenant_has_been_imported_if_tenant_has_been_pulled',
        )