Пример #1
0
 def delete(self, name):
     try:
         fs_utils.unpersist_swap_dev(name)
         utils._swapoff_device(name)
     except Exception as e:
         wok_log.error("Error deleting a swap device, %s", e.message)
         raise OperationFailed("GINSP00009E", {'err': e.message})
Пример #2
0
 def delete(self, name):
     try:
         fs_utils.unpersist_swap_dev(name)
         swap_details = self.lookup(name)
         if swap_details['type'] == 'file':
             SwapsModel.delete_swap_file(swap_details['filename'])
         else:
             utils._swapoff_device(name)
     except Exception as e:
         raise OperationFailed("GINSP00009E", {'err': e.message})
Пример #3
0
 def delete(self, name):
     try:
         fs_utils.unpersist_swap_dev(name)
         swap_details = self.lookup(name)
         if swap_details['type'] == 'file':
             SwapsModel.delete_swap_file(swap_details['filename'])
         else:
             utils._swapoff_device(name)
     except Exception as e:
         raise OperationFailed("GINSP00009E", {'err': e.message})
Пример #4
0
    def delete_swap_file(file_loc):
        """
        Method to delete a swap device
        :param file_loc: location of the file or device path
        :return:
        """

        try:
            utils._swapoff_device(file_loc)

            # Remove only file type swap devices from filesystem
            if not file_loc.startswith('/dev'):
                os.remove(file_loc)

        except Exception as e:
            raise OperationFailed('GINSP00006E', {'err': e.message})
Пример #5
0
    def delete_swap_file(file_loc):
        """
        Method to delete a swap device
        :param file_loc: location of the file or device path
        :return:
        """

        try:
            utils._swapoff_device(file_loc)

            # Remove only file type swap devices from filesystem
            if not file_loc.startswith('/dev'):
                os.remove(file_loc)

        except Exception as e:
            raise OperationFailed('GINSP00006E', {'err': e.message})
Пример #6
0
    def delete_swap_file(file_loc):
        """
        Method to delete a swap device
        :param file_loc: location of the file or device path
        :return:
        """

        try:
            # Remove only file type swap devices from filesystem
            if not file_loc.startswith('/dev'):
                os.remove(file_loc)

            utils._swapoff_device(file_loc)

        except Exception as e:
            wok_log.error("Error deleting a swap file, %s", e.message)
            raise OperationFailed('GINSP00006E')
Пример #7
0
 def delete(self, name):
     try:
         swap_details = self.lookup(name)
         if 'dm-' in name:
             dmdev = name.split('/')[-1]
             dmname = \
                 open('/sys/block/'+dmdev+'/dm/name').readline().rstrip()
             name = '/dev/mapper/' + dmname
         fs_utils.unpersist_swap_dev(name)
         if swap_details['type'] == 'file':
             SwapsModel.delete_swap_file(swap_details['filename'])
         else:
             utils._swapoff_device(name)
             # wait to allow swapoff action to complete
             time.sleep(1)
             utils.remove_swap_sig(name)
     except Exception as e:
         raise OperationFailed("GINSP00009E", {'err': e.message})
Пример #8
0
 def delete(self, name):
     try:
         swap_details = self.lookup(name)
         if 'dm-' in name:
             dmdev = name.split('/')[-1]
             dmname = \
                 open('/sys/block/'+dmdev+'/dm/name').readline().rstrip()
             name = '/dev/mapper/' + dmname
         fs_utils.unpersist_swap_dev(name)
         if swap_details['type'] == 'file':
             SwapsModel.delete_swap_file(swap_details['filename'])
         else:
             utils._swapoff_device(name)
             # wait to allow swapoff action to complete
             time.sleep(1)
             utils.remove_swap_sig(name)
     except Exception as e:
         raise OperationFailed("GINSP00009E", {'err': e.message})