Esempio n. 1
0
    def _register_backends(self):
        """
        Registers the OCCI infrastructure resources to ensure compliance
        with GFD184
        """
        compute_backend = compute.ComputeBackend()
        network_backend = network.NetworkBackend()
        networkinterface_backend = network.NetworkInterfaceBackend()
        ipnetwork_backend = network.IpNetworkBackend()
        ipnetworking_backend = network.IpNetworkInterfaceBackend()

        storage_backend = storage.StorageBackend()
        storage_link_backend = storage.StorageLinkBackend()

        # register kinds with backends
        self.register_backend(infrastructure.COMPUTE, compute_backend)
        self.register_backend(infrastructure.START, compute_backend)
        self.register_backend(infrastructure.STOP, compute_backend)
        self.register_backend(infrastructure.RESTART, compute_backend)
        self.register_backend(infrastructure.SUSPEND, compute_backend)
        self.register_backend(infrastructure.OS_TEMPLATE, MIXIN_BACKEND)
        self.register_backend(infrastructure.RESOURCE_TEMPLATE, MIXIN_BACKEND)

        self.register_backend(infrastructure.NETWORK, network_backend)
        self.register_backend(infrastructure.UP, network_backend)
        self.register_backend(infrastructure.DOWN, network_backend)
        self.register_backend(infrastructure.NETWORKINTERFACE,
                              networkinterface_backend)
        self.register_backend(infrastructure.IPNETWORK, ipnetwork_backend)
        self.register_backend(infrastructure.IPNETWORKINTERFACE,
                              ipnetworking_backend)

        self.register_backend(infrastructure.STORAGE, storage_backend)
        self.register_backend(infrastructure.ONLINE, storage_backend)
        self.register_backend(infrastructure.OFFLINE, storage_backend)
        self.register_backend(infrastructure.BACKUP, storage_backend)
        self.register_backend(infrastructure.SNAPSHOT, storage_backend)
        self.register_backend(infrastructure.RESIZE, storage_backend)
        self.register_backend(infrastructure.STORAGELINK, storage_link_backend)

        # add extensions for occi.
        self.register_backend(os_addon.SEC_GROUP,
                              openstack.SecurityGroupBackend())
        self.register_backend(os_addon.SEC_RULE,
                              openstack.SecurityRuleBackend())
        self.register_backend(os_addon.OS_VM, openstack.OsComputeBackend())
        self.register_backend(os_addon.OS_CREATE_IMAGE,
                              openstack.OsComputeBackend())
        self.register_backend(os_addon.OS_KEY_PAIR_EXT,
                              openstack.OsComputeBackend())
        self.register_backend(os_addon.OS_USER_DATA_EXT,
                              openstack.OsComputeBackend())
        self.register_backend(os_addon.OS_CHG_PWD,
                              openstack.OsComputeBackend())
        self.register_backend(os_addon.OS_NET_LINK,
                              openstack.OsNetLinkBackend())
Esempio n. 2
0
    def set_backend(self, category, backend, extras):
        """
        Assigns user id and tenant id to user defined mixins
        """
        if (hasattr(category, 'related')
                and os_addon.SEC_GROUP in category.related):
            backend = openstack.SecurityGroupBackend()
            backend.init_sec_group(category, extras)

        super(OCCIRegistry, self).set_backend(category, backend, extras)