|
@@ -5,30 +5,17 @@ from azure.common import AzureException
|
|
|
|
|
|
|
|
from cloudbridge.cloud.base.resources import ClientPagedResultList
|
|
from cloudbridge.cloud.base.resources import ClientPagedResultList
|
|
|
from cloudbridge.cloud.base.services import BaseBlockStoreService, \
|
|
from cloudbridge.cloud.base.services import BaseBlockStoreService, \
|
|
|
-<<<<<<< HEAD
|
|
|
|
|
- BaseComputeService, BaseImageService, BaseInstanceTypesService, \
|
|
|
|
|
- BaseNetworkService, BaseObjectStoreService, \
|
|
|
|
|
- BaseSecurityGroupService, BaseSecurityService, \
|
|
|
|
|
- BaseSnapshotService, BaseVolumeService
|
|
|
|
|
-=======
|
|
|
|
|
BaseComputeService, BaseImageService, BaseNetworkService, \
|
|
BaseComputeService, BaseImageService, BaseNetworkService, \
|
|
|
BaseObjectStoreService, BaseRegionService, BaseSecurityGroupService, \
|
|
BaseObjectStoreService, BaseRegionService, BaseSecurityGroupService, \
|
|
|
BaseSecurityService, BaseSnapshotService, BaseVolumeService
|
|
BaseSecurityService, BaseSnapshotService, BaseVolumeService
|
|
|
->>>>>>> 6ea3953... Added Region Service code changes
|
|
|
|
|
from cloudbridge.cloud.interfaces.resources import PlacementZone, \
|
|
from cloudbridge.cloud.interfaces.resources import PlacementZone, \
|
|
|
Snapshot, Volume
|
|
Snapshot, Volume
|
|
|
from cloudbridge.cloud.providers.azure import helpers as azure_helpers
|
|
from cloudbridge.cloud.providers.azure import helpers as azure_helpers
|
|
|
|
|
|
|
|
from msrestazure.azure_exceptions import CloudError
|
|
from msrestazure.azure_exceptions import CloudError
|
|
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
|
|
-from .resources import AzureBucket, AzureInstanceType,\
|
|
|
|
|
- AzureMachineImage, AzureNetwork, \
|
|
|
|
|
- AzureSecurityGroup, \
|
|
|
|
|
-=======
|
|
|
|
|
from .resources import AzureBucket, AzureMachineImage, \
|
|
from .resources import AzureBucket, AzureMachineImage, \
|
|
|
AzureNetwork, AzureRegion, AzureSecurityGroup, \
|
|
AzureNetwork, AzureRegion, AzureSecurityGroup, \
|
|
|
->>>>>>> 6ea3953... Added Region Service code changes
|
|
|
|
|
AzureSnapshot, AzureVolume, \
|
|
AzureSnapshot, AzureVolume, \
|
|
|
IMAGE_NAME, IMAGE_RESOURCE_ID, \
|
|
IMAGE_NAME, IMAGE_RESOURCE_ID, \
|
|
|
NETWORK_NAME, NETWORK_RESOURCE_ID, \
|
|
NETWORK_NAME, NETWORK_RESOURCE_ID, \
|
|
@@ -238,8 +225,8 @@ class AzureVolumeService(BaseVolumeService):
|
|
|
'location': zone_id or self.provider.azure_client.region_name,
|
|
'location': zone_id or self.provider.azure_client.region_name,
|
|
|
'disk_size_gb': size,
|
|
'disk_size_gb': size,
|
|
|
'creation_data': {
|
|
'creation_data': {
|
|
|
- 'create_option': 'empty'
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ 'create_option': 'empty'
|
|
|
|
|
+ },
|
|
|
'tags': tags}
|
|
'tags': tags}
|
|
|
|
|
|
|
|
self.provider.azure_client.create_empty_disk(disk_name, params)
|
|
self.provider.azure_client.create_empty_disk(disk_name, params)
|
|
@@ -314,7 +301,7 @@ class AzureSnapshotService(BaseSnapshotService):
|
|
|
class AzureComputeService(BaseComputeService):
|
|
class AzureComputeService(BaseComputeService):
|
|
|
def __init__(self, provider):
|
|
def __init__(self, provider):
|
|
|
super(AzureComputeService, self).__init__(provider)
|
|
super(AzureComputeService, self).__init__(provider)
|
|
|
- self._instance_type_svc = AzureInstanceTypesService(self.provider)
|
|
|
|
|
|
|
+ # self._instance_type_svc = AzureInstanceTypesService(self.provider)
|
|
|
# self._instance_svc = AzureInstanceService(self.provider)
|
|
# self._instance_svc = AzureInstanceService(self.provider)
|
|
|
self._region_svc = AzureRegionService(self.provider)
|
|
self._region_svc = AzureRegionService(self.provider)
|
|
|
self._images_svc = AzureImageService(self.provider)
|
|
self._images_svc = AzureImageService(self.provider)
|
|
@@ -325,7 +312,8 @@ class AzureComputeService(BaseComputeService):
|
|
|
|
|
|
|
|
@property
|
|
@property
|
|
|
def instance_types(self):
|
|
def instance_types(self):
|
|
|
- return self._instance_type_svc
|
|
|
|
|
|
|
+ raise NotImplementedError('AzureComputeService not '
|
|
|
|
|
+ 'implemented this method')
|
|
|
|
|
|
|
|
@property
|
|
@property
|
|
|
def instances(self):
|
|
def instances(self):
|
|
@@ -363,26 +351,6 @@ class AzureImageService(BaseImageService):
|
|
|
limit=limit, marker=marker)
|
|
limit=limit, marker=marker)
|
|
|
|
|
|
|
|
|
|
|
|
|
-class AzureInstanceTypesService(BaseInstanceTypesService):
|
|
|
|
|
-
|
|
|
|
|
- def __init__(self, provider):
|
|
|
|
|
- super(AzureInstanceTypesService, self).__init__(provider)
|
|
|
|
|
-
|
|
|
|
|
- @property
|
|
|
|
|
- def instance_data(self):
|
|
|
|
|
- """
|
|
|
|
|
- Fetch info about the available instances.
|
|
|
|
|
- """
|
|
|
|
|
- r = self.provider.azure_client.list_instance_types()
|
|
|
|
|
- return r
|
|
|
|
|
-
|
|
|
|
|
- def list(self, limit=None, marker=None):
|
|
|
|
|
- inst_types = [AzureInstanceType(self.provider, inst_type)
|
|
|
|
|
- for inst_type in self.instance_data]
|
|
|
|
|
- return ClientPagedResultList(self.provider, inst_types,
|
|
|
|
|
- limit=limit, marker=marker)
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
class AzureNetworkService(BaseNetworkService):
|
|
class AzureNetworkService(BaseNetworkService):
|
|
|
def __init__(self, provider):
|
|
def __init__(self, provider):
|
|
|
super(AzureNetworkService, self).__init__(provider)
|
|
super(AzureNetworkService, self).__init__(provider)
|
|
@@ -446,26 +414,6 @@ class AzureNetworkService(BaseNetworkService):
|
|
|
raise NotImplementedError('AzureNetworkService '
|
|
raise NotImplementedError('AzureNetworkService '
|
|
|
'not implemented this method')
|
|
'not implemented this method')
|
|
|
|
|
|
|
|
- def delete(self, network_id):
|
|
|
|
|
- """
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
|
|
- Delete an existing network.
|
|
|
|
|
- """
|
|
|
|
|
-=======
|
|
|
|
|
- Delete an existing network.
|
|
|
|
|
- """
|
|
|
|
|
->>>>>>> 6ea3953... Added Region Service code changes
|
|
|
|
|
- try:
|
|
|
|
|
- params = azure_helpers.parse_url(NETWORK_RESOURCE_ID, network_id)
|
|
|
|
|
- network = self.provider.azure_client. \
|
|
|
|
|
- delete_network(params.get(NETWORK_NAME))
|
|
|
|
|
- return True if network else False
|
|
|
|
|
- except CloudError as cloudError:
|
|
|
|
|
- log.exception(cloudError.message)
|
|
|
|
|
- return False
|
|
|
|
|
-
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
|
|
-=======
|
|
|
|
|
|
|
|
|
|
class AzureRegionService(BaseRegionService):
|
|
class AzureRegionService(BaseRegionService):
|
|
|
def __init__(self, provider):
|
|
def __init__(self, provider):
|
|
@@ -497,4 +445,3 @@ class AzureRegionService(BaseRegionService):
|
|
|
region = AzureRegion(self.provider, azureRegion)
|
|
region = AzureRegion(self.provider, azureRegion)
|
|
|
break
|
|
break
|
|
|
return region
|
|
return region
|
|
|
->>>>>>> 6ea3953... Added Region Service code changes
|
|
|