Bug 1040406

Summary: virt-manager miss privnet option in xml file when creating lxc guest using operating system container
Product: Red Hat Enterprise Linux 6 Reporter: tingting zheng <tzheng>
Component: virt-managerAssignee: virt-mgr-maint
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: acathrow, codong, dyuan, gscrivan, hyao, lcui, mzhan, zsong
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1074859 (view as bug list) Environment:
Last Closed: 2014-03-12 10:21:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1074859    

Description tingting zheng 2013-12-11 11:30:21 UTC
Description
virt-manager miss privnet option in xml file when creating lxc guest using operating system container

Refer to bug 1040311 comment 1:
If you are running a full operating system in LXC, you *must* have a private network namespace either by adding an <interface> or by requesting a new namespace with
  <features>
     <privnet/>
  </features>

Also privnet option from libvirt.org:
    Always create a private network namespace. This is automatically set if any interface devices are defined. This feature is only relevant for container based virtualization drivers, such as LXC. 

Version:
virt-manager-0.9.0-19.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. add the following yum repo
#vim /etc/yum.repos.d/yum-fedora.conf
[main]
cachedir=/var/cache/yum/$basearch/$releaseverkeepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3

[fedora]
name=Fedora $releasever - $basearch failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch

[updates]
name=Fedora $releasever - $basearch - Updates failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/$basearch/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
enabled=1
gpgcheck=1

2.#yum -y --nogpg --releasever=19 --config=/etc/yum.repos.d/yum-fedora.conf --installroot=/var/lib/libvirt/filesystems/f19x86_64 --disablerepo='*' --enablerepo=fedora  install  systemd passwd yum redhat-release vim-minimal openssh-server procps

3. #echo "pts/0" >> /var/lib/libvirt/filesystems/f19x86_64/etc/securetty

4. #vi /var/lib/libvirt/filesystems/f19x86_64/etc/pam.d/login
 commnent out the following lines
#session    required     pam_selinux.so close
#session    required     pam_loginuid.so

5.add root user and the passwd.
#chroot /var/lib/libvirt/filesystems/f19x86_64 /bin/passwd root

6.Launch virt-manager.

7.Click "Create a new virtual machine"

8.input vm name,select "Localhost(LXC)" in "Connetion"

9.select "operating system container" and click "Forward"

10.Browse to path of rootfs.fedora,in this case is /var/lib/libvirt/filesystems/f19x86_64

11.set Memory and cpu ,and click "Forward"

12.click "Advanced options", click "Finish"

13.Check the xml file of lxc guest,no privnet included in the xml file.
# virsh -c lxc:///  dumpxml test 
<domain type='lxc' id='19189'>
  <name>test</name>
  <uuid>f8d0a364-3e45-1acd-b43e-7b57ad7b02c2</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64'>exe</type>
    <init>/sbin/init</init>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/libvirt_lxc</emulator>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/var/lib/libvirt/filesystems/f19x86_64'/>
      <target dir='/'/>
    </filesystem>
    <interface type='network'>
      <mac address='00:16:3e:5f:25:06'/>
      <source network='default'/>
      <target dev='veth0'/>
    </interface>
    <console type='pty' tty='/dev/pts/1'>
      <source path='/dev/pts/1'/>
      <target type='lxc' port='0'/>
      <alias name='console0'/>
    </console>
  </devices>
  <seclabel type='none'/>
</domain>


Actual results:
As description.

Expected results:
Privnet option is included in xml when creating lxc guest with operating system container.

Additional info:

Comment 1 hyao@redhat.com 2014-01-06 07:43:41 UTC
The bug reproduced on the package by following the steps in the description. 
virt-manager-0.9.0-19.el6.x86_64

Comment 2 Giuseppe Scrivano 2014-03-12 10:21:07 UTC
this improvement is now upstream:

https://www.redhat.com/archives/virt-tools-list/2014-March/msg00032.html

I am going to close it as WONTFIX, as it is not worth of a back-port at this late stage.  Please re-open if you disagree with me or if it is affecting any user.