Merge pull request #67 from ceph/ci-go-fmt

Ci go fmt
This commit is contained in:
Noah Watkins 2018-09-17 16:06:29 -07:00 committed by GitHub
commit c521b5aa72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 13 deletions

View File

@ -9,6 +9,7 @@ export CEPH_CONF=/tmp/ceph/ceph.conf
export PATH=/usr/lib/go-1.10/bin:$PATH
go get -t -v ./...
diff -u <(echo -n) <(gofmt -d -s .)
#go vet ./...
#go list ./...
go test -v $(go list ./... | grep -v cephfs)

View File

@ -563,30 +563,30 @@ func (image *Image) ListLockers() (tag string, lockers []Locker, err error) {
nil, (*C.size_t)(&c_clients_len),
nil, (*C.size_t)(&c_cookies_len),
nil, (*C.size_t)(&c_addrs_len))
// no locker held on rbd image when either c_clients_len,
// c_cookies_len or c_addrs_len is *0*, so just quickly returned
if int(c_clients_len) == 0 || int(c_cookies_len) == 0 ||
int(c_addrs_len) ==0 {
// no locker held on rbd image when either c_clients_len,
// c_cookies_len or c_addrs_len is *0*, so just quickly returned
if int(c_clients_len) == 0 || int(c_cookies_len) == 0 ||
int(c_addrs_len) == 0 {
lockers = make([]Locker, 0)
return "", lockers, nil
return "", lockers, nil
}
tag_buf := make([]byte, c_tag_len)
clients_buf := make([]byte, c_clients_len)
cookies_buf := make([]byte, c_cookies_len)
addrs_buf := make([]byte, c_addrs_len)
c_locker_cnt = C.rbd_list_lockers(image.image, &c_exclusive,
(*C.char)(unsafe.Pointer(&tag_buf[0])), (*C.size_t)(&c_tag_len),
(*C.char)(unsafe.Pointer(&clients_buf[0])), (*C.size_t)(&c_clients_len),
(*C.char)(unsafe.Pointer(&cookies_buf[0])), (*C.size_t)(&c_cookies_len),
(*C.char)(unsafe.Pointer(&addrs_buf[0])), (*C.size_t)(&c_addrs_len))
// rbd_list_lockers returns negative value for errors
// rbd_list_lockers returns negative value for errors
// and *0* means no locker held on rbd image.
// but *0* is unexpected here because first rbd_list_lockers already
// dealt with no locker case
// but *0* is unexpected here because first rbd_list_lockers already
// dealt with no locker case
if int(c_locker_cnt) <= 0 {
return "", nil, RBDError(int(c_locker_cnt))
}

View File

@ -48,14 +48,14 @@ func TestCreateImage(t *testing.T) {
name = GetUUID()
image, err = rbd.Create(ioctx, name, 1<<22, 22,
RbdFeatureLayering|RbdFeatureStripingV2)
RbdFeatureLayering|RbdFeatureStripingV2)
assert.NoError(t, err)
err = image.Remove()
assert.NoError(t, err)
name = GetUUID()
image, err = rbd.Create(ioctx, name, 1<<22, 22,
RbdFeatureLayering|RbdFeatureStripingV2, 4096, 2)
RbdFeatureLayering|RbdFeatureStripingV2, 4096, 2)
assert.NoError(t, err)
err = image.Remove()
assert.NoError(t, err)