~sandy-walsh/nova/zones

« back to all changes in this revision

Viewing changes to nova/api/openstack/servers.py

  • Committer: Sandy Walsh
  • Date: 2011-02-17 21:39:03 UTC
  • mfrom: (635.1.60 nova)
  • Revision ID: sandy.walsh@rackspace.com-20110217213903-swehe88wea8inxow
changed from 003-004 migration

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
 
65
65
    inst_dict['status'] = power_mapping[inst_dict['status']]
66
66
    inst_dict['addresses'] = dict(public=[], private=[])
 
67
 
 
68
    # grab single private fixed ip
 
69
    try:
 
70
        private_ip = inst['fixed_ip']['address']
 
71
        if private_ip:
 
72
            inst_dict['addresses']['private'].append(private_ip)
 
73
    except KeyError:
 
74
        LOG.debug(_("Failed to read private ip"))
 
75
 
 
76
    # grab all public floating ips
 
77
    try:
 
78
        for floating in inst['fixed_ip']['floating_ips']:
 
79
            inst_dict['addresses']['public'].append(floating['address'])
 
80
    except KeyError:
 
81
        LOG.debug(_("Failed to read public ip(s)"))
 
82
 
67
83
    inst_dict['metadata'] = {}
68
84
    inst_dict['hostId'] = ''
69
85
 
249
265
            return faults.Fault(exc.HTTPUnprocessableEntity())
250
266
        return exc.HTTPAccepted()
251
267
 
 
268
    def reset_network(self, req, id):
 
269
        """
 
270
        Reset networking on an instance (admin only).
 
271
 
 
272
        """
 
273
        context = req.environ['nova.context']
 
274
        try:
 
275
            self.compute_api.reset_network(context, id)
 
276
        except:
 
277
            readable = traceback.format_exc()
 
278
            LOG.exception(_("Compute.api::reset_network %s"), readable)
 
279
            return faults.Fault(exc.HTTPUnprocessableEntity())
 
280
        return exc.HTTPAccepted()
 
281
 
252
282
    def pause(self, req, id):
253
283
        """ Permit Admins to Pause the server. """
254
284
        ctxt = req.environ['nova.context']