Revision 89473be8 lib/hypervisor/hv_kvm.py
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
283 | 283 |
return result |
284 | 284 |
|
285 | 285 |
|
286 |
def _OpenTap(vnet_hdr=True): |
|
286 |
def _OpenTap(vnet_hdr=True, name=""):
|
|
287 | 287 |
"""Open a new tap device and return its file descriptor. |
288 | 288 |
|
289 | 289 |
This is intended to be used by a qemu-type hypervisor together with the -net |
... | ... | |
291 | 291 |
|
292 | 292 |
@type vnet_hdr: boolean |
293 | 293 |
@param vnet_hdr: Enable the VNET Header |
294 |
|
|
295 |
@type name: string |
|
296 |
@param name: name for the TAP interface being created; if an empty |
|
297 |
string is passed, the OS will generate a unique name |
|
298 |
|
|
294 | 299 |
@return: (ifname, tapfd) |
295 | 300 |
@rtype: tuple |
296 | 301 |
|
... | ... | |
306 | 311 |
flags |= IFF_VNET_HDR |
307 | 312 |
|
308 | 313 |
# The struct ifreq ioctl request (see netdevice(7)) |
309 |
ifr = struct.pack("16sh", "", flags)
|
|
314 |
ifr = struct.pack("16sh", name, flags)
|
|
310 | 315 |
|
311 | 316 |
try: |
312 | 317 |
res = fcntl.ioctl(tapfd, TUNSETIFF, ifr) |
Also available in: Unified diff