diff options
| author | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-08-30 16:08:17 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-08-30 16:08:17 -0700 |
| commit | b9aa0dae0a5a64a244f1bff95ad8af22cf87f7f6 (patch) | |
| tree | 866382fb78d6ffcd070236c478f1b03406d9d093 | |
| parent | 78b5f67153d6ef843d884ba7e94125101ab5f653 (diff) | |
run and terminate work
| -rw-r--r-- | nova/db/sqlalchemy/api.py | 2 | ||||
| -rw-r--r-- | nova/network/linux_net.py | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index a4b0ba545..f40f2a476 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -143,7 +143,7 @@ def fixed_ip_allocate(context, network_id): fixed_ip_ref['allocated'] = True session.add(fixed_ip_ref) session.commit() - return fixed_ip_ref + return fixed_ip_ref['str_id'] def fixed_ip_create(context, network_id, address, reserved=False): diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py index a7b81533b..3bdceac8f 100644 --- a/nova/network/linux_net.py +++ b/nova/network/linux_net.py @@ -125,7 +125,7 @@ def ensure_bridge(bridge, interface, net_attrs=None): def get_dhcp_hosts(context, network_id): hosts = [] for fixed_ip in db.network_get_associated_fixed_ips(context, network_id): - hosts.append(_host_dhcp(fixed_ip)) + hosts.append(_host_dhcp(fixed_ip['str_id'])) return '\n'.join(hosts) @@ -162,11 +162,12 @@ def update_dhcp(context, network_id): command = _dnsmasq_cmd(network_ref) _execute(command, addl_env=env) -def _host_dhcp(fixed_ip): - """Return a host string for a fixed ip""" - return "%s,%s.novalocal,%s" % (fixed_ip.instance['mac_address'], - fixed_ip.instance['hostname'], - fixed_ip['ip_str']) +def _host_dhcp(address): + """Return a host string for an address""" + instance_ref = db.fixed_ip_get_instance(None, address) + return "%s,%s.novalocal,%s" % (instance_ref['mac_address'], + instance_ref['hostname'], + address) def _execute(cmd, *args, **kwargs): |
