~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« back to all changes in this revision

Viewing changes to nova/virt/xenapi/volumeops.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:
35
35
    def __init__(self, session):
36
36
        self.XenAPI = session.get_imported_xenapi()
37
37
        self._session = session
38
 
        # Load XenAPI module in the helper classes respectively
39
 
        volume_utils.VolumeHelper.XenAPI = self.XenAPI
40
 
        vm_utils.VMHelper.XenAPI = self.XenAPI
41
38
 
42
39
    def create_volume_for_sm(self, volume, sr_uuid):
43
40
        LOG.debug("Creating volume for Storage Manager")
61
58
    def delete_volume_for_sm(self, vdi_uuid):
62
59
        vdi_ref = self._session.call_xenapi("VDI.get_by_uuid", vdi_uuid)
63
60
        if vdi_ref is None:
64
 
            raise exception.Error(_('Could not find VDI ref'))
 
61
            raise exception.NovaException(_('Could not find VDI ref'))
65
62
 
66
 
        vm_utils.VMHelper.destroy_vdi(vdi_ref)
 
63
        vm_utils.VMHelper.destroy_vdi(self._session, vdi_ref)
67
64
 
68
65
    def create_sr(self, label, params):
69
66
        LOG.debug(_("Creating SR %s") % label)
70
67
        sr_ref = volume_utils.VolumeHelper.create_sr(self._session,
71
68
                                                     label, params)
72
69
        if sr_ref is None:
73
 
            raise exception.Error(_('Could not create SR'))
 
70
            raise exception.NovaException(_('Could not create SR'))
74
71
        sr_rec = self._session.call_xenapi("SR.get_record", sr_ref)
75
72
        if sr_rec is None:
76
 
            raise exception.Error(_('Could not retrieve SR record'))
 
73
            raise exception.NovaException(_('Could not retrieve SR record'))
77
74
        return sr_rec['uuid']
78
75
 
79
76
    # Checks if sr has already been introduced to this host
87
84
        sr_ref = volume_utils.VolumeHelper.introduce_sr(self._session,
88
85
                                                        sr_uuid, label, params)
89
86
        if sr_ref is None:
90
 
            raise exception.Error(_('Could not introduce SR'))
 
87
            raise exception.NovaException(_('Could not introduce SR'))
91
88
        return sr_ref
92
89
 
93
90
    def is_sr_on_host(self, sr_uuid):
109
106
            volume_utils.VolumeHelper.forget_sr(self._session, sr_uuid)
110
107
        except volume_utils.StorageError, exc:
111
108
            LOG.exception(exc)
112
 
            raise exception.Error(_('Could not forget SR'))
 
109
            raise exception.NovaException(_('Could not forget SR'))
113
110
 
114
111
    def attach_volume(self, connection_info, instance_name, mountpoint):
115
112
        """Attach volume storage to VM instance"""