コード例 #1
0
ファイル: manage.py プロジェクト: RibeiroAna/nova
    def create(self, name, cell_type='child', username=None, password=None,
               hostname=None, port=None, virtual_host=None,
               woffset=None, wscale=None):

        if cell_type not in ['parent', 'child']:
            print("Error: cell type must be 'parent' or 'child'")
            return(2)

        # Set up the transport URL
        transport_host = messaging.TransportHost(hostname=hostname,
                                                 port=int(port),
                                                 username=username,
                                                 password=password)

        transport_url = rpc.get_transport_url()
        transport_url.hosts.append(transport_host)
        transport_url.virtual_host = virtual_host

        is_parent = cell_type == 'parent'
        values = {'name': name,
                  'is_parent': is_parent,
                  'transport_url': str(transport_url),
                  'weight_offset': float(woffset),
                  'weight_scale': float(wscale)}
        ctxt = context.get_admin_context()
        db.cell_create(ctxt, values)
コード例 #2
0
ファイル: manage.py プロジェクト: comstud/nova
    def create(
        self,
        name,
        cell_type="child",
        username=None,
        password=None,
        hostname=None,
        port=None,
        virtual_host=None,
        woffset=None,
        wscale=None,
    ):

        if cell_type not in ["parent", "child"]:
            print "Error: cell type must be 'parent' or 'child'"
            return 2

        is_parent = cell_type == "parent"
        values = {
            "name": name,
            "is_parent": is_parent,
            "username": username,
            "password": password,
            "rpc_host": hostname,
            "rpc_port": int(port),
            "rpc_virtual_host": virtual_host,
            "weight_offset": float(woffset),
            "weight_scale": float(wscale),
        }
        ctxt = context.get_admin_context()
        db.cell_create(ctxt, values)
コード例 #3
0
ファイル: manage.py プロジェクト: mba811/nova
    def create(self,
               name,
               cell_type='child',
               username=None,
               password=None,
               hostname=None,
               port=None,
               virtual_host=None,
               woffset=None,
               wscale=None):

        if cell_type not in ['parent', 'child']:
            print("Error: cell type must be 'parent' or 'child'")
            return (2)

        # Set up the transport URL
        transport_host = messaging.TransportHost(hostname=hostname,
                                                 port=int(port),
                                                 username=username,
                                                 password=password)

        transport_url = rpc.get_transport_url()
        transport_url.hosts.append(transport_host)
        transport_url.virtual_host = virtual_host

        is_parent = cell_type == 'parent'
        values = {
            'name': name,
            'is_parent': is_parent,
            'transport_url': str(transport_url),
            'weight_offset': float(woffset),
            'weight_scale': float(wscale)
        }
        ctxt = context.get_admin_context()
        db.cell_create(ctxt, values)
コード例 #4
0
    def create(self, name, cell_type='child', username=None, password=None,
               hostname=None, port=None, virtual_host=None,
               woffset=None, wscale=None):

        if cell_type not in ['parent', 'child']:
            print "Error: cell type must be 'parent' or 'child'"
            return(2)

        is_parent = cell_type == 'parent'
        values = {'name': name,
                  'is_parent': is_parent,
                  'username': username,
                  'password': password,
                  'rpc_host': hostname,
                  'rpc_port': int(port),
                  'rpc_virtual_host': virtual_host,
                  'weight_offset': float(woffset),
                  'weight_scale': float(wscale)}
        ctxt = context.get_admin_context()
        db.cell_create(ctxt, values)
コード例 #5
0
ファイル: cells.py プロジェクト: DavidYan/nova
 def create(self, req, body):
     """Create a child cell entry."""
     context = req.environ['nova.context']
     authorize(context)
     if 'cell' not in body:
         msg = _("No cell information in request")
         LOG.error(msg)
         raise exc.HTTPBadRequest(explanation=msg)
     cell = body['cell']
     if 'name' not in cell:
         msg = _("No cell name in request")
         LOG.error(msg)
         raise exc.HTTPBadRequest(explanation=msg)
     self._validate_cell_name(cell['name'])
     self._convert_cell_type(cell)
     cell = db.cell_create(context, cell)
     return dict(cell=_scrub_cell(cell))
コード例 #6
0
 def create(self, req, body):
     """Create a child cell entry."""
     context = req.environ['nova.context']
     authorize(context)
     if 'cell' not in body:
         msg = _("No cell information in request")
         LOG.error(msg)
         raise exc.HTTPBadRequest(explanation=msg)
     cell = body['cell']
     if 'name' not in cell:
         msg = _("No cell name in request")
         LOG.error(msg)
         raise exc.HTTPBadRequest(explanation=msg)
     self._validate_cell_name(cell['name'])
     self._convert_cell_type(cell)
     cell = db.cell_create(context, cell)
     return dict(cell=_scrub_cell(cell))