Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/gophercloud/gophercloud i…
Browse files Browse the repository at this point in the history
…nto zun-exp

Signed-off-by: Kevin Zhao <kevin.zhao@arm.com>
  • Loading branch information
Kevin Zhao committed Apr 13, 2018
2 parents 0028ca2 + 3c0e6bd commit c9afdc1
Show file tree
Hide file tree
Showing 321 changed files with 22,278 additions and 1,915 deletions.
20 changes: 11 additions & 9 deletions .github/CONTRIBUTING.md
Expand Up @@ -31,13 +31,15 @@ enthusiasm as any other contribution!

### 3. Working on a new feature

If you've found something we've left out, definitely feel free to start work on
introducing that feature. It's always useful to open an issue or submit a pull
request early on to indicate your intent to a core contributor - this enables
quick/early feedback and can help steer you in the right direction by avoiding
known issues. It might also help you avoid losing time implementing something
that might not ever work. One tip is to prefix your Pull Request issue title
with [wip] - then people know it's a work in progress.
If you've found something we've left out, we'd love for you to add it! Please
first open an issue to indicate your interest to a core contributor - this
enables quick/early feedback and can help steer you in the right direction by
avoiding known issues. It might also help you avoid losing time implementing
something that might not ever work or is outside the scope of the project.

While you're implementing the feature, one tip is to prefix your Pull Request
title with `[wip]` - then people know it's a work in progress. Once the PR is
ready for review, you can remove the `[wip]` tag and request a review.

We ask that you do not submit a feature that you have not spent time researching
and testing first-hand in an actual OpenStack environment. While we appreciate
Expand Down Expand Up @@ -99,7 +101,7 @@ need to checkout a new feature branch:
git commit
```

7. Submit your branch as a [Pull Request](https://help.github.com/articles/creating-a-pull-request/). When submitting a Pull Request, please follow our [Style Guide](https://github.com/gophercloud/gophercloud/blob/master/STYLEGUIDE.md).
7. Submit your branch as a [Pull Request](https://help.github.com/articles/creating-a-pull-request/). When submitting a Pull Request, please follow our [Style Guide](https://github.com/gophercloud/gophercloud/blob/master/docs/STYLEGUIDE.md).

> Further information about using Git can be found [here](https://git-scm.com/book/en/v2).
Expand Down Expand Up @@ -245,4 +247,4 @@ To run tests for a particular sub-package:

## Style guide

See [here](/STYLEGUIDE.md)
See [here](/docs/STYLEGUIDE.md)
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -7,8 +7,8 @@ install:
- go get github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/goimports
go:
- 1.8
- tip
- "1.10"
- "tip"
env:
global:
- secure: "xSQsAG5wlL9emjbCdxzz/hYQsSpJ/bABO1kkbwMSISVcJ3Nk0u4ywF+LS4bgeOnwPfmFvNTOqVDu3RwEvMeWXSI76t1piCPcObutb2faKLVD/hLoAS76gYX+Z8yGWGHrSB7Do5vTPj1ERe2UljdrnsSeOXzoDwFxYRaZLX4bBOB4AyoGvRniil5QXPATiA1tsWX1VMicj8a4F8X+xeESzjt1Q5Iy31e7vkptu71bhvXCaoo5QhYwT+pLR9dN0S1b7Ro0KVvkRefmr1lUOSYd2e74h6Lc34tC1h3uYZCS4h47t7v5cOXvMNxinEj2C51RvbjvZI1RLVdkuAEJD1Iz4+Ote46nXbZ//6XRZMZz/YxQ13l7ux1PFjgEB6HAapmF5Xd8PRsgeTU9LRJxpiTJ3P5QJ3leS1va8qnziM5kYipj/Rn+V8g2ad/rgkRox9LSiR9VYZD2Pe45YCb1mTKSl2aIJnV7nkOqsShY5LNB4JZSg7xIffA+9YVDktw8dJlATjZqt7WvJJ49g6A61mIUV4C15q2JPGKTkZzDiG81NtmS7hFa7k0yaE2ELgYocbcuyUcAahhxntYTC0i23nJmEHVNiZmBO3u7EgpWe4KGVfumU+lt12tIn5b3dZRBBUk3QakKKozSK1QPHGpk/AZGrhu7H6l8to6IICKWtDcyMPQ="
Expand Down
9 changes: 9 additions & 0 deletions .zuul.yaml
Expand Up @@ -7,6 +7,15 @@
recheck-mitaka:
jobs:
- gophercloud-acceptance-test-mitaka
recheck-newton:
jobs:
- gophercloud-acceptance-test-newton
recheck-ocata:
jobs:
- gophercloud-acceptance-test-ocata
recheck-pike:
jobs:
- gophercloud-acceptance-test-pike
recheck-queens:
jobs:
- gophercloud-acceptance-test-queens
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -127,7 +127,7 @@ new resource in the `server` variable (a

## Advanced Usage

Have a look at the [FAQ](./FAQ.md) for some tips on customizing the way Gophercloud works.
Have a look at the [FAQ](./docs/FAQ.md) for some tips on customizing the way Gophercloud works.

## Backwards-Compatibility Guarantees

Expand All @@ -148,12 +148,12 @@ We'd like to extend special thanks and appreciation to the following:

### OpenLab

<a href="http://openlabtesting.org/"><img src="assets/openlab.png" width="600px"></a>
<a href="http://openlabtesting.org/"><img src="./docs/assets/openlab.png" width="600px"></a>

OpenLab is providing a full CI environment to test each PR and merge for a variety of OpenStack releases.

### VEXXHOST

<a href="https://vexxhost.com/"><img src="assets/vexxhost.png" width="600px"></a>
<a href="https://vexxhost.com/"><img src="./docs/assets/vexxhost.png" width="600px"></a>

VEXXHOST is providing their services to assist with the development and testing of Gophercloud.
110 changes: 110 additions & 0 deletions acceptance/clients/clients.go
Expand Up @@ -5,6 +5,7 @@ package clients

import (
"fmt"
"net/http"
"os"
"strings"

Expand Down Expand Up @@ -123,6 +124,8 @@ func NewBlockStorageV1Client() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return openstack.NewBlockStorageV1(client, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
})
Expand All @@ -142,6 +145,8 @@ func NewBlockStorageV2Client() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return openstack.NewBlockStorageV2(client, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
})
Expand All @@ -161,6 +166,8 @@ func NewBlockStorageV3Client() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return openstack.NewBlockStorageV3(client, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
})
Expand All @@ -178,6 +185,8 @@ func NewBlockStorageV2NoAuthClient() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return noauth.NewBlockStorageNoAuth(client, noauth.EndpointOpts{
CinderEndpoint: os.Getenv("CINDER_ENDPOINT"),
})
Expand All @@ -195,6 +204,8 @@ func NewBlockStorageV3NoAuthClient() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return noauth.NewBlockStorageNoAuth(client, noauth.EndpointOpts{
CinderEndpoint: os.Getenv("CINDER_ENDPOINT"),
})
Expand All @@ -214,6 +225,8 @@ func NewComputeV2Client() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return openstack.NewComputeV2(client, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
})
Expand All @@ -233,6 +246,8 @@ func NewDBV1Client() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return openstack.NewDBV1(client, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
})
Expand All @@ -252,6 +267,8 @@ func NewDNSV2Client() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return openstack.NewDNSV2(client, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
})
Expand All @@ -271,6 +288,8 @@ func NewIdentityV2Client() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return openstack.NewIdentityV2(client, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
})
Expand All @@ -290,6 +309,8 @@ func NewIdentityV2AdminClient() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return openstack.NewIdentityV2(client, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
Availability: gophercloud.AvailabilityAdmin,
Expand All @@ -310,6 +331,8 @@ func NewIdentityV2UnauthenticatedClient() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return openstack.NewIdentityV2(client, gophercloud.EndpointOpts{})
}

Expand All @@ -327,6 +350,8 @@ func NewIdentityV3Client() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return openstack.NewIdentityV3(client, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
})
Expand All @@ -346,6 +371,8 @@ func NewIdentityV3UnauthenticatedClient() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return openstack.NewIdentityV3(client, gophercloud.EndpointOpts{})
}

Expand All @@ -363,6 +390,8 @@ func NewImageServiceV2Client() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return openstack.NewImageServiceV2(client, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
})
Expand All @@ -382,6 +411,8 @@ func NewNetworkV2Client() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return openstack.NewNetworkV2(client, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
})
Expand All @@ -401,6 +432,8 @@ func NewObjectStorageV1Client() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return openstack.NewObjectStorageV1(client, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
})
Expand All @@ -420,11 +453,88 @@ func NewSharedFileSystemV2Client() (*gophercloud.ServiceClient, error) {
return nil, err
}

client = configureDebug(client)

return openstack.NewSharedFileSystemV2(client, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
})
}

// NewLoadBalancerV2Client returns a *ServiceClient for making calls to the
// OpenStack Octavia v2 API. An error will be returned if authentication
// or client creation was not possible.
func NewLoadBalancerV2Client() (*gophercloud.ServiceClient, error) {
ao, err := openstack.AuthOptionsFromEnv()
if err != nil {
return nil, err
}

client, err := openstack.AuthenticatedClient(ao)
if err != nil {
return nil, err
}

client = configureDebug(client)

return openstack.NewLoadBalancerV2(client, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
})
}

// NewClusteringV1Client returns a *ServiceClient for making calls
// to the OpenStack Clustering v1 API. An error will be returned
// if authentication or client creation was not possible.
func NewClusteringV1Client() (*gophercloud.ServiceClient, error) {
ao, err := openstack.AuthOptionsFromEnv()
if err != nil {
return nil, err
}

client, err := openstack.AuthenticatedClient(ao)
if err != nil {
return nil, err
}

return openstack.NewClusteringV1(client, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
})
}

// NewMessagingV2Client returns a *ServiceClient for making calls
// to the OpenStack Messaging (Zaqar) v2 API. An error will be returned
// if authentication or client creation was not possible.
func NewMessagingV2Client(clientID string) (*gophercloud.ServiceClient, error) {
ao, err := openstack.AuthOptionsFromEnv()
if err != nil {
return nil, err
}

client, err := openstack.AuthenticatedClient(ao)
if err != nil {
return nil, err
}

client = configureDebug(client)

return openstack.NewMessagingV2(client, clientID, gophercloud.EndpointOpts{
Region: os.Getenv("OS_REGION_NAME"),
})
}

// configureDebug will configure the provider client to print the API
// requests and responses if OS_DEBUG is enabled.
func configureDebug(client *gophercloud.ProviderClient) *gophercloud.ProviderClient {
if os.Getenv("OS_DEBUG") != "" {
client.HTTPClient = http.Client{
Transport: &LogRoundTripper{
Rt: &http.Transport{},
},
}
}

return client
}

// NewContainerV1Client returns a *ServiceClient for making calls
// to the OpenStack Container V1 API. An error will be returned
// if authentication or client creation was not possible.
Expand Down
60 changes: 60 additions & 0 deletions acceptance/clients/conditions.go
@@ -0,0 +1,60 @@
package clients

import (
"os"
"testing"
)

// RequireAdmin will restrict a test to only be run by admin users.
func RequireAdmin(t *testing.T) {
if os.Getenv("OS_USERNAME") != "admin" {
t.Skip("must be admin to run this test")
}
}

// RequireDNS will restrict a test to only be run in environments
// that support DNSaaS.
func RequireDNS(t *testing.T) {
if os.Getenv("OS_DNS_ENVIRONMENT") == "" {
t.Skip("this test requires DNSaaS")
}
}

// RequireGuestAgent will restrict a test to only be run in
// environments that support the QEMU guest agent.
func RequireGuestAgent(t *testing.T) {
if os.Getenv("OS_GUEST_AGENT") == "" {
t.Skip("this test requires support for qemu guest agent and to set OS_GUEST_AGENT to 1")
}
}

// RequireIdentityV2 will restrict a test to only be run in
// environments that support the Identity V2 API.
func RequireIdentityV2(t *testing.T) {
if os.Getenv("OS_IDENTITY_API_VERSION") != "2.0" {
t.Skip("this test requires support for the identity v2 API")
}
}

// RequireLiveMigration will restrict a test to only be run in
// environments that support live migration.
func RequireLiveMigration(t *testing.T) {
if os.Getenv("OS_LIVE_MIGRATE") == "" {
t.Skip("this test requires support for live migration and to set OS_LIVE_MIGRATE to 1")
}
}

// RequireLong will ensure long-running tests can run.
func RequireLong(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
}

// RequireNovaNetwork will restrict a test to only be run in
// environments that support nova-network.
func RequireNovaNetwork(t *testing.T) {
if os.Getenv("OS_NOVANET") == "" {
t.Skip("this test requires nova-network and to set OS_NOVANET to 1")
}
}

0 comments on commit c9afdc1

Please sign in to comment.