コード例 #1
0
ファイル: server_fault.py プロジェクト: YuShangbin/mogan
 def get_by_server_uuids(cls, context, server_uuids):
     db_faultdict = cls.dbapi.server_fault_get_by_server_uuids(
         context, server_uuids)
     db_faultlist = itertools.chain(*db_faultdict.values())
     return object_base.obj_make_list(context, cls(context),
                                      objects.ServerFault,
                                      db_faultlist)
コード例 #2
0
 def get_by_attrs(cls, context, endpoint_type, resource_type=None,
                  target_region_name=None, states=None):
     orch_reqs = db_api.orch_request_get_by_attrs(
         context, endpoint_type, resource_type=resource_type,
         target_region_name=target_region_name, states=states)
     return ovo_base.obj_make_list(
         context, cls(context), OrchRequest, orch_reqs)
コード例 #3
0
 def _set_from_db_object(self, context, db_object, fields=None):
     fields = set(fields or self.fields) - {'traits'}
     super(Node, self)._set_from_db_object(context, db_object, fields)
     self.traits = object_base.obj_make_list(
         context, objects.TraitList(context),
         objects.Trait, db_object['traits'])
     self.traits.obj_reset_changes()
コード例 #4
0
ファイル: node.py プロジェクト: michaeltchapman/ironic
 def _set_from_db_object(self, context, db_object, fields=None):
     fields = set(fields or self.fields) - {'traits'}
     super(Node, self)._set_from_db_object(context, db_object, fields)
     self.traits = object_base.obj_make_list(
         context, objects.TraitList(context),
         objects.Trait, db_object['traits'])
     self.traits.obj_reset_changes()
コード例 #5
0
ファイル: bios.py プロジェクト: olliewalsh/ironic
    def get_by_node_id(cls, context, node_id):
        """Get BIOS Setting based on node_id.

        :param context: Security context.
        :param node_id: The node id.
        :raises: NodeNotFound if the node id is not found.
        :return: A list of BIOSSetting objects.
        """
        node_bios_setting = cls.dbapi.get_bios_setting_list(node_id)
        return object_base.obj_make_list(context, cls(), BIOSSetting,
                                         node_bios_setting)
コード例 #6
0
ファイル: bios.py プロジェクト: michaeltchapman/ironic
    def get_by_node_id(cls, context, node_id):
        """Get BIOS Setting based on node_id.

        :param context: Security context.
        :param node_id: The node id.
        :raises: NodeNotFound if the node id is not found.
        :return: A list of BIOSSetting objects.
        """
        node_bios_setting = cls.dbapi.get_bios_setting_list(node_id)
        return object_base.obj_make_list(
            context, cls(), BIOSSetting, node_bios_setting)
コード例 #7
0
    def get_by_node_id(cls, context, node_id):
        """Return all traits for the specified node.

        :param context: security context. NOTE: This should only
                        be used internally by the indirection_api.
                        Unfortunately, RPC requires context as the first
                        argument, even though we don't use it.
                        A context should be set when instantiating the
                        object, e.g.: Trait(context).
        :param node_id: The id of a node.
        :raises: NodeNotFound if the node no longer appears in the database.
        """
        db_traits = cls.dbapi.get_node_traits_by_node_id(node_id)
        return object_base.obj_make_list(context, cls(), Trait, db_traits)
コード例 #8
0
ファイル: trait.py プロジェクト: michaeltchapman/ironic
    def get_by_node_id(cls, context, node_id):
        """Return all traits for the specified node.

        :param context: security context. NOTE: This should only
                        be used internally by the indirection_api.
                        Unfortunately, RPC requires context as the first
                        argument, even though we don't use it.
                        A context should be set when instantiating the
                        object, e.g.: Trait(context).
        :param node_id: The id of a node.
        :raises: NodeNotFound if the node no longer appears in the database.
        """
        db_traits = cls.dbapi.get_node_traits_by_node_id(node_id)
        return object_base.obj_make_list(context, cls(), Trait, db_traits)
コード例 #9
0
    def create(cls, context, node_id, traits):
        """Replace all existing traits with the specified list.

        :param context: security context. NOTE: This should only
                        be used internally by the indirection_api.
                        Unfortunately, RPC requires context as the first
                        argument, even though we don't use it.
                        A context should be set when instantiating the
                        object, e.g.: Trait(context).
        :param node_id: The id of a node.
        :param traits: List of Strings; traits to set.
        :raises: InvalidParameterValue if adding the trait would exceed the
            per-node traits limit.
        :raises: NodeNotFound if the node no longer appears in the database.
        """
        version = Trait.get_target_version()
        db_traits = cls.dbapi.set_node_traits(node_id, traits, version)
        return object_base.obj_make_list(context, cls(), Trait, db_traits)
コード例 #10
0
ファイル: trait.py プロジェクト: michaeltchapman/ironic
    def create(cls, context, node_id, traits):
        """Replace all existing traits with the specified list.

        :param context: security context. NOTE: This should only
                        be used internally by the indirection_api.
                        Unfortunately, RPC requires context as the first
                        argument, even though we don't use it.
                        A context should be set when instantiating the
                        object, e.g.: Trait(context).
        :param node_id: The id of a node.
        :param traits: List of Strings; traits to set.
        :raises: InvalidParameterValue if adding the trait would exceed the
            per-node traits limit.
        :raises: NodeNotFound if the node no longer appears in the database.
        """
        version = Trait.get_target_version()
        db_traits = cls.dbapi.set_node_traits(node_id, traits, version)
        return object_base.obj_make_list(context, cls(), Trait, db_traits)
コード例 #11
0
ファイル: bios.py プロジェクト: olliewalsh/ironic
    def save(cls, context, node_id, settings):
        """Save a list of BIOS Setting updates in DB.

        :param context: Security context. NOTE: This should only
                        be used internally by the indirection_api.
                        Unfortunately, RPC requires context as the first
                        argument, even though we don't use it.
                        A context should be set when instantiating the
                        object, e.g.: BIOSSetting(context)
        :param node_id: The node id.
        :param settings: A list of bios settings.
        :raises: NodeNotFound if the node id is not found.
        :raises: BIOSSettingNotFound if any of the bios setting names
            is not found.
        :return: A list of BIOSSetting objects.
        """
        version = BIOSSetting.get_target_version()
        updated_setting_list = cls.dbapi.update_bios_setting_list(
            node_id, settings, version)
        return object_base.obj_make_list(context, cls(), BIOSSetting,
                                         updated_setting_list)
コード例 #12
0
ファイル: bios.py プロジェクト: michaeltchapman/ironic
    def save(cls, context, node_id, settings):
        """Save a list of BIOS Setting updates in DB.

        :param context: Security context. NOTE: This should only
                        be used internally by the indirection_api.
                        Unfortunately, RPC requires context as the first
                        argument, even though we don't use it.
                        A context should be set when instantiating the
                        object, e.g.: BIOSSetting(context)
        :param node_id: The node id.
        :param settings: A list of bios settings.
        :raises: NodeNotFound if the node id is not found.
        :raises: BIOSSettingNotFound if any of the bios setting names
            is not found.
        :return: A list of BIOSSetting objects.
        """
        version = BIOSSetting.get_target_version()
        updated_setting_list = cls.dbapi.update_bios_setting_list(
            node_id, settings, version)
        return object_base.obj_make_list(
            context, cls(), BIOSSetting, updated_setting_list)
コード例 #13
0
 def get_by_project_id(cls, context, project_id):
     project_server_groups = cls.dbapi.server_group_get_all(
         context, project_id)
     return object_base.obj_make_list(context, cls(context), ServerGroup,
                                      project_server_groups)
コード例 #14
0
 def get_all(cls, context):
     db_groups = cls.dbapi.server_group_get_all(context)
     return object_base.obj_make_list(context, cls(context), ServerGroup,
                                      db_groups)
コード例 #15
0
 def get_by_node_uuid(cls, context, node_uuid):
     db_ports = cls.dbapi.compute_port_get_by_node_uuid(context, node_uuid)
     return object_base.obj_make_list(context, cls(context), ComputePort,
                                      db_ports)
コード例 #16
0
 def get_all(cls, context):
     db_aggregates = cls.dbapi.aggregate_get_all(context)
     return object_base.obj_make_list(context, cls(context), Aggregate,
                                      db_aggregates)
コード例 #17
0
 def get_by_resource_id(cls, context, resource_id):
     subcloud_resources = db_api.subcloud_resources_get_by_resource(
         context, resource_id)
     return ovo_base.obj_make_list(context, cls(context), SubcloudResource,
                                   subcloud_resources)
コード例 #18
0
 def get_by_metadata(cls, context, key, value):
     db_aggregates = cls.dbapi.aggregate_get_by_metadata(
         context, key, value)
     return object_base.obj_make_list(context, cls(context), Aggregate,
                                      db_aggregates)
コード例 #19
0
ファイル: stack_tag.py プロジェクト: Hybrid-Cloud/conveyor
 def from_db_object(cls, context, db_tags):
     if db_tags is not None:
         return base.obj_make_list(context, cls(), StackTag, db_tags)
コード例 #20
0
 def get_by_server_uuid(cls, context, server_uuid):
     nics = cls.dbapi.server_nics_get_by_server_uuid(
         context, server_uuid)
     return object_base.obj_make_list(context, cls(context), ServerNic,
                                      nics)
コード例 #21
0
ファイル: stack_tag.py プロジェクト: Hybrid-Cloud/conveyor
 def set(cls, context, stack_id, tags):
     db_tags = db_api.stack_tags_set(context, stack_id, tags)
     if db_tags:
         return base.obj_make_list(context, cls(), StackTag, db_tags)
コード例 #22
0
    def get_by_user(cls, context, user_id):
        db_keypairs = cls.dbapi.key_pair_get_all_by_user(context, user_id)

        return object_base.obj_make_list(context, cls(context),
                                         objects.KeyPair, db_keypairs)
コード例 #23
0
ファイル: stack_tag.py プロジェクト: Hybrid-Cloud/conveyor
 def set(cls, context, stack_id, tags):
     db_tags = db_api.stack_tags_set(context, stack_id, tags)
     if db_tags:
         return base.obj_make_list(context, cls(), StackTag, db_tags)
コード例 #24
0
ファイル: stack_tag.py プロジェクト: Hybrid-Cloud/conveyor
 def from_db_object(cls, context, db_tags):
     if db_tags is not None:
         return base.obj_make_list(context, cls(), StackTag, db_tags)
コード例 #25
0
 def get_all(cls, context):
     subclouds = db_api.subcloud_get_all(context)
     return ovo_base.obj_make_list(
         context, cls(context), Subcloud, subclouds)
コード例 #26
0
 def get_all(cls, context, resource_type=None):
     resources = db_api.resource_get_all(context, resource_type)
     return ovo_base.obj_make_list(context, cls(context), Resource,
                                   resources)