Beispiel #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})
Beispiel #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})
Beispiel #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})
Beispiel #4
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})
Beispiel #5
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})