ソースを参照

Updated docs with zone specific provider change

Nuwan Goonasekera 7 年 前
コミット
7f3ea7c3b7

+ 2 - 2
docs/getting_started.rst

@@ -87,8 +87,8 @@ Google Compute Cloud:
 
 
     config = {'gcp_project_name': 'project name',
     config = {'gcp_project_name': 'project name',
               'gcp_service_creds_file': 'service_file.json',
               'gcp_service_creds_file': 'service_file.json',
-              'gcp_default_zone': 'us-east1-b',  # Use desired value
-              'gcp_region_name': 'us-east1'}  # Use desired value
+              'gcp_region_name': 'us-east1',  # Use desired value
+              'gcp_zone_name': 'us-east1-b'}  # Use desired value
     provider = CloudProviderFactory().create_provider(ProviderList.GCP, config)
     provider = CloudProviderFactory().create_provider(ProviderList.GCP, config)
     image_id = 'https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-1804-bionic-v20181222'
     image_id = 'https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-1804-bionic-v20181222'
 
 

+ 1 - 1
docs/topics/block_storage.rst

@@ -14,7 +14,7 @@ performed via the :class:`.VolumeService`. To start, let's create a 1GB volume.
 
 
 .. code-block:: python
 .. code-block:: python
 
 
-    vol = provider.storage.volumes.create('cloudbridge-vol', 1, 'us-east-1e')
+    vol = provider.storage.volumes.create('cloudbridge-vol', 1)
     vol.wait_till_ready()
     vol.wait_till_ready()
     provider.storage.volumes.list()
     provider.storage.volumes.list()
 
 

+ 12 - 1
docs/topics/design_decisions.rst

@@ -119,7 +119,18 @@ Resource identification, naming, and labeling
   `labels` adhere to the same restrictions - a minimum length of 3 which
   `labels` adhere to the same restrictions - a minimum length of 3 which
   should be alphanumeric characters or dashes only. Names or labels should
   should be alphanumeric characters or dashes only. Names or labels should
   not begin or end with a dash, or have consecutive dashes.
   not begin or end with a dash, or have consecutive dashes.
-   
+
+Make providers single zone
+---------------------------
+
+  Allowing each operation to specify its own zone led to various complications,
+  such as the one detailed above. Ultimately, it led to an impasse with GCP,
+  which tended to require the zone for almost every operation and some of our
+  methods were not geared to do so. Therefore, by making the provider zone
+  specific, we have removed a considerable amount of complexity from both the
+  code, with no significant impact on usability, since operations generally
+  tend to be confined to the same zone. Multi-zone operations now require
+  multiple cloud provider instances.
 
 
   .. _63: https://github.com/CloudVE/cloudbridge/issues/63
   .. _63: https://github.com/CloudVE/cloudbridge/issues/63
   .. _131: https://github.com/CloudVE/cloudbridge/issues/131
   .. _131: https://github.com/CloudVE/cloudbridge/issues/131

+ 8 - 7
docs/topics/launch.rst

@@ -23,12 +23,11 @@ In addition, CloudBridge instances must be launched into a private subnet.
 While it is possible to create complex network configurations as shown in the
 While it is possible to create complex network configurations as shown in the
 `Private networking`_ section, if you don't particularly care in which subnet
 `Private networking`_ section, if you don't particularly care in which subnet
 the instance is launched, CloudBridge provides a convenience function to
 the instance is launched, CloudBridge provides a convenience function to
-quickly obtain a default subnet for use. We just need to supply a zone to use.
+quickly obtain a default subnet for use.
 
 
 .. code-block:: python
 .. code-block:: python
 
 
-    zone = provider.compute.regions.get(provider.region_name).zones[0]
-    subnet = provider.networking.subnets.get_or_create_default(zone)
+    subnet = provider.networking.subnets.get_or_create_default()
 
 
 When launching an instance, you can also specify several optional arguments
 When launching an instance, you can also specify several optional arguments
 such as the firewall (aka security group), a key pair, or instance user data.
 such as the firewall (aka security group), a key pair, or instance user data.
@@ -44,13 +43,15 @@ if you don't have those resources under your account, take a look at the
 
 
 Launch an instance
 Launch an instance
 ------------------
 ------------------
-Once we have all the desired pieces, we'll use them to launch an instance:
+Once we have all the desired pieces, we'll use them to launch an instance.
+Note that the instance is launched in the provider's default region and zone,
+and can be overridden by changing the provider config.
 
 
 .. code-block:: python
 .. code-block:: python
 
 
     inst = provider.compute.instances.create(
     inst = provider.compute.instances.create(
         label='cloudbridge-vpc', image=img, vm_type=vm_type,
         label='cloudbridge-vpc', image=img, vm_type=vm_type,
-        subnet=subnet, zone=zone, key_pair=kp, vm_firewalls=[fw])
+        subnet=subnet, key_pair=kp, vm_firewalls=[fw])
 
 
 Private networking
 Private networking
 ~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~
@@ -73,7 +74,7 @@ that subnet.
 
 
     inst = provider.compute.instances.create(
     inst = provider.compute.instances.create(
         label='cloudbridge-vpc', image=img, vm_type=vm_type,
         label='cloudbridge-vpc', image=img, vm_type=vm_type,
-        subnet=sn, zone=zone, key_pair=kp, vm_firewalls=[fw])
+        subnet=sn, key_pair=kp, vm_firewalls=[fw])
 
 
 For more information on how to create and setup a private network, take a look
 For more information on how to create and setup a private network, take a look
 at `Networking <./networking.html>`_.
 at `Networking <./networking.html>`_.
@@ -96,7 +97,7 @@ refer to :class:`.LaunchConfig`.
     inst = provider.compute.instances.create(
     inst = provider.compute.instances.create(
         label='cloudbridge-bdm', image=img,  vm_type=vm_type,
         label='cloudbridge-bdm', image=img,  vm_type=vm_type,
         launch_config=lc, key_pair=kp, vm_firewalls=[fw],
         launch_config=lc, key_pair=kp, vm_firewalls=[fw],
-        subnet=subnet, zone=zone)
+        subnet=subnet)
 
 
 where ``img`` is the :class:`.Image` object to use for the root volume.
 where ``img`` is the :class:`.Image` object to use for the root volume.
 
 

+ 3 - 4
docs/topics/networking.rst

@@ -75,8 +75,7 @@ subnet (``/28``).
     net = provider.networking.networks.create(
     net = provider.networking.networks.create(
         label='my-network', cidr_block='10.0.0.0/16')
         label='my-network', cidr_block='10.0.0.0/16')
     sn = net.subnets.create(label='my-subnet',
     sn = net.subnets.create(label='my-subnet',
-                            cidr_block='10.0.0.0/28',
-                            zone=zone)
+                            cidr_block='10.0.0.0/28')
     router = provider.networking.routers.create(label='my-router', network=net)
     router = provider.networking.routers.create(label='my-router', network=net)
     router.attach_subnet(sn)
     router.attach_subnet(sn)
     gateway = net.gateways.get_or_create()
     gateway = net.gateways.get_or_create()
@@ -91,9 +90,9 @@ The additional step that's required here is to assign a floating IP to the VM:
 
 
     net = provider.networking.networks.create(
     net = provider.networking.networks.create(
         label='my-network', cidr_block='10.0.0.0/16')
         label='my-network', cidr_block='10.0.0.0/16')
-    sn = net.subnets.create(label='my-subnet', cidr_block='10.0.0.0/28', zone=zone)
+    sn = net.subnets.create(label='my-subnet', cidr_block='10.0.0.0/28')
 
 
-    vm = provider.compute.instances.create(label='my-inst', subnet=sn, zone=zone, ...)
+    vm = provider.compute.instances.create(label='my-inst', subnet=sn, ...)
 
 
     router = provider.networking.routers.create(label='my-router', network=net)
     router = provider.networking.routers.create(label='my-router', network=net)
     router.attach_subnet(sn)
     router.attach_subnet(sn)

+ 20 - 18
docs/topics/setup.rst

@@ -86,32 +86,25 @@ AWS
 +---------------------+--------------------------------------------------------------+
 +---------------------+--------------------------------------------------------------+
 | Variable            | Description                                                  |
 | Variable            | Description                                                  |
 +=====================+==============================================================+
 +=====================+==============================================================+
+| aws_region_name     | Default region name. Default is ``us-east-1``.               |
++---------------------+--------------------------------------------------------------+
+| aws_zone_name       | Default zone name. If not specified, defaults to first zone  |
+|                     | in default region. If specified, must match default region.  |
++---------------------+--------------------------------------------------------------+
 | aws_session_token   | Session key for your AWS account (if using temporary         |
 | aws_session_token   | Session key for your AWS account (if using temporary         |
 |                     | credentials).                                                |
 |                     | credentials).                                                |
 +---------------------+--------------------------------------------------------------+
 +---------------------+--------------------------------------------------------------+
-| ec2_conn_path	      | Connection path. Default is ``/``.                           |
+| ec2_endpoint_url    | Endpoint to use. Default is ``ec2.us-east-1.amazonaws.com``. |
 +---------------------+--------------------------------------------------------------+
 +---------------------+--------------------------------------------------------------+
 | ec2_is_secure       | True to use an SSL connection. Default is ``True``.          |
 | ec2_is_secure       | True to use an SSL connection. Default is ``True``.          |
 +---------------------+--------------------------------------------------------------+
 +---------------------+--------------------------------------------------------------+
-| ec2_port            | EC2 connection port. Does not need to be specified unless    |
-|                     | EC2 service is running on an alternative port.               |
-+---------------------+--------------------------------------------------------------+
-| ec2_region_endpoint | Endpoint to use. Default is ``ec2.us-east-1.amazonaws.com``. |
-+---------------------+--------------------------------------------------------------+
-| ec2_region_name     | Default region name. Default is ``us-east-1``.               |
-+---------------------+--------------------------------------------------------------+
 | ec2_validate_certs  | Whether to use SSL certificate verification. Default is      |
 | ec2_validate_certs  | Whether to use SSL certificate verification. Default is      |
 |                     | ``False``.                                                   |
 |                     | ``False``.                                                   |
 +---------------------+--------------------------------------------------------------+
 +---------------------+--------------------------------------------------------------+
-| s3_conn_path        | Connection path. Default is ``/``.                           |
+| s3_endpoint_url     | Host connection endpoint. Default is ``s3.amazonaws.com``.   |
 +---------------------+--------------------------------------------------------------+
 +---------------------+--------------------------------------------------------------+
 | s3_is_secure        | True to use an SSL connection. Default is ``True``.          |
 | s3_is_secure        | True to use an SSL connection. Default is ``True``.          |
 +---------------------+--------------------------------------------------------------+
 +---------------------+--------------------------------------------------------------+
-| s3_host             | Host connection endpoint. Default is ``s3.amazonaws.com``.   |
-+---------------------+--------------------------------------------------------------+
-| s3_port             | Host connection port. Does not need to be specified unless   |
-|                     | S3 service is running on an alternative port.                |
-+---------------------+--------------------------------------------------------------+
 | s3_validate_certs   | Whether to use SSL certificate verification. Default is      |
 | s3_validate_certs   | Whether to use SSL certificate verification. Default is      |
 |                     | ``False``.                                                   |
 |                     | ``False``.                                                   |
 +---------------------+--------------------------------------------------------------+
 +---------------------+--------------------------------------------------------------+
@@ -130,6 +123,10 @@ Azure
 | azure_region_name                   | Default region to use for the current                    |
 | azure_region_name                   | Default region to use for the current                    |
 |                                     | session. Default is ``eastus``.                          |
 |                                     | session. Default is ``eastus``.                          |
 +-------------------------------------+----------------------------------------------------------+
 +-------------------------------------+----------------------------------------------------------+
+| aws_zone_name                       | Default zone name. If not specified, defaults to first   |
+|                                     | zone in default region. If specified, must match default |
+|                                     | region.                                                  |
++-------------------------------------+--------------------------------------------------------------+
 | azure_resource_group                | Azure resource group to use. Default is ``cloudbridge``. |
 | azure_resource_group                | Azure resource group to use. Default is ``cloudbridge``. |
 +-------------------------------------+----------------------------------------------------------+
 +-------------------------------------+----------------------------------------------------------+
 | azure_storage_account               | Azure storage account to use. Note that this value must  |
 | azure_storage_account               | Azure storage account to use. Note that this value must  |
@@ -148,12 +145,13 @@ GCP
 +-------------------------+----------------------------------------------------------+
 +-------------------------+----------------------------------------------------------+
 | Variable                | Description                                              |
 | Variable                | Description                                              |
 +=========================+==========================================================+
 +=========================+==========================================================+
-| gcp_default_zone        | Default placement zone to use for the current session.   |
-|                         | Default is ``us-central1-a``.                            |
-+-------------------------+----------------------------------------------------------+
 | gcp_region_name         | Default region to use for the current session. Default   |
 | gcp_region_name         | Default region to use for the current session. Default   |
 |                         | is ``us-central1``.                                      |
 |                         | is ``us-central1``.                                      |
 +-------------------------+----------------------------------------------------------+
 +-------------------------+----------------------------------------------------------+
+| gcp_zone_name           | Default zone name. If not specified, defaults to first   |
+|                         | zone in default region. If specified, must match default |
+|                         | region.                                                  |
++-------------------------+----------------------------------------------------------+
 | gcp_vm_default_username | System user name for which supplied key pair will be     |
 | gcp_vm_default_username | System user name for which supplied key pair will be     |
 |                         | placed.                                                  |
 |                         | placed.                                                  |
 +-------------------------+----------------------------------------------------------+
 +-------------------------+----------------------------------------------------------+
@@ -209,6 +207,8 @@ https://docs.microsoft.com/en-us/azure/role-based-access-control/overview.
 +-------------------------------------+-----------+
 +-------------------------------------+-----------+
 | AZURE_REGION_NAME                   |           |
 | AZURE_REGION_NAME                   |           |
 +-------------------------------------+-----------+
 +-------------------------------------+-----------+
+| AZURE_ZONE_NAME                     |           |
++-------------------------------------+-----------+
 | AZURE_RESOURCE_GROUP                |           |
 | AZURE_RESOURCE_GROUP                |           |
 +-------------------------------------+-----------+
 +-------------------------------------+-----------+
 | AZURE_STORAGE_ACCOUNT               |           |
 | AZURE_STORAGE_ACCOUNT               |           |
@@ -226,7 +226,7 @@ GCP
 | or                     |           |
 | or                     |           |
 | GCP_SERVICE_CREDS_FILE |           |
 | GCP_SERVICE_CREDS_FILE |           |
 +------------------------+-----------+
 +------------------------+-----------+
-| GCP_DEFAULT_ZONE       |           |
+| GCP_ZONE_NAME          |           |
 +------------------------+-----------+
 +------------------------+-----------+
 | GCP_PROJECT_NAME       |           |
 | GCP_PROJECT_NAME       |           |
 +------------------------+-----------+
 +------------------------+-----------+
@@ -249,6 +249,8 @@ OpenStack
 +------------------------+-----------+
 +------------------------+-----------+
 | OS_REGION_NAME         | ✔         |
 | OS_REGION_NAME         | ✔         |
 +------------------------+-----------+
 +------------------------+-----------+
+| OS_ZONE_NAME           |           |
++------------------------+-----------+
 | NOVA_SERVICE_NAME      |           |
 | NOVA_SERVICE_NAME      |           |
 +------------------------+-----------+
 +------------------------+-----------+
 | OS_AUTH_TOKEN          |           |
 | OS_AUTH_TOKEN          |           |