Kaynağa Gözat

Fixed documentation errors. Ref: https://github.com/CloudVE/cloudbridge/issues/150

Nuwan Goonasekera 7 yıl önce
ebeveyn
işleme
bcc86519d6

+ 1 - 1
cloudbridge/cloud/interfaces/resources.py

@@ -731,7 +731,7 @@ class LaunchConfig(object):
         lc.add_block_device(...)
 
         inst = provider.compute.instances.create(
-            'MyVM', image, vm_type, subnet, launch_config=lc)
+            'MyVM', image, vm_type, subnet, zone, launch_config=lc)
     """
 
     @abstractmethod

+ 1 - 1
cloudbridge/cloud/interfaces/services.py

@@ -96,7 +96,7 @@ class ComputeService(CloudService):
 
             # launch a new instance
             image = provider.compute.images.find(name='Ubuntu 16.04')[0]
-            size = provider.compute.vm_types.find(name='m1.small')
+            size = provider.compute.vm_types.find(name='m1.small')[0]
             instance = provider.compute.instances.create('Hello', image, size)
             print(instance.id, instance.label)
 

+ 5 - 4
docs/getting_started.rst

@@ -103,7 +103,7 @@ on disk as a read-only file.
 .. code-block:: python
 
     import os
-    kp = provider.security.key_pairs.create('cloudbridge_intro')
+    kp = provider.security.key_pairs.create('cloudbridge-intro')
     with open('cloudbridge_intro.pem', 'w') as f:
         f.write(kp.material)
     os.chmod('cloudbridge_intro.pem', 0o400)
@@ -136,7 +136,7 @@ a private network.
     from cloudbridge.cloud.interfaces.resources import TrafficDirection
     fw = provider.security.vm_firewalls.create(
         label='cloudbridge-intro', description='A VM firewall used by
-        CloudBridge', network=net.id)
+        CloudBridge', network_id=net.id)
     fw.rules.create(TrafficDirection.INBOUND, 'tcp', 22, 22, '0.0.0.0/0')
 
 Launch an instance
@@ -148,12 +148,13 @@ also add the network interface as a launch argument.
 .. code-block:: python
 
     img = provider.compute.images.get(image_id)
+    zone = provider.compute.regions.get(provider.region_name).zones[0]
     vm_type = sorted([t for t in provider.compute.vm_types
                       if t.vcpus >= 2 and t.ram >= 4],
                       key=lambda x: x.vcpus*x.ram)[0]
     inst = provider.compute.instances.create(
         image=img, vm_type=vm_type, label='cloudbridge-intro',
-        subnet=sn, key_pair=kp, vm_firewalls=[fw])
+        subnet=sn, zone=zone, key_pair=kp, vm_firewalls=[fw])
     # Wait until ready
     inst.wait_till_ready()  # This is a blocking call
     # Show instance state
@@ -201,7 +202,7 @@ listed in order to help map each resource with the service that handles it.
 
     # Key Pair
     kp = provider.security.key_pairs.get('keypair ID')
-    kp_list = provider.security.key_pairs.find(name='cloudbridge_intro')
+    kp_list = provider.security.key_pairs.find(name='cloudbridge-intro')
     kp = kp_list[0]
 
     # Network

+ 1 - 1
docs/topics/design_decisions.rst

@@ -15,7 +15,7 @@ Require zone parameter when creating a default subnet
   time. Another factor influencing the decision was the example of creating a
   volume followed by creating an instance with presumably the two needing to be
   in the same zone. By requiring the zone across the board, it is less likely to
-  lead to a miss match. (Related to 63_.)
+  lead to a mismatch. (Related to 63_.)
 
 Resource identification, naming, and labeling
 ---------------------------------------------

+ 5 - 4
docs/topics/launch.rst

@@ -39,7 +39,7 @@ if you don't have those resources under your account, take a look at the
 
 .. code-block:: python
 
-    kp = provider.security.key_pairs.find(name='cloudbridge_intro')[0]
+    kp = provider.security.key_pairs.find(name='cloudbridge-intro')[0]
     fw = provider.security.vm_firewalls.list()[0]
 
 Launch an instance
@@ -50,7 +50,7 @@ Once we have all the desired pieces, we'll use them to launch an instance:
 
     inst = provider.compute.instances.create(
         name='cloudbridge-vpc', image=img, vm_type=vm_type,
-        subnet=subnet, key_pair=kp, vm_firewalls=[fw])
+        subnet=subnet, zone=zone, key_pair=kp, vm_firewalls=[fw])
 
 Private networking
 ~~~~~~~~~~~~~~~~~~
@@ -73,7 +73,7 @@ that subnet.
 
     inst = provider.compute.instances.create(
         name='cloudbridge-vpc', image=img, vm_type=vm_type,
-        subnet=sn, key_pair=kp, vm_firewalls=[fw])
+        subnet=sn, zone=zone, key_pair=kp, vm_firewalls=[fw])
 
 For more information on how to create and setup a private network, take a look
 at `Networking <./networking.html>`_.
@@ -95,7 +95,8 @@ refer to :class:`.LaunchConfig`.
     lc.add_volume_device(source=img, size=11, is_root=True)
     inst = provider.compute.instances.create(
         name='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)
 
 where ``img`` is the :class:`.Image` object to use for the root volume.
 

+ 4 - 4
docs/topics/networking.rst

@@ -51,9 +51,9 @@ several common scenarios.
      receive incoming traffic from Tier 2, but must not be able to make
      outgoing traffic outside of its subnet.
 
-    At present, CloudBridge does not provide support for this scenario,
-    primarily because OpenStack's FwaaS (Firewall-as-a-Service) is not widely
-    available.
+   At present, CloudBridge does not provide support for this scenario,
+   primarily because OpenStack's FwaaS (Firewall-as-a-Service) is not widely
+   available.
 
 1. Allowing internet access from a launched VM
 ----------------------------------------------
@@ -90,7 +90,7 @@ The additional step that's required here is to assign a floating IP to the VM:
         name='my-network', cidr_block='10.0.0.0/16')
     sn = net.create_subnet(name='my-subnet', cidr_block='10.0.0.0/28', zone=zone)
 
-    vm = provider.compute.instances.create('my-inst', subnet=sn, ...)
+    vm = provider.compute.instances.create('my-inst', subnet=sn, zone=zone, ...)
 
     router = provider.networking.routers.create(network=net, name='my-router')
     router.attach_subnet(sn)