Merge lp:~arosales/charms/trusty/ubuntu/update-readme-test-for-lxc-network into lp:~cbjchen/charms/trusty/ubuntu/lxc-network-config

Proposed by Antonio Rosales
Status: Needs review
Proposed branch: lp:~arosales/charms/trusty/ubuntu/update-readme-test-for-lxc-network
Merge into: lp:~cbjchen/charms/trusty/ubuntu/lxc-network-config
Diff against target: 130 lines (+43/-13)
3 files modified
README.md (+22/-7)
config.yaml (+1/-1)
tests/10-deploy-test.py (+20/-5)
To merge this branch: bzr merge lp:~arosales/charms/trusty/ubuntu/update-readme-test-for-lxc-network
Reviewer Review Type Date Requested Status
Liang Chen Approve
Review via email: mp+254147@code.launchpad.net

Description of the change

Add documentation for new lxc network config option in README and Amulet test for the new lxc network config option.

To post a comment you must log in.
Revision history for this message
Liang Chen (cbjchen) wrote :

LGTM. Thanks!

review: Approve

Unmerged revisions

10. By Antonio Rosales

Add documentation for new lxc network config option in readme and Amulet test for the new lxc network config option.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.md'
2--- README.md 2013-12-12 17:19:32 +0000
3+++ README.md 2015-03-25 20:03:18 +0000
4@@ -1,6 +1,6 @@
5 # Overview
6
7-This charm provides a blank [Ubuntu](http://ubuntu.com) image. It does not provide any services other than a blank cloud image for you to manage manually, it is intended for testing and development.
8+This charm provides a blank [Ubuntu](http://ubuntu.com) image. It does not provide any services other than a blank cloud image for you to manage manually, it is intended for testing and development.
9
10 # Usage
11
12@@ -25,16 +25,32 @@
13 juju deploy ubuntu mytestmachine1
14 juju deploy ubuntu mytestmachine2
15
16-and so on.
17+and so on.
18+
19+# Configuration
20+
21+A configuration option to create a new network for LXC containers is provided via a boolean config option, 'new-lxc-network.'
22+The default is set to false indicating the same network of the node will also be used for LXC containers.
23+
24+To use a new network for LXC containers post juju deploy, issue:
25+
26+ juju set ubuntu new-lxc-network=true
27+
28+If you want to have a new network for LXC containers on deploy set up a lxc-config.yaml:
29+
30+ ubuntu:
31+ new-lxc-network: true
32+
33+and pass that as an arugment to deploy:
34+
35+ juju deploy --config lxc-config.yaml ubuntu
36+
37+For further information on setting configuration with Juju see https://jujucharms.com/docs/latest/charms-config
38
39 ## Known Limitations and Issues
40
41 This charm does not provide anything other than a blank server, so it does not relate to other charms.
42
43-# Configuration
44-
45-This charm has no configuration options.
46-
47 # Contact Information
48
49
50@@ -49,4 +65,3 @@
51 - Author: Juju Charm Community
52 - Report bugs at: [http://bugs.launchpad.net/charms/+source/ubuntu](http://bugs.launchpad.net/charms/+source/ubuntu)
53 - Location: [http://jujucharms.com/charms/precise/ubuntu](http://jujucharms.com/charms/precise/ubuntu)
54-
55
56=== modified file 'config.yaml'
57--- config.yaml 2015-02-19 21:19:01 +0000
58+++ config.yaml 2015-03-25 20:03:18 +0000
59@@ -1,7 +1,7 @@
60 options:
61 new-lxc-network:
62 type: boolean
63- default: True
64+ default: False
65 description: |
66 If True creates new network for lxc containers, otherwise using the
67 same network of the node for lxc containers.
68
69=== modified file 'tests/10-deploy-test.py'
70--- tests/10-deploy-test.py 2014-01-25 03:15:50 +0000
71+++ tests/10-deploy-test.py 2015-03-25 20:03:18 +0000
72@@ -3,7 +3,7 @@
73 # This Amulet based tests
74 # The goal is to ensure the Ubuntu charm
75 # sucessfully deploys and can be accessed.
76-# Note the Ubuntu charm does not have any
77+# Note the Ubuntu charm does not have any
78 # relations or config options.
79
80 import amulet
81@@ -40,11 +40,12 @@
82 # will automatically "FAIL" the test.
83 raise
84
85-# Access the Ubuntu instance to ensure it has been deployed correctly
86+# Access the Ubuntu instance to ensure it has been deployed correctly
87
88 # Define the commands to be ran
89 lsb_release_command = 'cat /etc/lsb-release'
90 uname_command = 'uname -a'
91+lxc_interface_command = 'ifconfig -s lxcbr0'
92
93 # Cat the release information
94 output, code = d.sentry.unit['ubuntu/0'].run(lsb_release_command)
95@@ -54,11 +55,11 @@
96 print(output)
97 amulet.raise_status(amulet.FAIL, msg=error_message)
98 else:
99- message = 'The lsb-release command successfully executed.'
100+ message = 'The ' + lsb_release_command + ' successfully executed.'
101 print(output)
102 print(message)
103
104-# Get the uname -a output
105+# Get the uname -a output
106 output, code = d.sentry.unit['ubuntu/0'].run(uname_command)
107 # Confirm the uname command was ran successfully
108 if (code != 0):
109@@ -66,6 +67,20 @@
110 print(output)
111 amulet.raise_status(amulet.FAIL, msg=error_message)
112 else:
113- message = 'The uname command successfully executed.'
114+ message = 'The ' + uname_command + ' successfully executed.'
115+ print(output)
116+ print(message)
117+
118+# Test creating a new network for LXC via new-lxc-network config option.
119+# Set the new-lxc-network config option to create a new network for LXC.
120+d.configure('ubuntu', {'new-lxc-network': 'true'})
121+# Confirm the the lxc bridge interface was sucessfully created
122+output, code = d.sentry.unit['ubuntu/0'].run(lxc_interface_command)
123+if (code != 0):
124+ error_message = 'The lxcbr0 interface was not created.'
125+ print(output)
126+ amulet.raise_status(amulet.FAIL, msg=error_message)
127+else:
128+ message = 'The lxcbr0 interface sucessfully created.'
129 print(output)
130 print(message)

Subscribers

People subscribed via source and target branches

to all changes: