Beispiel #1
0
 def undo(self):
     assert len(self.components) == 1
     name = getDextDevName(self.dext_ssvrid, self.lvolid)
     path = getDmDevPath(name)
     if os.path.exists(path):
         dmsetup_remove(name)
     self.path = None
Beispiel #2
0
 def do(self):
     assert len(self.components) == 1
     c = self.components[0]
     assert c.iscsi_ref != None
     name = getDextDevName(self.dext_ssvrid, self.lvolid)
     path = getDmDevPath(name)
     if not os.path.exists(path):
         command = "echo 0 %s linear %s %s | dmsetup create %s" % (
             vbtos(self.capacity),
             c.path,
             vbtos(self.dext_offset),
             name,
         )
         execute_retry_not_path_exist(command, path, DMSETUP_RETRY_TIMES)
     self.path = path
     os.close(c.iscsi_ref)
     c.iscsi_ref = None