Bug 1495441 - add vm with cloud init config: IPv6 boot protocol initialized with user input of IPv4 boot protocol
Summary: add vm with cloud init config: IPv6 boot protocol initialized with user input...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: future
Hardware: All
OS: All
medium
medium
Target Milestone: ovirt-4.2.0
: ---
Assignee: eraviv
QA Contact: Petr Matyáš
URL:
Whiteboard:
Depends On: 1492726 1512530 1539760
Blocks: 1519271
TreeView+ depends on / blocked
 
Reported: 2017-09-26 04:32 UTC by eraviv
Modified: 2018-02-16 11:44 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Under certain circumstances, the cloud-init service incorrectly provided IPv4 configuration to the IPv6 boot protocol of a newly created virtual machine. As a consequence, the guest experienced a variety of network problems. With this update, cloud-init provides the appropriate IPv6 configuration.
Clone Of:
: 1519271 (view as bug list)
Environment:
Last Closed: 2018-02-12 10:11:34 UTC
oVirt Team: Network
Embargoed:
rule-engine: ovirt-4.2+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 82208 0 master MERGED restapi: IPv6 boot protocol is assigned the value of IPv4 boot protocol 2020-07-21 09:45:17 UTC

Description eraviv 2017-09-26 04:32:53 UTC
Description of problem:
when user input is mapped to a network configuration during addition of a vm, the input for IPv4 boot protocol is inserted into the the IPv6 boot protocol entry

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


How reproducible:
100%

Steps to Reproduce:
1.add new vm with cloud init
2.select IPv4 static and IPv6 dhcp boot protocols
3.lookup the entries in the db or start the vm: IPv6 boot protocol will be static

Actual results:
IPv6 boot protocol gets the configuration of the IPv4 boot protocol

Expected results:
IPv6 boot protocol gets the configuration of the IPv6 boot protocol

Additional info:

Comment 1 Juan Hernández 2017-09-26 08:07:25 UTC
Does this happen with the API? If so please provide an example of the API requests that you are sending.

Comment 2 Yaniv Kaul 2017-10-15 13:26:21 UTC
Are there additional patches needed here, or can this bug move to MODIFIED state?

Comment 3 eraviv 2017-11-12 07:05:32 UTC
No additional devel work is expected.

Comment 4 Petr Matyáš 2017-11-13 13:18:27 UTC
Testing on 4.2.0-0.0.master.20171112130303.git8bc889c.el7.centos

Running cmd:
curl -v -u "$user@$domain:$password" -H "Content-type: application/xml" --insecure -X POST https://$engine/ovirt-engine/api/vms/$vm_id/start -d "<action><use_cloud_init>true</use_cloud_init><vm><initialization><nic_configurations><nic_configuration><name>ahoj</name><on_boot>true</on_boot><boot_protocol>static</boot_protocol><ip><address>$address</address><gateway>$gateway</gateway><netmask>$netmask</netmask><version>v4</version></ip><ipv6_boot_protocol>dhcp</ipv6_boot_protocol></nic_configuration></nic_configurations></initialization></vm></action>"

results in new interface having bootproto=dhcp for ipv4 address (and ipv6 is not mentioned anywhere in that new interface)

same happens with values entered from UI, so most likely there is an underlying bug in cloud-init

Comment 5 Dan Kenigsberg 2017-11-13 14:58:41 UTC
> so most likely there is an underlying bug in cloud-init

you're probably seeing bug 1492726. Please install cloud-init-0.7.9-14.el7 in or downgrade to rhel-7.3.z version of cloud-init to verify the ovirt bug.

Comment 6 Petr Matyáš 2017-11-16 14:08:12 UTC
I have the same results as in comment#4 with cloud-init-0.7.9-14.el7.x86_64

Comment 8 eraviv 2017-11-20 05:36:14 UTC
The above test does not test ovrit-engine but rather how cloud-init interprets engine network configuration.

This bug fixes a problem in the engine which used to put ipv4 params into ipv6 config, in the engine network configuration file (which is then consumed by cloud-init).

Please test the engine raw output of the network config: on the host holding the vm, mount the image and look at the contents of the engine config file to cloud-init:

mount /var/run/vdsm/payload/<image id> /mnt
/mnt/openstack/latest/network_data.json

with the cloud-init config that was posted to the engine above this file would be:

A. before the fix:
{
  "links" : [ {
    ...
  }, {
    "link" : "ahoj",
    "id" : "ahoj",
    "type" : "ipv4"
  } ]
}

B. after the fix:
{
  "links" : [ {
    ...
  }, {
    "link" : "ahoj",
    "id" : "ahoj",
    "type" : "dhcp6"
  } ]
}

Comment 9 eraviv 2017-11-20 06:32:02 UTC
I believe that what you have seen is a cloud-init bug, which seems to ignore the IPv6 settings if IPv4 settings are present.

To verify this specific bug, you could keep IPv4 unset. However, what you report is most important - please file a cloud-init bug about it and make it block this bug.

Comment 10 eraviv 2017-11-20 06:52:03 UTC
Hi Ryan,
During the verification of this bug we came across the following:
ovirt-engine sends the following network_data.json to cloud-init:

{
  "links" : [ {
    "name" : "ahoj",
    "id" : "ahoj",
    "type" : "vif"
  } ],
  "networks" : [ {
    "netmask" : "255.255.255.0",
    "link" : "ahoj",
    "id" : "ahoj",
    "ip_address" : "192.168.122.201",
    "type" : "ipv4",
    "gateway" : "192.168.122.1"
  }, {
    "link" : "ahoj",
    "id" : "ahoj",
    "type" : "dhcp6"
  } ]
}

and cloud-init-0.7.9-14.el7.x86_64 creates the following ifcfg:

# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=dhcp
DEVICE=ahoj
GATEWAY=192.168.122.1
IPADDR=192.168.122.201
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no


is the network_data.json OK? is the ifcfg OK?

thanks

Comment 11 Ryan McCabe 2017-11-20 14:01:57 UTC
(In reply to eraviv from comment #10)
> Hi Ryan,
> During the verification of this bug we came across the following:
> ovirt-engine sends the following network_data.json to cloud-init:
> 
> {
>   "links" : [ {
>     "name" : "ahoj",
>     "id" : "ahoj",
>     "type" : "vif"
>   } ],
>   "networks" : [ {
>     "netmask" : "255.255.255.0",
>     "link" : "ahoj",
>     "id" : "ahoj",
>     "ip_address" : "192.168.122.201",
>     "type" : "ipv4",
>     "gateway" : "192.168.122.1"
>   }, {
>     "link" : "ahoj",
>     "id" : "ahoj",
>     "type" : "dhcp6"
>   } ]
> }
> 
> and cloud-init-0.7.9-14.el7.x86_64 creates the following ifcfg:
> 
> # Created by cloud-init on instance boot automatically, do not edit.
> #
> BOOTPROTO=dhcp
> DEVICE=ahoj
> GATEWAY=192.168.122.1
> IPADDR=192.168.122.201
> NETMASK=255.255.255.0
> ONBOOT=yes
> TYPE=Ethernet
> USERCTL=no
> 
> 
> is the network_data.json OK? is the ifcfg OK?
> 
> thanks

If the boot protocol is really supposed to be dhcp6, it looks like a bug in cloud-init that's also present in upstream's master git branch.

Comment 12 Ryan McCabe 2017-11-20 14:07:13 UTC
Is there a reason you want to use dhcpv6 with an ipv4-only host?

Comment 13 Ryan McCabe 2017-11-20 19:21:59 UTC
If this is something you need in cloud-init, please file a separate bz for it, and I'll try to get it fixed upstream. I have a small patch that fixes it that I'll propose there.

Comment 14 Dan Kenigsberg 2017-11-20 20:47:50 UTC
The intention here is to have to address on the "ahoj" link: a static ipv4 and a dhcp6-based ipv6. Ryan, is this something that is yet to be added to cloud-init?

Comment 15 Ryan McCabe 2017-11-20 21:48:43 UTC
(In reply to Dan Kenigsberg from comment #14)
> The intention here is to have to address on the "ahoj" link: a static ipv4
> and a dhcp6-based ipv6. Ryan, is this something that is yet to be added to
> cloud-init?

Ok, I see. It should support dual-stack hosts, but I don't have the ability to test it ATM. If I gave you a test package, would you be able to let me know if it works they way you intend?

Comment 16 eraviv 2017-11-21 01:45:13 UTC
(In reply to Ryan McCabe from comment #15)
> (In reply to Dan Kenigsberg from comment #14)
> > The intention here is to have to address on the "ahoj" link: a static ipv4
> > and a dhcp6-based ipv6. Ryan, is this something that is yet to be added to
> > cloud-init?
> 
> Ok, I see. It should support dual-stack hosts, but I don't have the ability
> to test it ATM. If I gave you a test package, would you be able to let me
> know if it works they way you intend?

yes we would gladly test it. thanks

Comment 17 Ryan McCabe 2017-11-21 15:07:48 UTC
Before I give you a test package, could you test which, if any, of these interface definition files (/etc/sysconfig/network-scripts/ifcfg-ahoj) does the right thing. I'm not sure of the syntax when you want static ipv4 and dhcp ipv6 on the same interface.

Not sure whether it should be:

BOOTPROTO=dhcp
DEFROUTE=yes
DEVICE=ahoj
DHCPV6C=yes
GATEWAY=192.168.122.1
IPADDR=192.168.122.201
IPV6INIT=yes
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no

or

BOOTPROTO=none
DEFROUTE=yes
DEVICE=ahoj
DHCPV6C=yes
GATEWAY=192.168.122.1
IPADDR=192.168.122.201
IPV6INIT=yes
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no

I think in the case of the former, you may get dhcp for ipv4, which you don't want. I'm not sure what will happen for v6 in the second, because I don't have a setup where I am able to test dhcpv6 right now.

Comment 18 Ryan McCabe 2017-11-21 15:07:50 UTC
Before I give you a test package, could you test which, if any, of these interface definition files (/etc/sysconfig/network-scripts/ifcfg-ahoj) does the right thing. I'm not sure of the syntax when you want static ipv4 and dhcp ipv6 on the same interface.

Not sure whether it should be:

BOOTPROTO=dhcp
DEFROUTE=yes
DEVICE=ahoj
DHCPV6C=yes
GATEWAY=192.168.122.1
IPADDR=192.168.122.201
IPV6INIT=yes
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no

or

BOOTPROTO=none
DEFROUTE=yes
DEVICE=ahoj
DHCPV6C=yes
GATEWAY=192.168.122.1
IPADDR=192.168.122.201
IPV6INIT=yes
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no

I think in the case of the former, you may get dhcp for ipv4, which you don't want. I'm not sure what will happen for v6 in the second, because I don't have a setup where I am able to test dhcpv6 right now.

Comment 19 eraviv 2017-11-26 06:36:00 UTC
Thomas,

Following the discussion above and Ryan's question, do you know which is the right sysconfig definition (see above) to enable a static ipv4 configuration alongside a dhcp ipv6 configuration on the same NIC?

Thanks

Comment 20 Thomas Haller 2017-11-27 09:29:31 UTC
BOOTPROTO=dhcp means to enable DHCPv4.
A static-only IPv4 setting should set BOOTPROTO=none (or omit BOOTPROTO).

Comment 21 Ryan McCabe 2017-11-27 18:22:40 UTC
Ok, thank you. It looks like we need two patches for this one. I've proposed one to fix the absence of ipv6 config upstream. We need a second patch to change the BOOTPROTO rendering, but that looks specific to RHEL (suse has different behavior here).

Comment 22 Ryan McCabe 2017-11-27 21:51:13 UTC
Apparently openstack is sending "ipv6_dhcp" and not "dhcp6" (and "ipv4_dhcp" for ipv4) in its network_data.json. Would it be possible to stay consistent with that behavior, or is it too late?

Comment 23 eraviv 2017-11-28 11:50:02 UTC
It's not too late but this format contradicts the protocol i see in http://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v2.html
(and also in version 1 of the above) which is the protocol we referred to in our latest fixes. In the open-stack configuration page (https://specs.openstack.org/openstack/nova-specs/specs/liberty/implemented/metadata-service-network-info.html) there is no mention of what they use according to my best understanding.

Let me know if you would like to leave the current protocol (dhcp4\dhcp6) or move to ipv4_dhcp\ipv6_dhcp

Maybe we should move this conversation to the cloud-init mailing list before deciding.

Thanks

Comment 24 Ryan McCabe 2017-11-28 14:13:00 UTC
That link is from the cloud-init yaml documentation. The network_data.json format is defined by openstack (nova I believe), and simply consumed by cloud-init. They're two different formats that cloud-init is able to use for network configuration.

It's hard to find full documentation of nova's network_data.json, but there's at least a mention of the dhcp6 stuff at: https://docs.openstack.org/releasenotes/nova/pike.html

I think the better route would be to would be to ask on the nova mailing list for the possible values.

Comment 25 Ryan McCabe 2017-11-28 14:16:46 UTC
There's this, too (see around line 271)

https://github.com/openstack/nova/blob/master/nova/virt/netutils.py

Comment 26 eraviv 2017-11-30 12:13:23 UTC
(In reply to Ryan McCabe from comment #25)
> There's this, too (see around line 271)
> 
> https://github.com/openstack/nova/blob/master/nova/virt/netutils.py

ok, we'll go along with the openstack "ipv6_dhcp" and "ipv4_dhcp". let me know when you have and rpm that we could test against.

Comment 27 Ryan McCabe 2017-11-30 14:09:11 UTC
I'm going to clone this against cloud-init to track the changes that need to be made there. I'll post a link to a test build there when I have one.

Comment 28 Petr Matyáš 2018-01-23 11:50:32 UTC
Verified on ovirt-engine-4.2.1.2-0.1.el7.noarch with cloud-init-0.7.9-22.el7.x86_64 on the VM

Comment 29 Sandro Bonazzola 2018-02-12 10:11:34 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


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