Bug 683834

Summary: ifname in openvz container
Product: [Community] Virtualization Tools Reporter: knawnd
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: crobinso, xen-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-23 12:01:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description knawnd 2011-03-10 13:16:49 UTC
Description of problem:
It looks for me like there is no way to specify ethernet device name to be created inside the openvz container. At least I couldn't find such info at http://libvirt.org/formatdomain.html#elementsNICS.
If I do as below I get br0 as ethernet device inside VM whereas I'd like it to be eth0.

Version-Release number of selected component (if applicable):
ovzkernel release is 2.6.18-194.26.1.el5.028stab081.1, vzctl-3.0.26-1, OS is CentOS 5.5, libvirt/virsh version is 0.8.8, 

How reproducible:
$ cat ovz.xml
<domain type='openvz' id='144'>
  <name>144</name>
  <uuid>0071c128-58b4-4688-be17-1e062a22b36c</uuid>
  <vcpu>1</vcpu>
  <memory>524288</memory>
  <os>
    <type>exe</type>
    <init>/sbin/init</init>
  </os>
  <devices>
    <filesystem type='template'>
      <source name='centos-5-x86'/>
      <target dir='/'/>
    </filesystem>
    <interface type='bridge'>
      <source bridge='br0'/>
    </interface>
  </devices>
</domain>

$ virsh create ovz.xml
Domain 144 created from ovz.xml


Actual results:
$ grep -i netif /etc/vz/conf/144.conf
NETIF="ifname=br0,bridge=br0,mac=52:54:00:74:DD:F3,host_ifname=veth144.0,host_mac=52:54:00:06:78:76"


Expected results:
$ grep -i netif /etc/vz/conf/144.conf
NETIF="ifname=eth0,bridge=br0,mac=52:54:00:74:DD:F3,host_ifname=veth144.0,host_mac=52:54:00:06:78:76"


Additional info:
One of the possible reason of observing behaviour is the syntax of vzctl commands had been changed since 3.0.22 version as it's written at http://wiki.openvz.org/Veth#syntax_vzctl_version_.3E_3.0.22.

Comment 1 Cole Robinson 2016-03-23 12:01:10 UTC
commit 7a5ac8352073bd9babbec76d2ef74df7ab8e61eb
Author: Alvaro Polo <apoloval>
Date:   Tue Jun 4 09:44:32 2013 +0200

    Fix a invalid usage of virDomainNetDef in OpenVZ driver
    
    OpenVZ was accessing ethernet data to obtain the guest iface name
    regardless the domain is configured to use ethernet or bridged
    networking. This prevented the guest network interface to be rightly
    named for bridged networking.