dell_storagecenter_driver/dell_storagecenter_api.py
def create_volume(self, name, size, storage_profile=None):
        """Creates a new volume on the Storage Center.

        It will create it in a folder called self.vfname.  If self.vfname
        does not exist it will create it.  If it cannot create it
        the volume will be created in the root.

        :param name: Name of the volume to be created on the Dell SC backend.
                     This is the cinder volume ID.
        :param size: The size of the volume to be created in GB.
        :param storage_profile: Optional storage profile to set for the volume.
        :returns: Dell Volume object or None.
        """
        LOG.debug('Create Volume %(name)s %(ssn)s %(folder)s %(profile)s',
                  {'name': name,
                   'ssn': self.ssn,
                   'folder': self.vfname,
                   'profile': storage_profile,
                   })

        # Find our folder
        folder = self._find_volume_folder(True)

        # If we actually have a place to put our volume create it
        if folder is None:
            LOG.warning('Unable to create folder %s',
                        self.vfname)

        # See if we need a storage profile
        profile = self._find_storage_profile(storage_profile)
        if storage_profile and profile is None:
            raise Exception('Storage Profile %s not found.' % storage_profile)

        # Init our return.
        scvolume = None

        # Create the volume
        payload = {}
        payload['Name'] = name
        payload['Notes'] = self.notes
        payload['Size'] = '%d GB' % size
        payload['StorageCenter'] = self.ssn
        if folder:
            payload['VolumeFolder'] = self._get_id(folder)
        if profile:
            payload['StorageProfile'] = self._get_id(profile)
        r = self.client.post('StorageCenter/ScVolume',
                             payload)
        if self._check_result(r):
            scvolume = self._get_json(r)
            if scvolume:
                LOG.info('Created volume %(instanceId)s: %(name)s',
                         {'instanceId': scvolume['instanceId'],
                          'name': scvolume['name']})
            else:
                LOG.error('ScVolume returned success with empty payload. '
                          'Attempting to locate volume.')
                # In theory it is there since success was returned.
                # Try one last time to find it before returning.
                scvolume = self.find_volume(name)
        else:
            raise Exception('ScVolume creation failed.')

        return scvolume
Creates a new volume on the Storage Center.

        It will create it in a folder called self.vfname.  If self.vfname
        does not exist it will create it.  If it cannot create it
        the volume will be created in the root.

        :param name: Name of the volume to be created on the Dell SC backend.
                     This is the cinder volume ID.
        :param size: The size of the volume to be created in GB.
        :param storage_profile: Optional storage profile to set for the volume.
        :returns: Dell Volume object or None.
        
Creates a new volume on the Storage Center.
It will create it in a folder called self.vfname.  If self.vfname
does not exist it will create it.  If it cannot create it
the volume will be created in the root.
Creates a new volume on the Storage Center . It will create it in a folder called self . vfname . If self . vfname does not exist it will create it . If it cannot create it the volume will be created in the root .
def create_volume(self, name, size, storage_profile=None):
        LOG.debug('Create Volume %(name)s %(ssn)s %(folder)s %(profile)s',
                  {'name': name,
                   'ssn': self.ssn,
                   'folder': self.vfname,
                   'profile': storage_profile,
                   })
        folder = self._find_volume_folder(True)
        if folder is None:
            LOG.warning('Unable to create folder %s',
                        self.vfname)
        profile = self._find_storage_profile(storage_profile)
        if storage_profile and profile is None:
            raise Exception('Storage Profile %s not found.' % storage_profile)
        scvolume = None
        payload = {}
        payload['Name'] = name
        payload['Notes'] = self.notes
        payload['Size'] = '%d GB' % size
        payload['StorageCenter'] = self.ssn
        if folder:
            payload['VolumeFolder'] = self._get_id(folder)
        if profile:
            payload['StorageProfile'] = self._get_id(profile)
        r = self.client.post('StorageCenter/ScVolume',
                             payload)
        if self._check_result(r):
            scvolume = self._get_json(r)
            if scvolume:
                LOG.info('Created volume %(instanceId)s: %(name)s',
                         {'instanceId': scvolume['instanceId'],
                          'name': scvolume['name']})
            else:
                LOG.error('ScVolume returned success with empty payload. '
                          'Attempting to locate volume.')
                scvolume = self.find_volume(name)
        else:
            raise Exception('ScVolume creation failed.')
        return scvolume
def create_volume ( self , name , size , storage_profile = None ) : LOG . debug ( 'Create Volume %(name)s %(ssn)s %(folder)s %(profile)s' , { 'name' : name , 'ssn' : self . ssn , 'folder' : self . vfname , 'profile' : storage_profile , } ) folder = self . _find_volume_folder ( True ) if folder is None : LOG . warning ( 'Unable to create folder %s' , self . vfname ) profile = self . _find_storage_profile ( storage_profile ) if storage_profile and profile is None : raise Exception ( 'Storage Profile %s not found.' % storage_profile ) scvolume = None payload = { } payload [ 'Name' ] = name payload [ 'Notes' ] = self . notes payload [ 'Size' ] = '%d GB' % size payload [ 'StorageCenter' ] = self . ssn if folder : payload [ 'VolumeFolder' ] = self . _get_id ( folder ) if profile : payload [ 'StorageProfile' ] = self . _get_id ( profile ) r = self . client . post ( 'StorageCenter/ScVolume' , payload ) if self . _check_result ( r ) : scvolume = self . _get_json ( r ) if scvolume : LOG . info ( 'Created volume %(instanceId)s: %(name)s' , { 'instanceId' : scvolume [ 'instanceId' ] , 'name' : scvolume [ 'name' ] } ) else : LOG . error ( 'ScVolume returned success with empty payload. ' 'Attempting to locate volume.' ) scvolume = self . find_volume ( name ) else : raise Exception ( 'ScVolume creation failed.' ) return scvolume
Creates a new volume on the Storage Center.
Creates a new volume on the Storage Center .
"""Creates a new volume on the Storage Center.

        It will create it in a folder called self.vfname.  If self.vfname
        does not exist it will create it.  If it cannot create it
        the volume will be created in the root.

        :param name: Name of the volume to be created on the Dell SC backend.
                     This is the cinder volume ID.
        :param size: The size of the volume to be created in GB.
        :param storage_profile: Optional storage profile to set for the volume.
        :returns: Dell Volume object or None.
        """ # Find our folder # If we actually have a place to put our volume create it # See if we need a storage profile # Init our return. # Create the volume # In theory it is there since success was returned. # Try one last time to find it before returning.
Dell Volume object or None.
Dell Volume object or None .
self
name
Name of the volume to be created on the Dell SC backend.
This is the cinder volume ID.
Name of the volume to be created on the Dell SC backend . This is the cinder volume ID .
size
The size of the volume to be created in GB.
The size of the volume to be created in GB .
storage_profile
Optional storage profile to set for the volume.
Optional storage profile to set for the volume .