ZFSFileSystem hudson = zfs.open(target, ZFSFileSystem.class); hudson.setMountPoint(tmpDir); hudson.setProperty("hudson:managed-by","hudson"); // mark this file system as "managed by Hudson"
/** * Open a ZFS Data Set of a given name. * * @param dataSetName * name of the dataset to open. * @return opened dataset, or null if no such dataset exists. */ public ZFSObject open(final String dataSetName) { final ZFSObject dataSet = open(dataSetName, zfs_type_t.DATASET); return dataSet; }
/** * Open a ZFS Data Set of a given name. * * @param dataSetName * name of the dataset to open. * @return opened dataset, or null if no such dataset exists. */ public ZFSObject open(final String dataSetName) { final ZFSObject dataSet = open(dataSetName, zfs_type_t.DATASET); return dataSet; }
@Override public NativeZfsFileSystem openZfs(String target) throws NativeAccessException { ZFSFileSystem fs = zfs.open(target, ZFSFileSystem.class); return new ZfsFileSystemImpl(fs); }
/** * Opens a ZFS dataset of the given name and type. */ public <T extends ZFSObject> T open(String dataSetName, Class<T> type) { return type.cast(open(dataSetName,ZFSType.fromType(type).code)); }
/** * Opens a ZFS dataset of the given name and type. */ public <T extends ZFSObject> T open(String dataSetName, Class<T> type) { return type.cast(open(dataSetName,ZFSType.fromType(type).code)); }
/** * Opens a nested file system. */ public ZFSFileSystem openFileSystem(String name) { return library.open(getName()+'/'+name,ZFSFileSystem.class); }
/** * Opens a nested file system. */ public ZFSFileSystem openFileSystem(String name) { return library.open(getName()+'/'+name,ZFSFileSystem.class); }
/** * Renames this data set to another name. * * @return * {@link ZFSObject} representing the new renamed dataset. */ public ZFSObject rename(String fullName, boolean recursive) { if (LIBZFS.zfs_rename(handle, fullName, recursive) != 0) throw new ZFSException(library); return library.open(fullName); }
/** * Renames this data set to another name. * * @return * {@link ZFSObject} representing the new renamed dataset. */ public ZFSObject rename(String fullName, boolean recursive) { if (LIBZFS.zfs_rename(handle, fullName, recursive) != 0) throw new ZFSException(library); return library.open(fullName); }
final ZFSObject dataSet = open(dataSetName); return dataSet;
final ZFSObject dataSet = open(dataSetName); return dataSet;
/** * Creates a clone from this snapshot. * * This method fails if this {@link ZFSObject} is not a snapshot. */ public ZFSFileSystem clone(String fullDestinationName) { if (LIBZFS.zfs_clone(handle, fullDestinationName, null) != 0) throw new ZFSException(library); ZFSFileSystem target = (ZFSFileSystem) library.open(fullDestinationName); // this behavior mimics "zfs clone" target.mount(); target.share(); return target; }
public ZFSObject rollback(boolean recursive) { String filesystem = name.substring(0, getName().indexOf("@")); ZFSObject fs = library.open(filesystem); if (recursive) { /* first pass - check for clones */ List<ZFSObject> list = fs.getChildren(); for (ZFSObject child : list) { if (!child.getName().startsWith(filesystem + "@")) { return child; } } /* second pass - find snapshot index, destroy later snapshots */ boolean found = false; for (ZFSObject snap : fs.snapshots()) { String name = snap.getName(); if (name.equals(getName())) { found = true; continue; } if (found) { snap.destory(); } } } if (LIBZFS.zfs_rollback(fs.handle, handle, recursive) != 0) throw new ZFSException(library); return library.open(filesystem); }
public ZFSObject rollback(boolean recursive) { String filesystem = name.substring(0, getName().indexOf("@")); ZFSObject fs = library.open(filesystem); if (recursive) { /* first pass - check for clones */ List<ZFSObject> list = fs.getChildren(); for (ZFSObject child : list) { if (!child.getName().startsWith(filesystem + "@")) { return child; } } /* second pass - find snapshot index, destroy later snapshots */ boolean found = false; for (ZFSObject snap : fs.snapshots()) { String name = snap.getName(); if (name.equals(getName())) { found = true; continue; } if (found) { snap.destory(); } } } if (LIBZFS.zfs_rollback(fs.handle, handle, recursive) != 0) throw new ZFSException(library); return library.open(filesystem); }
/** * Creates a clone from this snapshot. * * This method fails if this {@link ZFSObject} is not a snapshot. */ public ZFSFileSystem clone(String fullDestinationName) { if (LIBZFS.zfs_clone(handle, fullDestinationName, null) != 0) throw new ZFSException(library); ZFSFileSystem target = (ZFSFileSystem) library.open(fullDestinationName); // this behavior mimics "zfs clone" target.mount(); target.share(); return target; }
/** * Take a snapshot of this ZFS dataset and recursively for all child * datasets. * * @param snapshotName * the name of the Snapshot to create, i.e. 'monday', * 'before-test'. * @param recursive * should snapshot recursively create snapshot for all descendant * datasets. Snapshots are taken atomically, so that all * recursive snapshots correspond to the same moment in time. * @return the created snapshot of this dataset. */ public ZFSSnapshot createSnapshot(final String snapshotName, final boolean recursive) { String fullName = name + '@' + snapshotName; /* * nv96 prototype: if(LIBZFS.zfs_snapshot(library.getHandle(), * fullName,recursive, null)!=0) pre-nv96 prototype: * if(LIBZFS.zfs_snapshot(library.getHandle(), fullName,recursive)!=0) */ if (LIBZFS.zfs_snapshot(library.getHandle(), fullName, recursive, null) != 0) { throw new ZFSException(library); } final ZFSSnapshot dataSet = (ZFSSnapshot) library.open(fullName, zfs_type_t.SNAPSHOT); return dataSet; }
ZFSFileSystem hudson = zfs.open(target, ZFSFileSystem.class); hudson.setMountPoint(tmpDir); hudson.setProperty("hudson:managed-by","hudson"); // mark this file system as "managed by Hudson"
ZFSFileSystem hudson = zfs.open(target, ZFSFileSystem.class); hudson.setMountPoint(tmpDir); hudson.setProperty("hudson:managed-by","hudson"); // mark this file system as "managed by Hudson"
final ZFSSnapshot dataSet = (ZFSSnapshot) library.open(fullName, zfs_type_t.SNAPSHOT); return dataSet;