~tr3buchet/nova/lock

« back to all changes in this revision

Viewing changes to nova/volume/manager.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:
81
81
        self.driver.check_for_setup_error()
82
82
        ctxt = context.get_admin_context()
83
83
        volumes = self.db.volume_get_all_by_host(ctxt, self.host)
84
 
        logging.debug("Re-exporting %s volumes", len(volumes))
 
84
        logging.debug(_("Re-exporting %s volumes"), len(volumes))
85
85
        for volume in volumes:
86
86
            self.driver.ensure_export(ctxt, volume)
87
87
 
89
89
        """Creates and exports the volume."""
90
90
        context = context.elevated()
91
91
        volume_ref = self.db.volume_get(context, volume_id)
92
 
        logging.info("volume %s: creating", volume_ref['name'])
 
92
        logging.info(_("volume %s: creating"), volume_ref['name'])
93
93
 
94
94
        self.db.volume_update(context,
95
95
                              volume_id,
98
98
        #             before passing it to the driver.
99
99
        volume_ref['host'] = self.host
100
100
 
101
 
        logging.debug("volume %s: creating lv of size %sG",
 
101
        logging.debug(_("volume %s: creating lv of size %sG"),
102
102
                      volume_ref['name'], volume_ref['size'])
103
103
        self.driver.create_volume(volume_ref)
104
104
 
105
 
        logging.debug("volume %s: creating export", volume_ref['name'])
 
105
        logging.debug(_("volume %s: creating export"), volume_ref['name'])
106
106
        self.driver.create_export(context, volume_ref)
107
107
 
108
108
        now = datetime.datetime.utcnow()
109
109
        self.db.volume_update(context,
110
110
                              volume_ref['id'], {'status': 'available',
111
111
                                                 'launched_at': now})
112
 
        logging.debug("volume %s: created successfully", volume_ref['name'])
 
112
        logging.debug(_("volume %s: created successfully"), volume_ref['name'])
113
113
        return volume_id
114
114
 
115
115
    def delete_volume(self, context, volume_id):
117
117
        context = context.elevated()
118
118
        volume_ref = self.db.volume_get(context, volume_id)
119
119
        if volume_ref['attach_status'] == "attached":
120
 
            raise exception.Error("Volume is still attached")
 
120
            raise exception.Error(_("Volume is still attached"))
121
121
        if volume_ref['host'] != self.host:
122
 
            raise exception.Error("Volume is not local to this node")
123
 
        logging.debug("volume %s: removing export", volume_ref['name'])
 
122
            raise exception.Error(_("Volume is not local to this node"))
 
123
        logging.debug(_("volume %s: removing export"), volume_ref['name'])
124
124
        self.driver.remove_export(context, volume_ref)
125
 
        logging.debug("volume %s: deleting", volume_ref['name'])
 
125
        logging.debug(_("volume %s: deleting"), volume_ref['name'])
126
126
        self.driver.delete_volume(volume_ref)
127
127
        self.db.volume_destroy(context, volume_id)
128
 
        logging.debug("volume %s: deleted successfully", volume_ref['name'])
 
128
        logging.debug(_("volume %s: deleted successfully"), volume_ref['name'])
129
129
        return True
130
130
 
131
131
    def setup_compute_volume(self, context, volume_id):