[ARVADOS] created: 1.3.0-2860-gde4ad6593
Git user
git at public.arvados.org
Sun Aug 16 02:20:04 UTC 2020
at de4ad659335a24629934256fec6266842a47c2eb (commit)
commit de4ad659335a24629934256fec6266842a47c2eb
Author: Ward Vandewege <ward at curii.com>
Date: Sat Aug 15 22:18:59 2020 -0400
16623: bugfix: a-d-c: when compute nodes are in a different resource
group, make sure to clean up the nics for old compute nodes in
the correct resource group.
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>
diff --git a/lib/cloud/azure/azure.go b/lib/cloud/azure/azure.go
index 6de367aa2..46db6f5b1 100644
--- a/lib/cloud/azure/azure.go
+++ b/lib/cloud/azure/azure.go
@@ -196,20 +196,21 @@ func wrapAzureError(err error) error {
}
type azureInstanceSet struct {
- azconfig azureInstanceSetConfig
- vmClient virtualMachinesClientWrapper
- netClient interfacesClientWrapper
- blobcont containerWrapper
- azureEnv azure.Environment
- interfaces map[string]network.Interface
- dispatcherID string
- namePrefix string
- ctx context.Context
- stopFunc context.CancelFunc
- stopWg sync.WaitGroup
- deleteNIC chan string
- deleteBlob chan storage.Blob
- logger logrus.FieldLogger
+ azconfig azureInstanceSetConfig
+ vmClient virtualMachinesClientWrapper
+ netClient interfacesClientWrapper
+ networkResourceGroup string
+ blobcont containerWrapper
+ azureEnv azure.Environment
+ interfaces map[string]network.Interface
+ dispatcherID string
+ namePrefix string
+ ctx context.Context
+ stopFunc context.CancelFunc
+ stopWg sync.WaitGroup
+ deleteNIC chan string
+ deleteBlob chan storage.Blob
+ logger logrus.FieldLogger
}
func newAzureInstanceSet(config json.RawMessage, dispatcherID cloud.InstanceSetID, _ cloud.SharedResourceTags, logger logrus.FieldLogger) (prv cloud.InstanceSet, err error) {
@@ -258,6 +259,11 @@ func (az *azureInstanceSet) setup(azcfg azureInstanceSetConfig, dispatcherID str
az.vmClient = &virtualMachinesClientImpl{vmClient}
az.netClient = &interfacesClientImpl{netClient}
+ az.networkResourceGroup = az.azconfig.NetworkResourceGroup
+ if az.networkResourceGroup == "" {
+ az.networkResourceGroup = az.azconfig.ResourceGroup
+ }
+
result, err := storageAcctClient.ListKeys(az.ctx, az.azconfig.ResourceGroup, az.azconfig.StorageAccount)
if err != nil {
az.logger.WithError(err).Warn("Couldn't get account keys")
@@ -303,7 +309,7 @@ func (az *azureInstanceSet) setup(azcfg azureInstanceSetConfig, dispatcherID str
if !ok {
return
}
- _, delerr := az.netClient.delete(context.Background(), az.azconfig.ResourceGroup, nicname)
+ _, delerr := az.netClient.delete(context.Background(), az.networkResourceGroup, nicname)
if delerr != nil {
az.logger.WithError(delerr).Warnf("Error deleting %v", nicname)
} else {
@@ -357,11 +363,6 @@ func (az *azureInstanceSet) Create(
}
tags["created-at"] = to.StringPtr(time.Now().Format(time.RFC3339Nano))
- networkResourceGroup := az.azconfig.NetworkResourceGroup
- if networkResourceGroup == "" {
- networkResourceGroup = az.azconfig.ResourceGroup
- }
-
nicParameters := network.Interface{
Location: &az.azconfig.Location,
Tags: tags,
@@ -374,7 +375,7 @@ func (az *azureInstanceSet) Create(
ID: to.StringPtr(fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers"+
"/Microsoft.Network/virtualnetworks/%s/subnets/%s",
az.azconfig.SubscriptionID,
- networkResourceGroup,
+ az.networkResourceGroup,
az.azconfig.Network,
az.azconfig.Subnet)),
},
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list