Bug 1248975 - cloud-init network interface alias not allowed
cloud-init network interface alias not allowed
Status: CLOSED CURRENTRELEASE
Product: ovirt-engine
Classification: oVirt
Component: Frontend.WebAdmin (Show other bugs)
---
All Linux
low Severity medium (vote)
: ovirt-3.6.0-rc
: 3.6.0
Assigned To: Martin Betak
Israel Pinto
:
Depends On: 1288819
Blocks:
  Show dependency treegraph
 
Reported: 2015-07-31 05:01 EDT by enax
Modified: 2016-02-23 04:01 EST (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-02-23 04:01:36 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Virt
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
rule-engine: ovirt‑3.6.0+
ylavi: planning_ack+
rule-engine: devel_ack+
mavital: testing_ack+


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 45037 master MERGED frontend: Allow ':' in VmInit network name Never
oVirt gerrit 45073 ovirt-engine-3.6 MERGED frontend: Allow ':' in VmInit network name Never

  None (edit)
Description enax 2015-07-31 05:01:50 EDT
Description of problem:
The cloud-init network interface field validation form looks like this:
"A-Za-z0-9_-"
So if I like to define a network interface alias, like "eth0:1" I can't,
however the cloud-init application handle it well.
Is there any reason why the ":" character need to be forbidden?

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Edit virtual machine
2. Go to initial run tab
3. Enable cloud-init/sysprep
4. Enable network
5. Add new
6. Name of the network interface > eth0:1
7. Boot Protocol > static

Actual results:
Invalid network intarface name

Expected results:
Create an interface alias

Additional info:
Comment 1 Jiri Belka 2015-09-16 12:04:38 EDT
UI looks ok, test inside guest OS in progress.

# ps aux | grep 'qemu.*vdcadmin' | grep --color -o -E '/var/run.*payload.*\.img'
/var/run/vdsm/payload/ac1cd7cc-4e21-419a-ac0a-bd46605a1e2e.c38ceb5f394eec348b871861d71063da.img

# losetup -a | tail -n1
/dev/loop1: [0018]:49456062 (/run/vdsm/payload/ac1cd7cc-4e21-419a-ac0a-bd46605a1e2e.c38ceb5f394eec348b871861d71063da.img)

# mount | grep loop1
/dev/loop1 on /mnt type iso9660 (ro,relatime)
# cat /mnt/openstack/latest/meta_data.json 
{
  "network-interfaces" : "iface  inet none\n  dns-nameservers 10.34.63.228\n  dns-search example.com\niface eth0 inet dhcp\n  dns-nameservers 10.34.63.228\n  dns-search example.com\nauto eth0:1\niface eth0:1 inet static\n  address 172.16.0.1\n  netmask 255.255.255.0\n  dns-nameservers 10.34.63.228\n  dns-search example.com\n",
  "availability_zone" : "nova",
  "hostname" : "foobar",
  "launch_index" : "0",
  "meta" : {
    "role" : "server",
    "dsmode" : "local",
    "essential" : "false"
  },
  "name" : "foobar",
  "network_config" : {
    "path" : "/etc/network/interfaces",
    "content_path" : "/content/0000"
  },
  "uuid" : "d4e6920a-9a1e-4b64-b813-f23d2fd820e1"
}
Comment 2 Israel Pinto 2015-12-08 11:44:36 EST
Verify the fix, 

Scenario:
1. Create VM from rhel guest image template (includes cloud init rpm)
2. Edit cloud init Network: 
   Add new Nic named: eth1:1, static protocol.
2. Add 2 nics to VM: First for the template and second for the additional nic 
   named eth1
3. Start VM

Results:
On VM guest running the command 'ip a' / 'ifconfig' i see that the alias is not set, but the nic file under /etc/sysconfig/network-scripts/ is ifcg-eth1:1
 

Is this the expect results?
I think it should also appear in command 'ip a' / 'ifconfig'
Comment 3 Israel Pinto 2015-12-08 11:46:16 EST
The payload is:
[root@virt-nested-vm13 latest]# cat meta_data.json 
{
  "network-interfaces" : "auto eth1:1\niface eth1:1 inet static\n  address 192.168.1.11\n  netmask 255.255.255.0\n  gateway 192.168.1.1\n",
  "availability_zone" : "nova",
  "hostname" : "test1",
  "launch_index" : "0",
  "meta" : {
    "role" : "server",
    "dsmode" : "local",
    "essential" : "false"
  },
  "name" : "test1",
  "network_config" : {
    "path" : "/etc/network/interfaces",
    "content_path" : "/content/0000"
  },
  "uuid" : "c92c9baf-f2cc-4684-9d2c-088620782cd5"
}[root@virt-nested-vm13 latest]#
Comment 4 Jiri Belka 2015-12-21 11:39:22 EST
(In reply to Israel Pinto from comment #2)
> Verify the fix, 
> 
> Scenario:
> 1. Create VM from rhel guest image template (includes cloud init rpm)
> 2. Edit cloud init Network: 
>    Add new Nic named: eth1:1, static protocol.
> 2. Add 2 nics to VM: First for the template and second for the additional
> nic 
>    named eth1
> 3. Start VM
> 
> Results:
> On VM guest running the command 'ip a' / 'ifconfig' i see that the alias is
> not set, but the nic file under /etc/sysconfig/network-scripts/ is
> ifcg-eth1:1
>  
> 
> Is this the expect results?
> I think it should also appear in command 'ip a' / 'ifconfig'

Yes, check on OS if ip alias is present. (ifconfig uses old naming - $iface:X, while ip command will show ip aliases in same device).

Example:

[root@str-02 3.6]# ifconfig bond0
bond0     Link encap:Ethernet  HWaddr E4:1F:13:69:12:B0  
          inet addr:10.34.63.204  Bcast:10.34.63.255  Mask:255.255.252.0
          inet6 addr: fe80::e61f:13ff:fe69:12b0/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:6350912254 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24009765702 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:2471444466525 (2.2 TiB)  TX bytes:35225722299944 (32.0 TiB)

[root@str-02 3.6]# ifconfig bond0:0
bond0:0   Link encap:Ethernet  HWaddr E4:1F:13:69:12:B0  
          inet addr:10.34.63.228  Bcast:10.34.63.255  Mask:255.255.252.0
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1

[root@str-02 3.6]# ip a s dev bond0
5: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
    link/ether e4:1f:13:69:12:b0 brd ff:ff:ff:ff:ff:ff
    inet 10.34.63.204/22 brd 10.34.63.255 scope global bond0
    inet 10.34.63.228/22 brd 10.34.63.255 scope global secondary bond0:0
    inet6 fe80::e61f:13ff:fe69:12b0/64 scope link tentative dadfailed 
       valid_lft forever preferred_lft forever
Comment 5 Israel Pinto 2016-02-22 09:40:48 EST
Verify the fix, 

Scenario:
1. Create VM from rhel guest image template (includes cloud init rpm)
2. Edit cloud init Network: 
   Add new Nic named: eth1:1, static protocol.
2. Add 2 nics to VM: First for the template and second for the additional nic 
   named eth1
3. Start VM

Results:
I can see the new Nic with alias.
Output:
# ifconfig eth1:0
eth1:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:1a:4a:16:01:59  txqueuelen 1000  (Ethernet)
# ll /etc/sysconfig/network-scripts/ifcfg-eth1\:0 
-rw-r--r--. 1 root root 173 Feb 22 08:48 /etc/sysconfig/network-scripts/ifcfg-eth1:0
# cat /etc/sysconfig/network-scripts/ifcfg-eth1\:0 
# Created by cloud-init v. 0.7.6 on Mon, 22 Feb 2016 13:48:50 +0000
NETMASK=255.255.255.0
BOOTPROTO=static
DEVICE=eth1:0
IPADDR=192.168.1.1
GATEWAY=192.168.1.254
ONBOOT=yes

Note You need to log in before you can comment on or make changes to this bug.