mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-23 17:34:21 +03:00
virtinst: allow adding host character devices to LXC containers
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
This commit is contained in:
parent
bba3d04558
commit
a2a022a879
@ -1226,6 +1226,10 @@ PCI device (via lspci).
|
||||
|
||||
Network device (in LXC container).
|
||||
|
||||
=item B<--hostdev /dev/net/tun,type=misc>
|
||||
|
||||
Character device (in LXC container).
|
||||
|
||||
=back
|
||||
|
||||
Use --hostdev=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsHostDev>
|
||||
|
@ -48,5 +48,10 @@
|
||||
<interface>wlan0</interface>
|
||||
</source>
|
||||
</hostdev>
|
||||
<hostdev mode="capabilities" type="misc" managed="yes">
|
||||
<source>
|
||||
<char>/dev/net/tun</char>
|
||||
</source>
|
||||
</hostdev>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -51,5 +51,10 @@
|
||||
<interface>eth0</interface>
|
||||
</source>
|
||||
</hostdev>
|
||||
<hostdev mode="capabilities" type="misc" managed="yes">
|
||||
<source>
|
||||
<char>/dev/null</char>
|
||||
</source>
|
||||
</hostdev>
|
||||
</devices>
|
||||
</domain>
|
||||
|
@ -696,6 +696,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
dev3 = guest.devices.hostdev[2]
|
||||
dev4 = guest.devices.hostdev[3]
|
||||
dev5 = guest.devices.hostdev[4]
|
||||
dev6 = guest.devices.hostdev[5]
|
||||
|
||||
check = self._make_checker(dev1)
|
||||
check("type", "usb", "foo", "usb")
|
||||
@ -734,6 +735,10 @@ class XMLParseTest(unittest.TestCase):
|
||||
check = self._make_checker(dev5)
|
||||
check("type", "net")
|
||||
check("net_interface", "wlan0", "eth0")
|
||||
|
||||
check = self._make_checker(dev6)
|
||||
check("type", "misc")
|
||||
check("misc_char", "/dev/net/tun", "/dev/null")
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
|
||||
def testAlterWatchdogs(self):
|
||||
|
@ -2782,6 +2782,9 @@ class ParserHostdev(VirtCLIParser):
|
||||
if inst.type == "net":
|
||||
inst.mode = "capabilities"
|
||||
inst.net_interface = val
|
||||
elif inst.type == "misc":
|
||||
inst.mode = "capabilities"
|
||||
inst.misc_char = val
|
||||
else:
|
||||
val = NodeDevice.lookupNodedevFromString(inst.conn, val)
|
||||
inst.set_from_nodedev(val)
|
||||
|
@ -135,3 +135,6 @@ class DeviceHostdev(Device):
|
||||
|
||||
# type=net handling
|
||||
net_interface = XMLProperty("./source/interface")
|
||||
|
||||
# type=misc handling
|
||||
misc_char = XMLProperty("./source/char")
|
||||
|
Loading…
Reference in New Issue
Block a user