Merge lp:~jjo/uvtool/multi-bridge into lp:~uvtool-dev/uvtool/trunk

Proposed by JuanJo Ciarlante
Status: Needs review
Proposed branch: lp:~jjo/uvtool/multi-bridge
Merge into: lp:~uvtool-dev/uvtool/trunk
Diff against target: 85 lines (+16/-12)
2 files modified
man/uvt-kvm.1 (+3/-1)
uvtool/libvirt/kvm.py (+13/-11)
To merge this branch: bzr merge lp:~jjo/uvtool/multi-bridge
Reviewer Review Type Date Requested Status
uvtool development Pending
Review via email: mp+235383@code.launchpad.net

Commit message

[jjo] uvt-kvm: add multiple bridge support
- each --bridge argument is setup to be a new NIC at VM

To post a comment you must log in.

Unmerged revisions

93. By JuanJo Ciarlante

uvt-kvm: add multiple bridge support
- each --bridge argument is setup to be a new NIC at VM

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'man/uvt-kvm.1'
2--- man/uvt-kvm.1 2014-04-01 11:27:14 +0000
3+++ man/uvt-kvm.1 2014-09-20 15:35:59 +0000
4@@ -349,7 +349,9 @@
5 .TP
6 .BI --bridge\ bridge
7 Replace the first defined NIC with one that connects to the given host
8-bridge. Default: unaltered from the libvirt domain template.
9+bridge. If you pass several --bridge arguments, new virtual NICs will be
10+created and connected to each bridge. Default: unaltered from the libvirt
11+domain template.
12
13 .TP
14 .B --log-console-output
15
16=== modified file 'uvtool/libvirt/kvm.py'
17--- uvtool/libvirt/kvm.py 2014-04-01 11:27:14 +0000
18+++ uvtool/libvirt/kvm.py 2014-09-20 15:35:59 +0000
19@@ -257,7 +257,8 @@
20
21
22 def compose_domain_xml(name, volumes, cpu=1, memory=512, unsafe_caching=False,
23- template_path=DEFAULT_TEMPLATE, log_console_output=False, bridge=None):
24+ template_path=DEFAULT_TEMPLATE, log_console_output=False,
25+ bridge_list=None):
26 tree = etree.parse(template_path)
27 domain = tree.getroot()
28 assert domain.tag == 'domain'
29@@ -299,13 +300,14 @@
30 )
31 )
32
33- if bridge:
34+ if bridge_list:
35 etree.strip_elements(devices, 'interface')
36- devices.append(E.interface(
37- E.source(bridge=bridge),
38- E.model(type='virtio'),
39- type='bridge'),
40- )
41+ for bridge in bridge_list:
42+ devices.append(E.interface(
43+ E.source(bridge=bridge),
44+ E.model(type='virtio'),
45+ type='bridge'),
46+ )
47
48 if log_console_output:
49 print(
50@@ -333,7 +335,7 @@
51
52 def create(hostname, filters, user_data_fobj, meta_data_fobj, memory=512,
53 cpu=1, disk=2, unsafe_caching=False, template_path=DEFAULT_TEMPLATE,
54- log_console_output=False, bridge=None, backing_image_file=None):
55+ log_console_output=False, bridge_list=None, backing_image_file=None):
56 if backing_image_file is None:
57 base_volume_name = get_base_image(filters)
58 undo_volume_creation = []
59@@ -359,7 +361,7 @@
60
61 xml = compose_domain_xml(
62 hostname, [main_vol, ds_vol],
63- bridge=bridge,
64+ bridge_list=bridge_list,
65 cpu=cpu,
66 log_console_output=log_console_output,
67 memory=memory,
68@@ -526,7 +528,7 @@
69 create(
70 args.hostname, args.filters, user_data_fobj, meta_data_fobj,
71 backing_image_file=abs_image_backing_file,
72- bridge=args.bridge,
73+ bridge_list=args.bridge,
74 cpu=args.cpu,
75 disk=args.disk,
76 log_console_output=args.log_console_output,
77@@ -658,7 +660,7 @@
78 create_subparser.add_argument('--memory', default=512, type=int)
79 create_subparser.add_argument('--cpu', default=1, type=int)
80 create_subparser.add_argument('--disk', default=8, type=int)
81- create_subparser.add_argument('--bridge')
82+ create_subparser.add_argument('--bridge', action='append')
83 create_subparser.add_argument('--unsafe-caching', action='store_true')
84 create_subparser.add_argument(
85 '--user-data', type=argparse.FileType('rb'))

Subscribers

People subscribed via source and target branches