Exemplo n.º 1
0
def create(l, regnode, add_component, components):
    assert(len(components) == 1)
    origin = SnapshotOriginNode(l)
    c = components[0]
    # create a symlink so that SNAPSHOT module can find our underlying
    # device later.
    s = symlinknode.SymLinkNode(getSnapshotOriginOriginPath(origin.lvolid))
    regnode(s)
    add_component(s, c)
    return origin
Exemplo n.º 2
0
 def do(self):
     assert(len(self.components) > 0)
     name = getSnapshotDevName(self.lvolid)
     path = getDmDevPath(name)
     if not os.path.exists(path):
         origin_path = getSnapshotOriginOriginPath( \
             self.snapshot_origin_lvolid)
         origin_size = blockdev_getsize(origin_path)
         c = self.components[0]
         command = \
             "echo 0 %s snapshot %s %s P %u | dmsetup create --readonly %s" \
             % (origin_size, origin_path, c.path, SNAPSHOT_CHUNK_SIZE, name)
         execute_retry_not_path_exist(command, path, DMSETUP_RETRY_TIMES)
     self.path = path