Skip to content

golang mtx wrapper library for scsi media changers

License

Notifications You must be signed in to change notification settings

benmcclelland/mtx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mtx

godoc build

golang mtx wrapper library for scsi media changers

Tested with Centos6/RHEL6 version of mtx (mtx-1.3.12)

Example of loading and unloading a volume:

// Initialize new library session using "/dev/sg0"
// as the media changer device
lib := mtx.NewLibrary("/dev/sg0")

// Calling status will parse the mtx output and
// fill out the MediaInfo struct
mi, err := lib.Status()
if err != nil {
	return err
}

// FindStorageVolume will look for a volume with
// a matching barcode in the storage slots
vol, err := mtx.FindStorageVolume("MyBarcode", mi)
if err != nil {
	return err
}

// Load the volume that we found into the first
// drive element, drive elements start with 0
err = lib.Load(vol, mi.Drives["0"])
if err != nil {
	return err
}

// Unload the volume from the drive when finished
err = lib.Unload(vol)
if err != nil {
	return err
}

About

golang mtx wrapper library for scsi media changers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published