class NixAdm::ZFS::Admin
Attributes
Public Class Methods
NixAdm::Status::new
# File src/lib/nixadm/zfs.rb, line 493 def initialize(host=nil, port=22) super() @host = Host.new(host, port) end
Public Instance Methods
Given full pathname of ZFS
object, return corresponding ZFS
object. Returns nil upon no match.
# File src/lib/nixadm/zfs.rb, line 501 def filesystem(name) pool_name = name.split('/')[0] pool = @host.pool(pool_name) return nil if pool.nil? fs_name = name.split('/')[1..-1].join('/') return pool.filesystem(fs_name) end
Given full pathname of ZFS
volumne, return corresponding Volume
object. Returns nil upon no match.
# File src/lib/nixadm/zfs.rb, line 527 def object(name) pool_name = name.split('/')[0] pool = @host.pool(pool_name) return nil if pool.nil? object_name = name.split('/')[1..-1].join('/') return pool.object(object_name) end
Replicate changes on one ZFS
filesystem on one host (src_fs) to another (dst_fs). Filesystem
must be in sync. This means they must have most recent snapshots that match. If this is not met, function will abort.
@param src_fs The source host. This is the machine that has the filesystem we want to replicate. Format can be in the form user@host or just host. Whatever is acceptable to ssh is acceptable here.
@param dest_fs The destination host. This is the machine what will receive the delta from the source host, whose filesystem will be updated. Can be in the form user@host or just host. Whatever is acceptable to ssh is acceptable here.
# File src/lib/nixadm/zfs.rb, line 551 def replicate(source_fs, dest_fs) snapshot = source_fs.lastSnapshot() if snapshot.nil? return failure(-1, "No snapshots on filesystem #{sfs.name}") end return snapshot.send(dest_fs) end
Given full pathname of ZFS
volumne, return corresponding Volume
object. Returns nil upon no match.
# File src/lib/nixadm/zfs.rb, line 514 def volume(name) pool_name = name.split('/')[0] pool = @host.pool(pool_name) return nil if pool.nil? vol_name = name.split('/')[1..-1].join('/') return pool.volume(vol_name) end