Skip to content

GoUnity is a Go project that provides a client for managing Dell EMC Unity storage.

License

Notifications You must be signed in to change notification settings

Murray-LIANG/gounity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoUnity

GitHub release Travis branch Coveralls github branch Go Report Card license

GoUnity is a Go project that provides a client for managing Dell EMC Unity storage.

Current State

Under development. Please contribute and follow the guideline.

License

Apache License version 2

Support Operations

  • Query instances of:
    • Storage Pool
    • LUN
    • Snapshot
    • Host
    • Filesystem
    • Nas Server
    • NFS Share
  • Create/Delete LUNs
  • Create/Delete Filesystems
  • Create/Delete NFS Shares
  • Attach/Detach Hosts to LUNs
  • Create/Attach/Detach/Copy Snapshots

Installation

go get github.com/murray-liang/gounity

Tutorial

Create a connection to Unity Systems

unity, err := gounity.NewUnity(
    "UnityMgmtIP", "username", "password", true,
)
if err != nil {
    panic(err)
}

Query storage pools

// List all the pools
pools, err := unity.GetPools()

// Get the pool by ID
pool, err := unity.GetPoolById("Pool_1")

Create LUNs

// Create a 3GB LUN named `lunName` on `pool`
lun, err := pool.CreateLun("lunName", 3)

Query Hosts

host, err := unity.GetHostById("Host_1")

Attach LUNs to Hosts

hluNum, err := host.Attach(lun)

More examples

*_test.go files of this package contains lots of detailed examples.

Optional Parameters

Optional parameters are supported for forward compatibility.

fs, err := pool.CreateFilesystem(
    nas, "fs-name", 3,
    // `SupportedProtocol` is optional.
    gounity.SupportedProtocolsOpt(gounity.FSSupportedProtocolNFS),
)

Triage

HTTP requests and responses are traced with logs by enabling GOUNITY_TRACEHTTP.

  1. Set environment variable GOUNITY_TRACEHTTP.
    $ export GOUNITY_TRACEHTTP=true
  2. In your codes, enable Debug log level of logrus.
    logrus.SetLevel(logrus.DebugLevel)
    // Your codes continue here ......

Issues

If you have any questions or find any issues, please post Github Issues.

Contribute Guideline

You are one of the collaborators

  1. Create a branch from the latest develop branch: git checkout -b <branch_name>.
  2. Push code changes to your branch. Please make sure your changes be covered by unittest.
  3. Push your branch to the remote.
  4. Publish a pull request from your branch to develop branch.
  5. Merge the pull request after passing the review. Recommend using Squash and Merge and deleting your branch after merging.

You aren't

  1. Fork this repo as your own one.
  2. Push code changes to your repo. Please make sure your changes be covered by unittest.
  3. Publish a pull request from your repo to develop branch of this repo.
  4. Wait for merging the pull request.

Develop Tips

Code Generation

*_gen.go source files are generated by go generate. The templates and source files can be found under cmd/modelgen. You are not supposed to edit the *_gen.go files but the templates.

Once you modify the templates, run go generate, then all *_gen.go files update.

End to End Tests

Test cases in integration_test.go require a real Unity. go test won't run the cases there.

The below commands would help out.

# The integration tests would fail depending on the resources on Unity.
# Modify the cases accordingly before running.

# Command to test `CreateLun` on a real Unity.
$ go test -tags=integration -v -run TestE2ECreateLun \
    -args -mgmtIp='10.245.101.39' -username=admin -password=*****

# Command to run all integration tests on a real Unity.
$ go test -tags=integration -v \
    -args -mgmtIp='10.245.101.39' -username=admin -password=*****

About

GoUnity is a Go project that provides a client for managing Dell EMC Unity storage.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages