~tr3buchet/nova/lock

« back to all changes in this revision

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

  • Committer: Vishvananda Ishaya
  • Date: 2010-12-22 20:59:53 UTC
  • mto: This revision was merged to the branch mainline in revision 482.
  • Revision ID: vishvananda@gmail.com-20101222205953-j2j5t0qjwlcd0t2s
merge trunk and upgrade to cheetah templating

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 logging
 
19
import traceback
 
20
 
18
21
from webob import exc
19
22
 
20
23
from nova import exception
27
30
import nova.api.openstack
28
31
 
29
32
 
 
33
LOG = logging.getLogger('server')
 
34
LOG.setLevel(logging.DEBUG)
 
35
 
 
36
 
30
37
def _entity_list(entities):
31
38
    """ Coerces a list of servers into proper dictionary format """
32
39
    return dict(servers=entities)
166
173
        except:
167
174
            return faults.Fault(exc.HTTPUnprocessableEntity())
168
175
        return exc.HTTPAccepted()
 
176
 
 
177
    def pause(self, req, id):
 
178
        """ Permit Admins to Pause the server. """
 
179
        ctxt = req.environ['nova.context']
 
180
        try:
 
181
            self.compute_api.pause(ctxt, id)
 
182
        except:
 
183
            readable = traceback.format_exc()
 
184
            logging.error("Compute.api::pause %s", readable)
 
185
            return faults.Fault(exc.HTTPUnprocessableEntity())
 
186
        return exc.HTTPAccepted()
 
187
 
 
188
    def unpause(self, req, id):
 
189
        """ Permit Admins to Unpause the server. """
 
190
        ctxt = req.environ['nova.context']
 
191
        try:
 
192
            self.compute_api.unpause(ctxt, id)
 
193
        except:
 
194
            readable = traceback.format_exc()
 
195
            logging.error("Compute.api::unpause %s", readable)
 
196
            return faults.Fault(exc.HTTPUnprocessableEntity())
 
197
        return exc.HTTPAccepted()