Просмотр исходного кода

Update docs related to the networking method signature changes

Enis Afgan 9 лет назад
Родитель
Сommit
e8a78d17b7
2 измененных файлов с 9 добавлено и 5 удалено
  1. 5 1
      docs/getting_started.rst
  2. 4 4
      docs/topics/networking.rst

+ 5 - 1
docs/getting_started.rst

@@ -94,9 +94,13 @@ on disk as a read-only file.
 Create a security group
 Create a security group
 -----------------------
 -----------------------
 Next, we need to create a security group and add a rule to allow ssh access.
 Next, we need to create a security group and add a rule to allow ssh access.
+A security group needs to be associated with a private network, so we'll also
+need to fetch it.
 
 
 .. code-block:: python
 .. code-block:: python
 
 
+    provider.network.list()  # Find a desired network ID
+    net = provider.network.get('desired network ID')
     sg = provider.security.security_groups.create(
     sg = provider.security.security_groups.create(
         'cloudbridge_intro', 'A security group used by CloudBridge', net.id)
         'cloudbridge_intro', 'A security group used by CloudBridge', net.id)
     sg.add_rule('tcp', 22, 22, '0.0.0.0/0')
     sg.add_rule('tcp', 22, 22, '0.0.0.0/0')
@@ -115,7 +119,7 @@ also add the network interface as a launch argument.
                        key=lambda x: x.vcpus*x.ram)[0]
                        key=lambda x: x.vcpus*x.ram)[0]
     inst = provider.compute.instances.create(
     inst = provider.compute.instances.create(
         name='CloudBridge-intro', image=img, instance_type=inst_type,
         name='CloudBridge-intro', image=img, instance_type=inst_type,
-        key_pair=kp, security_groups=[sg])
+        network=net, key_pair=kp, security_groups=[sg])
     # Wait until ready
     # Wait until ready
     inst.wait_till_ready()  # This is a blocking call
     inst.wait_till_ready()  # This is a blocking call
     # Show instance state
     # Show instance state

+ 4 - 4
docs/topics/networking.rst

@@ -15,9 +15,9 @@ Create a new private network
 ----------------------------
 ----------------------------
 Creating a private network is a simple, one-line command but appropriately
 Creating a private network is a simple, one-line command but appropriately
 connecting it so it has Internet access is a multi-step process:
 connecting it so it has Internet access is a multi-step process:
-(1) create a network; (2) create a subnet within the network; (3) create a
+(1) create a network; (2) create a subnet within this network; (3) create a
 router; (4) attach the router to an external network; and (5) add a route to
 router; (4) attach the router to an external network; and (5) add a route to
-the router that links with with a subnet. For some providers, any network can
+the router that links with a subnet. For some providers, any network can
 be external (ie, connected to the Internet) while for others it's a specific,
 be external (ie, connected to the Internet) while for others it's a specific,
 pre-defined one that exists in the an account by default. In order to properly
 pre-defined one that exists in the an account by default. In order to properly
 connect the router, we need to ensure we're using an external network.
 connect the router, we need to ensure we're using an external network.
@@ -35,9 +35,9 @@ the block and allow up to 16 IP addresses into the subnet (``/28``).
     if not net.external:
     if not net.external:
         for n in self.provider.network.list():
         for n in self.provider.network.list():
             if n.external:
             if n.external:
-                external_net = n
+                net = n
                 break
                 break
-    router.attach_network(external_net.id)
+    router.attach_network(net.id)
     router.add_route(sn.id)
     router.add_route(sn.id)
 
 
 Retrieve an existing private network
 Retrieve an existing private network