Exemplo n.º 1
0
    def update(self,
               new_domain=UNDEF,
               project=UNDEF,
               scope=UNDEF,
               availability_zone=UNDEF):
        """
        Update properties of a domain

        @keyword new_domain: New domain name
        @type new_domain: str
        @keyword project: Project object
        @type project: yakumo.project.Resource
        @keyword scope: 'public' or 'private'
        @type scope: str
        @keyword availability_zone: Availability zone name
        @type availability_zone: str
        @rtype: None
        """
        self._http.put(self._url_resource_path,
                       self._id,
                       data=utils.get_json_body(
                           'domain_entry',
                           domain=new_domain,
                           project=project,
                           scope=scope,
                           availability_zone=availability_zone))
Exemplo n.º 2
0
    def create(self,
               domain=UNDEF,
               project=UNDEF,
               scope=UNDEF,
               availability_zone=UNDEF):
        """
        Create a domain

        @keyword domain: Domain name (str, required)
        @type domain: str
        @keyword project: Project object
        @type project: yakumo.project.Resource
        @keyword scope: 'public' or 'private' (str)
        @type scope: str
        @keyword availability_zone: Availability zone name (str)
        @type availability_zone: str
        @rtype: None
        """
        self._http.put(self._url_resource_path,
                       domain,
                       data=utils.get_json_body(
                           'domain_entry',
                           domain=domain,
                           project=project,
                           scope=scope,
                           availability_zone=availability_zone))
Exemplo n.º 3
0
    def disassociate(self):
        """
        Disassociate a floating IP

        @rtype: None
        """
        self._http.post('/servers/%s/action' % self.server.id,
                        data=utils.get_json_body(
                            'removeFloatingIp', address=self.ip))
Exemplo n.º 4
0
    def unshelve(self):
        """
        Restore a shelved server

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("unshelve"))
Exemplo n.º 5
0
    def unmanage(self):
        """
        Unmanage a volume

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("os-unmanage"))
Exemplo n.º 6
0
    def unrescue(self):
        """
        Terminate the rescue environment

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("unrescue"))
Exemplo n.º 7
0
    def restore(self):
        """
        Restore a defered-deleted server if available

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("restore"))
Exemplo n.º 8
0
    def force_delete(self):
        """
        Force to delete a server

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("forceDelete"))
Exemplo n.º 9
0
    def unlock(self):
        """
        Unlock a server

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("unlock"))
Exemplo n.º 10
0
    def inject_network_info(self):
        """
        Inject network information to a server

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("injectNetworkInfo"))
Exemplo n.º 11
0
    def reset_network(self):
        """
        Reset networking of a server

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("resetNetwork"))
Exemplo n.º 12
0
    def resume(self):
        """
        Resume a server

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("resume"))
Exemplo n.º 13
0
    def suspend(self):
        """
        Suspend a server (save to disk if server is a VM)

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("suspend"))
Exemplo n.º 14
0
    def pause(self):
        """
        Pause a server (save to RAM if server is a VM)

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("pause"))
Exemplo n.º 15
0
    def shelve(self):
        """
        Shelve a running server

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("shelve"))
Exemplo n.º 16
0
    def delete_shelve(self):
        """
        Delete a shelved server

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("shelveOffload"))
Exemplo n.º 17
0
    def start(self):
        """
        Start a server

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("os-start"))
Exemplo n.º 18
0
    def revert_resize(self):
        """
        Revert resizing of a server

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("revertResize"))
Exemplo n.º 19
0
    def confirm_resize(self):
        """
        Confirm resizing of a server

        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("confirmResize"))
Exemplo n.º 20
0
    def associate(self, server=None):
        """
        Associate a floating IP

        @keyword server: Server
        @type server: yakumo.nova.v2.server.Resource
        @rtype: None
        """
        self._http.post('/servers/%s/action' % server.get_id(),
                        data=utils.get_json_body(
                            'addFloatingIp', address=self.ip))
Exemplo n.º 21
0
    def extend(self, size=None):
        """
        Extend a volume

        @keyword size: new size; should be larger than the current size
        @type size: int
        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("os-extend", new_size=size))
Exemplo n.º 22
0
    def set_metadata(self, **kwargs):
        """
        Remove metadata

        **kwargs: key=value style metadata
        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'extra_specs',
                        data=utils.get_json_body("extra_specs", **kwargs))
        self.reload()
Exemplo n.º 23
0
    def rescue(self, password=None):
        """
        Create rescue environment for the server

        @keyword password: password of the rescue OS
        @type password: str
        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("rescue", dminPass=password))
Exemplo n.º 24
0
    def delete_image_metadata(self, key=None):
        """
        Set image metadata

        @keyword key: key to delete
        @type key: str
        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("os-unset_image_metadata",
                                                 key=key))
Exemplo n.º 25
0
    def set_image_metadata(self, metadata=None):
        """
        Set image metadata

        @keyword metadata: new metadata
        @type metadata: dict
        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("os-set_image_metadata",
                                                 metadata=metadata))
Exemplo n.º 26
0
    def remove_project(self, project=None):
        """
        Remove private volume type access

        @keyword project: Project
        @type project: yakumo.project.Resource
        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("removeProjectAccess",
                                                 project=project.get_id()))
Exemplo n.º 27
0
    def reset_status(self, status=None):
        """
        Move a server to another host

        @keyword status: new status of the server ('active', 'pause', ...)
        @type status: str
        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body("os-resetState",
                                                 state=status))
Exemplo n.º 28
0
    def remove_project(self, project=None):
        """
        Make a project accessible to the flavor

        @keyword project: Project (required)
        @type project: yakumo.project.Resource
        @rtype: None
        """
        self._http.post(self._url_resource_path,
                        self._id,
                        'action',
                        data=utils.get_json_body('removeTenantAccess',
                                                 tenant=project.id))
Exemplo n.º 29
0
    def remove_hosts(self, *hosts):
        """
        Unregister hosts from a host aggregate

        @keyword hosts: List of host names
        @type hosts: [str]
        @rtype: None
        """
        for host in hosts:
            self._http.post(self._url_resource_path,
                            self._id,
                            "action",
                            data=utils.get_json_body("remove_host", host=host))
        self.reload()
Exemplo n.º 30
0
    def add_hosts(self, *hosts):
        """
        Register hosts to a host aggregate

        @params hosts: List of host names
        @type hosts: [str]
        @rtype: None
        """
        for host in hosts:
            self._http.post(self._url_resource_path,
                            self._id,
                            "action",
                            data=utils.get_json_body("add_host", host=host))
        self.reload()