コード例 #1
0
ファイル: test_network.py プロジェクト: anotherjesse/nova
def is_allocated_in_project(address, project_id):
    """Returns true if address is in specified project"""
    project_net = db.project_get_network(context.get_admin_context(),
                                         project_id)
    network = db.fixed_ip_get_network(context.get_admin_context(), address)
    instance = db.fixed_ip_get_instance(context.get_admin_context(), address)
    # instance exists until release
    return instance is not None and network['id'] == project_net['id']
コード例 #2
0
ファイル: base.py プロジェクト: septimius/nova
 def _is_allocated_in_project(self, address, project_id):
     """Returns true if address is in specified project"""
     project_net = db.network_get_by_bridge(context.get_admin_context(),
                                            FLAGS.flat_network_bridge)
     network = db.fixed_ip_get_network(context.get_admin_context(), address)
     instance = db.fixed_ip_get_instance(context.get_admin_context(),
                                         address)
     # instance exists until release
     return instance is not None and network['id'] == project_net['id']
コード例 #3
0
def release_ip(private_ip):
    """Run del command on dhcpbridge"""
    network_ref = db.fixed_ip_get_network(context.get_admin_context(),
                                          private_ip)
    instance_ref = db.fixed_ip_get_instance(context.get_admin_context(),
                                            private_ip)
    cmd = (binpath('nova-dhcpbridge'), 'del',
           instance_ref['mac_address'],
           private_ip, 'fake')
    env = {'DNSMASQ_INTERFACE': network_ref['bridge'],
           'TESTING': '1',
           'FLAGFILE': FLAGS.dhcpbridge_flagfile}
    (out, err) = utils.execute(*cmd, addl_env=env)
    LOG.debug("RELEASE_IP: %s, %s ", out, err)