[ARVADOS] updated: 1.3.0-311-gd38793d3a
Git user
git at public.curoverse.com
Mon Feb 11 09:13:18 EST 2019
Summary of changes:
build/run-tests.sh | 2 ++
lib/cloud/{ => azure}/azure.go | 23 ++++++++++++-----------
lib/cloud/{ => azure}/azure_test.go | 17 +++++++++--------
lib/dispatchcloud/driver.go | 3 ++-
4 files changed, 25 insertions(+), 20 deletions(-)
rename lib/cloud/{ => azure}/azure.go (97%)
rename lib/cloud/{ => azure}/azure_test.go (95%)
via d38793d3af2b0563196607a4e52bf07737ec55df (commit)
from cdd31206b8c228ffcdc6f0ab7f0017d537836678 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit d38793d3af2b0563196607a4e52bf07737ec55df
Author: Eric Biagiotti <ebiagiotti at veritasgenetcs.com>
Date: Mon Feb 11 09:13:11 2019 -0500
14745: Makes the azure driver its own package
Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <eric.biagiotti at gmail.com>
diff --git a/build/run-tests.sh b/build/run-tests.sh
index 96e6aea72..9919c3e17 100755
--- a/build/run-tests.sh
+++ b/build/run-tests.sh
@@ -77,6 +77,7 @@ lib/cmd
lib/controller
lib/crunchstat
lib/cloud
+lib/cloud/azure
lib/dispatchcloud
lib/dispatchcloud/container
lib/dispatchcloud/scheduler
@@ -932,6 +933,7 @@ gostuff=(
lib/controller
lib/crunchstat
lib/cloud
+ lib/cloud/azure
lib/dispatchcloud
lib/dispatchcloud/container
lib/dispatchcloud/scheduler
diff --git a/lib/cloud/azure.go b/lib/cloud/azure/azure.go
similarity index 97%
rename from lib/cloud/azure.go
rename to lib/cloud/azure/azure.go
index a194b3318..5bc7ccfd4 100644
--- a/lib/cloud/azure.go
+++ b/lib/cloud/azure/azure.go
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-package cloud
+package azure
import (
"context"
@@ -15,6 +15,7 @@ import (
"sync"
"time"
+ "git.curoverse.com/arvados.git/lib/cloud"
"git.curoverse.com/arvados.git/sdk/go/arvados"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-06-01/network"
@@ -202,7 +203,7 @@ type AzureInstanceSet struct {
logger logrus.FieldLogger
}
-func NewAzureInstanceSet(config map[string]interface{}, dispatcherID InstanceSetID, logger logrus.FieldLogger) (prv InstanceSet, err error) {
+func NewAzureInstanceSet(config map[string]interface{}, dispatcherID cloud.InstanceSetID, logger logrus.FieldLogger) (prv cloud.InstanceSet, err error) {
azcfg := AzureInstanceSetConfig{}
if err = mapstructure.Decode(config, &azcfg); err != nil {
return nil, err
@@ -304,9 +305,9 @@ func (az *AzureInstanceSet) setup(azcfg AzureInstanceSetConfig, dispatcherID str
func (az *AzureInstanceSet) Create(
instanceType arvados.InstanceType,
- imageId ImageID,
- newTags InstanceTags,
- publicKey ssh.PublicKey) (Instance, error) {
+ imageId cloud.ImageID,
+ newTags cloud.InstanceTags,
+ publicKey ssh.PublicKey) (cloud.Instance, error) {
az.stopWg.Add(1)
defer az.stopWg.Done()
@@ -430,7 +431,7 @@ echo '%s-%s' > /home/crunch/node-token`, name, newTags["node-token"])))
}, nil
}
-func (az *AzureInstanceSet) Instances(InstanceTags) ([]Instance, error) {
+func (az *AzureInstanceSet) Instances(cloud.InstanceTags) ([]cloud.Instance, error) {
az.stopWg.Add(1)
defer az.stopWg.Done()
@@ -444,7 +445,7 @@ func (az *AzureInstanceSet) Instances(InstanceTags) ([]Instance, error) {
return nil, WrapAzureError(err)
}
- instances := make([]Instance, 0)
+ instances := make([]cloud.Instance, 0)
for ; result.NotDone(); err = result.Next() {
if err != nil {
@@ -564,8 +565,8 @@ type AzureInstance struct {
vm compute.VirtualMachine
}
-func (ai *AzureInstance) ID() InstanceID {
- return InstanceID(*ai.vm.ID)
+func (ai *AzureInstance) ID() cloud.InstanceID {
+ return cloud.InstanceID(*ai.vm.ID)
}
func (ai *AzureInstance) String() string {
@@ -576,7 +577,7 @@ func (ai *AzureInstance) ProviderType() string {
return string(ai.vm.VirtualMachineProperties.HardwareProfile.VMSize)
}
-func (ai *AzureInstance) SetTags(newTags InstanceTags) error {
+func (ai *AzureInstance) SetTags(newTags cloud.InstanceTags) error {
ai.provider.stopWg.Add(1)
defer ai.provider.stopWg.Done()
@@ -605,7 +606,7 @@ func (ai *AzureInstance) SetTags(newTags InstanceTags) error {
return nil
}
-func (ai *AzureInstance) Tags() InstanceTags {
+func (ai *AzureInstance) Tags() cloud.InstanceTags {
tags := make(map[string]string)
for k, v := range ai.vm.Tags {
diff --git a/lib/cloud/azure_test.go b/lib/cloud/azure/azure_test.go
similarity index 95%
rename from lib/cloud/azure_test.go
rename to lib/cloud/azure/azure_test.go
index f74688bb1..b496d3b3f 100644
--- a/lib/cloud/azure_test.go
+++ b/lib/cloud/azure/azure_test.go
@@ -24,7 +24,7 @@
// delete_dangling_resources_after: 20
// authorized_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLQS1ExT2+WjA0d/hntEAyAtgeN1W2ik2QX8c2zO6HjlPHWXL92r07W0WMuDib40Pcevpi1BXeBWXA9ZB5KKMJB+ukaAu22KklnQuUmNvk6ZXnPKSkGxuCYvPQb08WhHf3p1VxiKfP3iauedBDM4x9/bkJohlBBQiFXzNUcQ+a6rKiMzmJN2gbL8ncyUzc+XQ5q4JndTwTGtOlzDiGOc9O4z5Dd76wtAVJneOuuNpwfFRVHThpJM6VThpCZOnl8APaceWXKeuwOuCae3COZMz++xQfxOfZ9Z8aIwo+TlQhsRaNfZ4Vjrop6ej8dtfZtgUFKfbXEOYaHrGrWGotFDTD example at example"
-package cloud
+package azure
import (
"context"
@@ -37,6 +37,7 @@ import (
"os"
"time"
+ "git.curoverse.com/arvados.git/lib/cloud"
"git.curoverse.com/arvados.git/sdk/go/arvados"
"git.curoverse.com/arvados.git/sdk/go/config"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"
@@ -97,7 +98,7 @@ func (*InterfacesClientStub) ListComplete(ctx context.Context, resourceGroupName
var live = flag.String("live-azure-cfg", "", "Test with real azure API, provide config file")
-func GetInstanceSet() (InstanceSet, ImageID, arvados.Cluster, error) {
+func GetInstanceSet() (cloud.InstanceSet, cloud.ImageID, arvados.Cluster, error) {
cluster := arvados.Cluster{
InstanceTypes: arvados.InstanceTypeMap(map[string]arvados.InstanceType{
"tiny": arvados.InstanceType{
@@ -114,10 +115,10 @@ func GetInstanceSet() (InstanceSet, ImageID, arvados.Cluster, error) {
cfg := make(map[string]interface{})
err := config.LoadFile(&cfg, *live)
if err != nil {
- return nil, ImageID(""), cluster, err
+ return nil, cloud.ImageID(""), cluster, err
}
ap, err := NewAzureInstanceSet(cfg, "test123", logrus.StandardLogger())
- return ap, ImageID(cfg["image"].(string)), cluster, err
+ return ap, cloud.ImageID(cfg["image"].(string)), cluster, err
} else {
ap := AzureInstanceSet{
azconfig: AzureInstanceSetConfig{
@@ -132,7 +133,7 @@ func GetInstanceSet() (InstanceSet, ImageID, arvados.Cluster, error) {
ap.ctx, ap.stopFunc = context.WithCancel(context.Background())
ap.vmClient = &VirtualMachinesClientStub{}
ap.netClient = &InterfacesClientStub{}
- return &ap, ImageID("blob"), cluster, nil
+ return &ap, cloud.ImageID("blob"), cluster, nil
}
}
@@ -239,7 +240,7 @@ func (*AzureInstanceSetSuite) TestWrapError(c *check.C) {
},
}
wrapped := WrapAzureError(retryError)
- _, ok := wrapped.(RateLimitError)
+ _, ok := wrapped.(cloud.RateLimitError)
c.Check(ok, check.Equals, true)
quotaError := autorest.DetailedError{
@@ -255,7 +256,7 @@ func (*AzureInstanceSetSuite) TestWrapError(c *check.C) {
},
}
wrapped = WrapAzureError(quotaError)
- _, ok = wrapped.(QuotaError)
+ _, ok = wrapped.(cloud.QuotaError)
c.Check(ok, check.Equals, true)
}
@@ -307,7 +308,7 @@ func (*AzureInstanceSetSuite) TestSSH(c *check.C) {
}
}
-func SetupSSHClient(c *check.C, inst Instance) (*ssh.Client, error) {
+func SetupSSHClient(c *check.C, inst cloud.Instance) (*ssh.Client, error) {
addr := inst.Address() + ":2222"
if addr == "" {
return nil, errors.New("instance has no address")
diff --git a/lib/dispatchcloud/driver.go b/lib/dispatchcloud/driver.go
index a6e62e05b..83dca83cd 100644
--- a/lib/dispatchcloud/driver.go
+++ b/lib/dispatchcloud/driver.go
@@ -8,12 +8,13 @@ import (
"fmt"
"git.curoverse.com/arvados.git/lib/cloud"
+ "git.curoverse.com/arvados.git/lib/cloud/azure"
"git.curoverse.com/arvados.git/sdk/go/arvados"
"github.com/sirupsen/logrus"
)
var drivers = map[string]cloud.Driver{
- "azure": cloud.DriverFunc(cloud.NewAzureInstanceSet),
+ "azure": cloud.DriverFunc(azure.NewAzureInstanceSet),
}
func newInstanceSet(cluster *arvados.Cluster, setID cloud.InstanceSetID, logger logrus.FieldLogger) (cloud.InstanceSet, error) {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list