elasticluster.providers.azure_provider¶
-
class
elasticluster.providers.azure_provider.
AzureCloudProvider
(subscription_id, tenant_id, client_id, secret, location, vm_deployment_template=None, net_deployment_template=None, **extra)[source]¶ Use the Azure Python SDK to connect to the Azure clouds and manage virtual machines.
An AzureCloudProvider owns a tree of Azure resources, rooted in one or more subscriptions and one or more storage accounts.
-
get_ips
(instance_id)[source]¶ Retrieves all IP addresses associated to a given instance.
Returns: tuple (IPs)
-
is_instance_running
(instance_id)[source]¶ Check if the instance is up and running.
Parameters: instance_id (str) – instance identifier Returns: bool - True if running, False otherwise
-
pause_instance
(instance_id)[source]¶ Pauses the instance - retaining disks and configuration.
Parameters: instance_id (str) – instance identifier Returns: dict - Dictionary of configuration required to restart instance.
-
resume_instance
(instance_state)[source]¶ Restart an instance from a dictionary of configuration.
Parameters: instance_config (dict) – Dictionary of configuration returned from pause_instance()
Returns: str - instance_id
-
start_instance
(key_name, public_key_path, private_key_path, security_group, flavor, image_id, image_userdata, cluster_name, username='root', node_name=None, boot_disk_size=30, storage_account_type='Standard_LRS', **extra)[source]¶ Start a new VM using the given properties.
Parameters: - key_name (str) – unused in Azure, only present for interface compatibility
- public_key_path (str) – path to ssh public key to authorize on the VM (for user username, see below)
- private_key_path (str) – unused in Azure, only present for interface compatibility
- security_group (str) – network security group to attach VM to, currently unused
- flavor (str) – machine type to use for the instance
- image_id (str) – disk image to use for the instance;
has the form publisher/offer/sku/version
(e.g.,
canonical/ubuntuserver/16.04.0-LTS/latest
) - image_userdata (str) – command to execute after startup, currently unused
- boot_disk_size (int) – size of boot disk to use; values are specified in gigabytes.
- username (str) – username for the given ssh key
(default is
root
as it’s always guaranteed to exist, but you probably don’t want to use that) - storage_account_type (str) – Type of disks to attach to the VM. For a list of valid values, see: https://docs.microsoft.com/en-us/rest/api/compute/disks/createorupdate#diskstorageaccounttypes
Returns: tuple[str, str] – resource group and node name of the started VM
-