Merge lp:~tamura-yoshiaki/nova/bug-805312 into lp:~hudson-openstack/nova/trunk
Proposed by
Yoshiaki Tamura
Status: | Merged |
---|---|
Approved by: | Vish Ishaya |
Approved revision: | 1246 |
Merged at revision: | 1317 |
Proposed branch: | lp:~tamura-yoshiaki/nova/bug-805312 |
Merge into: | lp:~hudson-openstack/nova/trunk |
Diff against target: |
76 lines (+23/-7) 2 files modified
nova/virt/libvirt.xml.template (+5/-1) nova/virt/libvirt/connection.py (+18/-6) |
To merge this branch: | bzr merge lp:~tamura-yoshiaki/nova/bug-805312 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Christopher MacGown (community) | Approve | ||
Devin Carlen (community) | Approve | ||
Review via email: mp+66744@code.launchpad.net |
Commit message
Fix boot from volume failure for network block devices.
This patch looks up the device_path and swithes between 'block' and 'network' when creating libvirt.xml.
To post a comment you must log in.
This looks good but it looks like there is some logic is being duplicated:
35 + if vol['device_ path']. startswith( '/dev/' ): path']. split(' :') InvalidDevicePa th(path= vol['device_ path'])
36 + vol['type'] = 'block'
37 + elif ':' in vol['device_path']:
38 + (protocol, name) = vol['device_
39 + vol['type'] = 'network'
40 + vol['protocol'] = protocol
41 + vol['device_path'] = name
42 + else:
43 + raise exception.
There is very similar logic in the attach_volume method. I recommend fixing this so that there is no repetition. Maybe something like:
def _get_volume_ device_ type(self, device_path): path.startswith ('/dev/ '): InvalidDevicePa th(path= device_ path)
if device_
return 'block'
elif ':' in device_path:
return 'network'
else:
raise exception.
And then re-use that.