Example #1
0
    def _provision_volume(self, context, vol, vsa_id, availability_zone):

        if availability_zone is None:
            availability_zone = FLAGS.storage_availability_zone

        now = utils.utcnow()
        options = {
            'size': vol['size'],
            'user_id': context.user_id,
            'project_id': context.project_id,
            'snapshot_id': None,
            'availability_zone': availability_zone,
            'status': "creating",
            'attach_status': "detached",
            'display_name': vol['name'],
            'display_description': vol['description'],
            'volume_type_id': vol['volume_type_id'],
            'metadata': dict(to_vsa_id=vsa_id),
        }

        size = vol['size']
        host = vol['host']
        name = vol['name']
        LOG.debug(_("Provision volume %(name)s of size %(size)s GB on "\
                    "host %(host)s"), locals())

        volume_ref = db.volume_create(context.elevated(), options)
        driver.cast_to_volume_host(context,
                                   vol['host'],
                                   'create_volume',
                                   volume_id=volume_ref['id'],
                                   snapshot_id=None)
Example #2
0
    def _provision_volume(self, context, vol, vsa_id, availability_zone):

        if availability_zone is None:
            availability_zone = FLAGS.storage_availability_zone

        now = utils.utcnow()
        options = {
            'size': vol['size'],
            'user_id': context.user_id,
            'project_id': context.project_id,
            'snapshot_id': None,
            'availability_zone': availability_zone,
            'status': "creating",
            'attach_status': "detached",
            'display_name': vol['name'],
            'display_description': vol['description'],
            'volume_type_id': vol['volume_type_id'],
            'metadata': dict(to_vsa_id=vsa_id),
            }

        size = vol['size']
        host = vol['host']
        name = vol['name']
        LOG.debug(_("Provision volume %(name)s of size %(size)s GB on "\
                    "host %(host)s"), locals())

        volume_ref = db.volume_create(context.elevated(), options)
        driver.cast_to_volume_host(context, vol['host'],
                'create_volume', volume_id=volume_ref['id'],
                snapshot_id=None)
Example #3
0
 def _create_volume(self, size=10):
     """Create a test volume"""
     vol = {}
     vol['user_id'] = self.user_id
     vol['project_id'] = self.project_id
     vol['size'] = size
     return db.volume_create(self.context, vol)['id']
Example #4
0
 def _create_volume(self, size=10):
     """Create a test volume"""
     vol = {}
     vol['user_id'] = self.user_id
     vol['project_id'] = self.project_id
     vol['size'] = size
     return db.volume_create(self.context, vol)['id']
 def _create_volume(size='0', snapshot_id=None):
     """Create a volume object."""
     vol = {}
     vol['size'] = size
     vol['snapshot_id'] = snapshot_id
     vol['user_id'] = 'fake'
     vol['project_id'] = 'fake'
     vol['availability_zone'] = FLAGS.storage_availability_zone
     vol['status'] = "creating"
     vol['attach_status'] = "detached"
     return db.volume_create(context.get_admin_context(), vol)['id']
Example #6
0
 def _create_volume(self, size='0'):
     """Create a volume object."""
     vol = {}
     vol['size'] = size
     vol['user_id'] = 'fake'
     vol['project_id'] = 'fake'
     vol['host'] = 'localhost'
     vol['availability_zone'] = FLAGS.storage_availability_zone
     vol['status'] = "creating"
     vol['attach_status'] = "detached"
     return db.volume_create(self.context, vol)
Example #7
0
 def _create_volume(size='0', snapshot_id=None):
     """Create a volume object."""
     vol = {}
     vol['size'] = size
     vol['snapshot_id'] = snapshot_id
     vol['user_id'] = 'fake'
     vol['project_id'] = 'fake'
     vol['availability_zone'] = FLAGS.storage_availability_zone
     vol['status'] = "creating"
     vol['attach_status'] = "detached"
     return db.volume_create(context.get_admin_context(), vol)['id']
    def _attach_volume(self):
        """Attach volumes to an instance. This function also sets
           a fake log message."""
        volume_id_list = []
        for index in xrange(3):
            vol = {}
            vol['size'] = 0
            vol_ref = db.volume_create(self.context, vol)
            self.volume.create_volume(self.context, vol_ref['id'])
            vol_ref = db.volume_get(self.context, vol_ref['id'])

            # each volume has a different mountpoint
            mountpoint = "/dev/sd" + chr((ord('b') + index))
            db.volume_attached(self.context, vol_ref['id'], self.instance_id,
                               mountpoint)
            volume_id_list.append(vol_ref['id'])

        return volume_id_list
Example #9
0
    def _attach_volume(self):
        """Attach volumes to an instance. This function also sets
           a fake log message."""
        volume_id_list = []
        for index in xrange(3):
            vol = {}
            vol['size'] = 0
            vol_ref = db.volume_create(self.context, vol)
            self.volume.create_volume(self.context, vol_ref['id'])
            vol_ref = db.volume_get(self.context, vol_ref['id'])

            # each volume has a different mountpoint
            mountpoint = "/dev/sd" + chr((ord('b') + index))
            db.volume_attached(self.context, vol_ref['id'], self.instance_id,
                               mountpoint)
            volume_id_list.append(vol_ref['id'])

        return volume_id_list