~gandelman-a/ubuntu/precise/nova/UCA_2012.2.1

« back to all changes in this revision

Viewing changes to nova/virt/disk/api.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-05-24 13:12:53 UTC
  • mfrom: (1.1.55)
  • Revision ID: package-import@ubuntu.com-20120524131253-ommql08fg1en06ut
Tags: 2012.2~f1-0ubuntu1
* New upstream release.
* Prepare for quantal:
  - Dropped debian/patches/upstream/0006-Use-project_id-in-ec2.cloud._format_image.patch
  - Dropped debian/patches/upstream/0005-Populate-image-properties-with-project_id-again.patch
  - Dropped debian/patches/upstream/0004-Fixed-bug-962840-added-a-test-case.patch
  - Dropped debian/patches/upstream/0003-Allow-unprivileged-RADOS-users-to-access-rbd-volumes.patch
  - Dropped debian/patches/upstream/0002-Stop-libvirt-test-from-deleting-instances-dir.patch
  - Dropped debian/patches/upstream/0001-fix-bug-where-nova-ignores-glance-host-in-imageref.patch 
  - Dropped debian/patches/0001-fix-useexisting-deprecation-warnings.patch
* debian/control: Add python-keystone as a dependency. (LP: #907197)
* debian/patches/kombu_tests_timeout.patch: Refreshed.
* debian/nova.conf, debian/nova-common.postinst: Convert to new ini
  file configuration
* debian/patches/nova-manage_flagfile_location.patch: Refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
            self.handlers.remove('loop')
163
163
 
164
164
        if not self.handlers:
165
 
            raise exception.Error(_('no capable image handler configured'))
 
165
            msg = _('no capable image handler configured')
 
166
            raise exception.NovaException(msg)
166
167
 
167
168
    @property
168
169
    def errors(self):
175
176
        for cls in (loop.Mount, nbd.Mount, guestfs.Mount):
176
177
            if cls.mode == mode:
177
178
                return cls
178
 
        raise exception.Error(_("unknown disk image handler: %s") % mode)
 
179
        msg = _("unknown disk image handler: %s") % mode
 
180
        raise exception.NovaException(msg)
179
181
 
180
182
    def mount(self):
181
183
        """Mount a disk image, using the object attributes.
186
188
        contains any diagnostics.
187
189
        """
188
190
        if self._mounter:
189
 
            raise exception.Error(_('image already mounted'))
 
191
            raise exception.NovaException(_('image already mounted'))
190
192
 
191
193
        if not self.mount_dir:
192
194
            self.mount_dir = tempfile.mkdtemp()
242
244
        finally:
243
245
            img.umount()
244
246
    else:
245
 
        raise exception.Error(img.errors)
 
247
        raise exception.NovaException(img.errors)
246
248
 
247
249
 
248
250
def inject_files(image, files, partition=None, use_cow=False):
255
257
        finally:
256
258
            img.umount()
257
259
    else:
258
 
        raise exception.Error(img.errors)
 
260
        raise exception.NovaException(img.errors)
259
261
 
260
262
 
261
263
def setup_container(image, container_dir=None, use_cow=False):
271
273
        if img.mount():
272
274
            return img
273
275
        else:
274
 
            raise exception.Error(img.errors)
 
276
            raise exception.NovaException(img.errors)
275
277
    except Exception, exn:
276
278
        LOG.exception(_('Failed to mount filesystem: %s'), exn)
277
279
 
403
405
    :param passwd_file: path to the passwd file
404
406
    :param shadow_file: path to the shadow password file
405
407
    :returns: nothing
406
 
    :raises: exception.Error(), IOError()
 
408
    :raises: exception.NovaException(), IOError()
407
409
 
408
410
    """
409
411
    salt_set = ('abcdefghijklmnopqrstuvwxyz'
439
441
                break
440
442
        if not found:
441
443
            msg = _('User %(username)s not found in password file.')
442
 
            raise exception.Error(msg % username)
 
444
            raise exception.NovaException(msg % username)
443
445
 
444
446
        # update password in the shadow file.It's an error if the
445
447
        # the user doesn't exist.
455
457
        s_file.close()
456
458
        if not found:
457
459
            msg = _('User %(username)s not found in shadow file.')
458
 
            raise exception.Error(msg % username)
 
460
            raise exception.NovaException(msg % username)
459
461
        s_file = open(shadow_file, 'wb')
460
462
        for entry in new_shadow:
461
463
            s_file.write(entry)