예제 #1
0
    def getVolumeList(self):
        """Return list of all available volumes"""

        # self.getLogger().debug('Retrieving volume list')

        try:
            volumeList = SanApi().getVolumeList()

            response = volumeList.getCleanDict()
        except Exception as ex:
            self.getLogger().error('%s' % ex)
            self.handleException(ex)
            response = self.errorResponse(str(ex))

            return self.formatResponse(response)
예제 #2
0
    def addVolume(self, storageAdapter, size, nameFormat='*', shared=False):
        """ Add volume to the SAN system"""

        # self.getLogger().debug('Adding volume')

        try:
            volume = SanApi().addVolume(storageAdapter, size, nameFormat,
                                        'True' == shared)

            response = volume.getCleanDict()
        except Exception as ex:
            self.getLogger().error('%s' % ex)
            self.handleException(ex)
            response = self.errorResponse(str(ex))

        return self.formatResponse(response)
예제 #3
0
    def deleteVolume(self, volume):
        """Delete Volume from SAN system"""

        response = None

        # self.getLogger().debug('Deleting volume')

        try:
            SanApi().deleteVolume(volume)
        except Exception as ex:
            self.getLogger().error('%s' % ex)
            self.handleException(ex)
            response = self.errorResponse(str(ex))

        return self.formatResponse(response)
예제 #4
0
    def updateVolume(self, volume, shared):
        """Update volume in SAN system"""

        response = None

        # self.getLogger().debug('Updating volume')

        try:
            SanApi().updateVolume(volume, shared == 'True')
        except Exception as ex:
            self.getLogger().error('%s' % ex)
            self.handleException(ex)
            response = self.errorResponse(str(ex))

        return self.formatResponse(response)