~ubuntu-cloud-archive/ubuntu/precise/nova/trunk

« back to all changes in this revision

Viewing changes to nova/network/model.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2012-06-22 12:39:57 UTC
  • mfrom: (1.1.57)
  • Revision ID: package-import@ubuntu.com-20120622123957-hbzwg84nt9rqwg8r
Tags: 2012.2~f2~20120621.14517-0ubuntu1
[ Chuck Short ]
* New upstream version.

[ Adam Gandelman ]
* debian/rules: Temporarily disable test suite while blocking
  tests are investigated. 
* debian/patches/kombu_tests_timeout.patch: Dropped.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#    License for the specific language governing permissions and limitations
16
16
#    under the License.
17
17
 
18
 
import json
19
18
import netaddr
20
19
 
21
20
from nova import exception
 
21
from nova.openstack.common import jsonutils
22
22
 
23
23
 
24
24
def ensure_string_keys(d):
271
271
    @classmethod
272
272
    def hydrate(cls, network_info):
273
273
        if isinstance(network_info, basestring):
274
 
            network_info = json.loads(network_info)
 
274
            network_info = jsonutils.loads(network_info)
275
275
        return NetworkInfo([VIF.hydrate(vif) for vif in network_info])
276
276
 
277
277
    def json(self):
278
 
        return json.dumps(self)
 
278
        return jsonutils.dumps(self)
279
279
 
280
280
    def legacy(self):
281
281
        """
344
344
            gateway = get_ip(subnet_v4['gateway'])
345
345
            dhcp_server = subnet_v4.get_meta('dhcp_server', gateway)
346
346
 
347
 
            network_dict = \
348
 
                    {'bridge': network['bridge'],
349
 
                     'id': network['id'],
350
 
                     'cidr': subnet_v4['cidr'],
351
 
                     'cidr_v6': subnet_v6['cidr'] if subnet_v6 else None,
352
 
                     'vlan': network.get_meta('vlan'),
353
 
                     'injected': network.get_meta('injected', False),
354
 
                     'multi_host': network.get_meta('multi_host', False),
355
 
                     'bridge_interface': network.get_meta('bridge_interface')}
 
347
            network_dict = {
 
348
                'bridge': network['bridge'],
 
349
                'id': network['id'],
 
350
                'cidr': subnet_v4['cidr'],
 
351
                'cidr_v6': subnet_v6['cidr'] if subnet_v6 else None,
 
352
                'vlan': network.get_meta('vlan'),
 
353
                'injected': network.get_meta('injected', False),
 
354
                'multi_host': network.get_meta('multi_host', False),
 
355
                'bridge_interface': network.get_meta('bridge_interface')
 
356
            }
356
357
            # NOTE(tr3buchet): 'ips' bit here is tricky, we support a single
357
358
            #                  subnet but we want all the IPs to be there
358
359
            #                  so use the v4_subnets[0] and its IPs are first