コード例 #1
0
ファイル: test_base.py プロジェクト: zhangheng1442/openstack
    def test_getid(self):
        self.assertEqual(base.getid(4), 4)

        class TmpObject(object):
            id = 4

        self.assertEqual(base.getid(TmpObject), 4)
コード例 #2
0
ファイル: monitor_types.py プロジェクト: 52136/openstack
    def delete(self, monitor_type):
        """
        Delete a specific monitor_type.

        :param monitor_type: The ID of the :class:`ServiceManageType` to get.
        """
        self._delete("/types/%s" % base.getid(monitor_type))
コード例 #3
0
ファイル: monitors.py プロジェクト: 52136/openstack
    def delete(self, monitor):
        """
        Delete a monitor.

        :param monitor: The :class:`ServiceManage` to delete.
        """
        self._delete("/monitors/%s" % base.getid(monitor))
コード例 #4
0
ファイル: monitors.py プロジェクト: zhangheng1442/openstack
    def delete(self, monitor):
        """
        Delete a monitor.

        :param monitor: The :class:`ServiceManage` to delete.
        """
        self._delete("/monitors/%s" % base.getid(monitor))
コード例 #5
0
ファイル: monitor_snapshots.py プロジェクト: 52136/openstack
    def delete(self, snapshot):
        """
        Delete a snapshot.

        :param snapshot: The :class:`Snapshot` to delete.
        """
        self._delete("/snapshots/%s" % base.getid(snapshot))
コード例 #6
0
    def delete(self, monitor_type):
        """
        Delete a specific monitor_type.

        :param monitor_type: The ID of the :class:`ServiceManageType` to get.
        """
        self._delete("/types/%s" % base.getid(monitor_type))
コード例 #7
0
    def delete(self, snapshot):
        """
        Delete a snapshot.

        :param snapshot: The :class:`Snapshot` to delete.
        """
        self._delete("/snapshots/%s" % base.getid(snapshot))
コード例 #8
0
ファイル: monitors.py プロジェクト: zhangheng1442/openstack
 def _action(self, action, monitor, info=None, **kwargs):
     """
     Perform a monitor "action."
     """
     body = {action: info}
     self.run_hooks('modify_body_for_action', body, **kwargs)
     url = '/monitors/%s/action' % base.getid(monitor)
     return self.api.client.post(url, body=body)
コード例 #9
0
ファイル: monitor_types.py プロジェクト: 52136/openstack
    def get(self, monitor_type):
        """
        Get a specific monitor type.

        :param monitor_type: The ID of the :class:`ServiceManageType` to get.
        :rtype: :class:`ServiceManageType`
        """
        return self._get("/types/%s" % base.getid(monitor_type), "monitor_type")
コード例 #10
0
ファイル: monitors.py プロジェクト: 52136/openstack
 def _action(self, action, monitor, info=None, **kwargs):
     """
     Perform a monitor "action."
     """
     body = {action: info}
     self.run_hooks('modify_body_for_action', body, **kwargs)
     url = '/monitors/%s/action' % base.getid(monitor)
     return self.api.client.post(url, body=body)
コード例 #11
0
    def get(self, monitor_type):
        """
        Get a specific monitor type.

        :param monitor_type: The ID of the :class:`ServiceManageType` to get.
        :rtype: :class:`ServiceManageType`
        """
        return self._get("/types/%s" % base.getid(monitor_type),
                         "monitor_type")
コード例 #12
0
    def get_keys(self):
        """
        Get extra specs from a monitor type.

        :param vol_type: The :class:`ServiceManageType` to get extra specs from
        """
        _resp, body = self.manager.api.client.get("/types/%s/extra_specs" %
                                                  base.getid(self))
        return body["extra_specs"]
コード例 #13
0
ファイル: monitors.py プロジェクト: zhangheng1442/openstack
    def delete_metadata(self, monitor, keys):
        """
        Delete specified keys from monitors metadata.

        :param monitor: The :class:`ServiceManage`.
        :param metadata: A list of keys to be removed.
        """
        for k in keys:
            self._delete("/monitors/%s/metadata/%s" % (base.getid(monitor), k))
コード例 #14
0
ファイル: monitors.py プロジェクト: 52136/openstack
    def delete_metadata(self, monitor, keys):
        """
        Delete specified keys from monitors metadata.

        :param monitor: The :class:`ServiceManage`.
        :param metadata: A list of keys to be removed.
        """
        for k in keys:
            self._delete("/monitors/%s/metadata/%s" % (base.getid(monitor), k))
コード例 #15
0
ファイル: monitors.py プロジェクト: zhangheng1442/openstack
    def set_metadata(self, monitor, metadata):
        """
        Update/Set a monitors metadata.

        :param monitor: The :class:`ServiceManage`.
        :param metadata: A list of keys to be set.
        """
        body = {'metadata': metadata}
        return self._create("/monitors/%s/metadata" % base.getid(monitor),
                            body, "metadata")
コード例 #16
0
ファイル: monitor_types.py プロジェクト: 52136/openstack
    def get_keys(self):
        """
        Get extra specs from a monitor type.

        :param vol_type: The :class:`ServiceManageType` to get extra specs from
        """
        _resp, body = self.manager.api.client.get(
            "/types/%s/extra_specs" %
            base.getid(self))
        return body["extra_specs"]
コード例 #17
0
ファイル: monitors.py プロジェクト: 52136/openstack
    def set_metadata(self, monitor, metadata):
        """
        Update/Set a monitors metadata.

        :param monitor: The :class:`ServiceManage`.
        :param metadata: A list of keys to be set.
        """
        body = {'metadata': metadata}
        return self._create("/monitors/%s/metadata" % base.getid(monitor),
                            body, "metadata")
コード例 #18
0
ファイル: monitor_snapshots.py プロジェクト: 52136/openstack
    def update(self, snapshot, **kwargs):
        """
        Update the display_name or display_description for a snapshot.

        :param snapshot: The :class:`Snapshot` to delete.
        """
        if not kwargs:
            return

        body = {"snapshot": kwargs}

        self._update("/snapshots/%s" % base.getid(snapshot), body)
コード例 #19
0
ファイル: monitors.py プロジェクト: zhangheng1442/openstack
    def update(self, monitor, **kwargs):
        """
        Update the display_name or display_description for a monitor.

        :param monitor: The :class:`ServiceManage` to delete.
        """
        if not kwargs:
            return

        body = {"monitor": kwargs}

        self._update("/monitors/%s" % base.getid(monitor), body)
コード例 #20
0
    def set_keys(self, metadata):
        """
        Set extra specs on a monitor type.

        :param type : The :class:`ServiceManageType` to set extra spec on
        :param metadata: A dict of key/value pairs to be set
        """
        body = {'extra_specs': metadata}
        return self.manager._create("/types/%s/extra_specs" % base.getid(self),
                                    body,
                                    "extra_specs",
                                    return_raw=True)
コード例 #21
0
ファイル: monitors.py プロジェクト: 52136/openstack
    def update(self, monitor, **kwargs):
        """
        Update the display_name or display_description for a monitor.

        :param monitor: The :class:`ServiceManage` to delete.
        """
        if not kwargs:
            return

        body = {"monitor": kwargs}

        self._update("/monitors/%s" % base.getid(monitor), body)
コード例 #22
0
    def update(self, snapshot, **kwargs):
        """
        Update the display_name or display_description for a snapshot.

        :param snapshot: The :class:`Snapshot` to delete.
        """
        if not kwargs:
            return

        body = {"snapshot": kwargs}

        self._update("/snapshots/%s" % base.getid(snapshot), body)
コード例 #23
0
ファイル: monitor_types.py プロジェクト: 52136/openstack
    def set_keys(self, metadata):
        """
        Set extra specs on a monitor type.

        :param type : The :class:`ServiceManageType` to set extra spec on
        :param metadata: A dict of key/value pairs to be set
        """
        body = {'extra_specs': metadata}
        return self.manager._create(
            "/types/%s/extra_specs" % base.getid(self),
            body,
            "extra_specs",
            return_raw=True)
コード例 #24
0
    def unset_keys(self, keys):
        """
        Unset extra specs on a volue type.

        :param type_id: The :class:`ServiceManageType` to unset extra spec on
        :param keys: A list of keys to be unset
        """

        # NOTE(jdg): This wasn't actually doing all of the keys before
        # the return in the loop resulted in ony ONE key being unset.
        # since on success the return was NONE, we'll only interrupt the loop
        # and return if there's an error
        resp = None
        for k in keys:
            resp = self.manager._delete("/types/%s/extra_specs/%s" %
                                        (base.getid(self), k))
            if resp is not None:
                return resp
コード例 #25
0
ファイル: monitor_types.py プロジェクト: 52136/openstack
    def unset_keys(self, keys):
        """
        Unset extra specs on a volue type.

        :param type_id: The :class:`ServiceManageType` to unset extra spec on
        :param keys: A list of keys to be unset
        """

        # NOTE(jdg): This wasn't actually doing all of the keys before
        # the return in the loop resulted in ony ONE key being unset.
        # since on success the return was NONE, we'll only interrupt the loop
        # and return if there's an error
        resp = None
        for k in keys:
            resp = self.manager._delete(
                "/types/%s/extra_specs/%s" % (
                base.getid(self), k))
            if resp is not None:
                return resp
コード例 #26
0
ファイル: monitors.py プロジェクト: zhangheng1442/openstack
 def force_delete(self, monitor):
     return self._action('os-force_delete', base.getid(monitor))
コード例 #27
0
ファイル: test_base.py プロジェクト: 52136/openstack
    def test_getid(self):
        self.assertEqual(base.getid(4), 4)

        class TmpObject(object):
            id = 4
        self.assertEqual(base.getid(TmpObject), 4)
コード例 #28
0
ファイル: monitors.py プロジェクト: 52136/openstack
 def force_delete(self, monitor):
     return self._action('os-force_delete', base.getid(monitor))
コード例 #29
0
ファイル: monitor_backups.py プロジェクト: 52136/openstack
    def delete(self, backup):
        """Delete a monitor backup.

        :param backup: The :class:`ServiceManageBackup` to delete.
        """
        self._delete("/backups/%s" % base.getid(backup))
コード例 #30
0
    def delete(self, backup):
        """Delete a monitor backup.

        :param backup: The :class:`ServiceManageBackup` to delete.
        """
        self._delete("/backups/%s" % base.getid(backup))