You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2017/04/21 22:12:41 UTC
[4/9] libcloud git commit: Compute driver should correctly access
blob storage in alternate cloud environments.
Compute driver should correctly access blob storage in alternate cloud
environments.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/37e709c9
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/37e709c9
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/37e709c9
Branch: refs/heads/trunk
Commit: 37e709c98d8db059673d437f9a5e49e003afc427
Parents: 6aa7bb4
Author: Peter Amstutz <pe...@curoverse.com>
Authored: Fri Jan 6 11:03:00 2017 -0500
Committer: Peter Amstutz <pe...@curoverse.com>
Committed: Thu Apr 20 14:46:22 2017 -0400
----------------------------------------------------------------------
docs/compute/drivers/azure_arm.rst | 4 ++--
libcloud/common/azure_arm.py | 4 +++-
libcloud/compute/drivers/azure_arm.py | 13 ++++++++-----
3 files changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/37e709c9/docs/compute/drivers/azure_arm.rst
----------------------------------------------------------------------
diff --git a/docs/compute/drivers/azure_arm.rst b/docs/compute/drivers/azure_arm.rst
index ff974ab..74ecf72 100644
--- a/docs/compute/drivers/azure_arm.rst
+++ b/docs/compute/drivers/azure_arm.rst
@@ -49,8 +49,8 @@ You can select an alternate cloud environment using the "cloud_environment"
parameter to AzureNodeDriver constructor. Available alternate cloud
environments are 'AzureChinaCloud', 'AzureUSGovernment' and 'AzureGermanCloud'.
You can also supply explicit endpoints by providing a dict with the keys
-'resourceManagerEndpointUrl', 'activeDirectoryEndpointUrl' and
-'activeDirectoryResourceId'.
+'resourceManagerEndpointUrl', 'activeDirectoryEndpointUrl',
+'activeDirectoryResourceId' and 'storageEndpointSuffix'.
API Docs
--------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/37e709c9/libcloud/common/azure_arm.py
----------------------------------------------------------------------
diff --git a/libcloud/common/azure_arm.py b/libcloud/common/azure_arm.py
index cbd42f8..d4984a5 100644
--- a/libcloud/common/azure_arm.py
+++ b/libcloud/common/azure_arm.py
@@ -153,11 +153,13 @@ class AzureResourceManagementConnection(ConnectionUserAndKey):
raise Exception("cloud_environment must be one of '%s' or a dict "
"containing keys 'resourceManagerEndpointUrl', "
"'activeDirectoryEndpointUrl', "
- "'activeDirectoryResourceId'" % (
+ "'activeDirectoryResourceId', "
+ "'storageEndpointSuffix'" % (
"', '".join(publicEnvironments.keys())))
self.host = urlparse(cloud_environment['resourceManagerEndpointUrl']).hostname
self.login_host = urlparse(cloud_environment['activeDirectoryEndpointUrl']).hostname
self.login_resource = cloud_environment['activeDirectoryResourceId']
+ self.storage_suffix = cloud_environment['storageEndpointSuffix']
self.tenant_id = tenant_id
self.subscription_id = subscription_id
http://git-wip-us.apache.org/repos/asf/libcloud/blob/37e709c9/libcloud/compute/drivers/azure_arm.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/azure_arm.py b/libcloud/compute/drivers/azure_arm.py
index c7bed5e..d261d20 100644
--- a/libcloud/compute/drivers/azure_arm.py
+++ b/libcloud/compute/drivers/azure_arm.py
@@ -61,9 +61,10 @@ class AzureVhdImage(NodeImage):
"""Represents a VHD node image that an Azure VM can boot from."""
def __init__(self, storage_account, blob_container, name, driver):
- urn = "https://%s.blob.core.windows.net/%s/%s" % (storage_account,
- blob_container,
- name)
+ urn = "https://%s.blob%s/%s/%s" % (storage_account,
+ driver.connection.storage_suffix,
+ blob_container,
+ name)
super(AzureVhdImage, self).__init__(urn, name, driver)
def __repr__(self):
@@ -511,9 +512,10 @@ class AzureNodeDriver(NodeDriver):
n = 0
while True:
try:
- instance_vhd = "https://%s.blob.core.windows.net" \
+ instance_vhd = "https://%s.blob%s" \
"/%s/%s-os_%i.vhd" \
% (ex_storage_account,
+ self.connection.storage_suffix,
ex_blob_container,
name,
n)
@@ -1337,7 +1339,8 @@ class AzureNodeDriver(NodeDriver):
keys = self.ex_get_storage_account_keys(resource_group,
storageAccount)
blobdriver = AzureBlobsStorageDriver(storageAccount,
- keys["key1"])
+ keys["key1"],
+ host="blob%s" % (self.connection.storage_suffix))
blobdriver.delete_object(blobdriver.get_object(blobContainer,
blob))
return True