~vladimir.p/nova/volume_type_extradata

« back to all changes in this revision

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

  • Committer: vladimir.p
  • Date: 2011-08-24 16:20:54 UTC
  • mfrom: (1453.1.34 nova)
  • Revision ID: vladimir@zadarastorage.com-20110824162054-4fnya95u5j2co40b
merged with 1487

Show diffs side-by-side

added added

removed removed

Lines of Context:
604
604
            LOG.debug(msg)
605
605
            raise exc.HTTPBadRequest(explanation=msg)
606
606
 
 
607
        password = utils.generate_password(16)
 
608
 
607
609
        try:
608
 
            self.compute_api.rebuild(context, instance_id, image_id)
 
610
            self.compute_api.rebuild(context, instance_id, image_id, password)
609
611
        except exception.BuildInProgress:
610
612
            msg = _("Instance %s is currently being rebuilt.") % instance_id
611
613
            LOG.debug(msg)
741
743
            self._validate_metadata(metadata)
742
744
        self._decode_personalities(personalities)
743
745
 
 
746
        password = info["rebuild"].get("adminPass",
 
747
                                       utils.generate_password(16))
 
748
 
744
749
        try:
745
 
            self.compute_api.rebuild(context, instance_id, image_href, name,
746
 
                                     metadata, personalities)
 
750
            self.compute_api.rebuild(context, instance_id, image_href,
 
751
                                     password, name=name, metadata=metadata,
 
752
                                     files_to_inject=personalities)
747
753
        except exception.BuildInProgress:
748
754
            msg = _("Instance %s is currently being rebuilt.") % instance_id
749
755
            LOG.debug(msg)
750
756
            raise exc.HTTPConflict(explanation=msg)
751
 
 
752
 
        return webob.Response(status_int=202)
 
757
        except exception.InstanceNotFound:
 
758
            msg = _("Instance %s could not be found") % instance_id
 
759
            raise exc.HTTPNotFound(explanation=msg)
 
760
 
 
761
        instance = self.compute_api.routing_get(context, instance_id)
 
762
        view = self._build_view(request, instance, is_detail=True)
 
763
        view['server']['adminPass'] = password
 
764
 
 
765
        return view
753
766
 
754
767
    @common.check_snapshots_enabled
755
768
    def _action_create_image(self, input_dict, req, instance_id):
816
829
    def delete(self, response, data):
817
830
        response.status_int = 204
818
831
 
 
832
    def action(self, response, data):
 
833
        response.status_int = 202
 
834
 
819
835
 
820
836
class ServerXMLSerializer(wsgi.XMLDictSerializer):
821
837
 
937
953
        node.setAttribute('adminPass', server_dict['server']['adminPass'])
938
954
        return self.to_xml_string(node, True)
939
955
 
 
956
    def action(self, server_dict):
 
957
        #NOTE(bcwaldon): We need a way to serialize actions individually. This
 
958
        # assumes all actions return a server entity
 
959
        return self.create(server_dict)
 
960
 
940
961
    def update(self, server_dict):
941
962
        xml_doc = minidom.Document()
942
963
        node = self._server_to_xml_detailed(xml_doc,