[ovirt-users] Re: cloud-init reverting static network settings to DHCP on shutdown and restart
Hi, we made this solution for us: We add a cloud-init script to the cloud image, before we add this to our templates. In /etc/cloud/cloud.cfg.d/, we create a file 98_runcmd.cfg with the following content: write_files: - content: | network: {config: disabled} path: /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg permissions: '0700' - content: | #!/bin/bash rm /etc/cloud/cloud.cfg.d/90_dpkg.cfg path: /var/lib/cloud/scripts/per-boot/datasources.sh permissions: '0700' This should create the file /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg after first cloud-init run and then network config is never touched again. Without disabling cloud-init completely, you are able for example to set a root password to login into VM console, when you have to debug something and can't login anymore to ssh. We have password logins disabled by default over ssh. We also remove /etc/cloud/cloud.cfg.d/90_dpkg.cfg and set datasource_list to ["NoCloud", "ConfigDrive"] in /etc/cloud/cloud.cfg -> VM will reboot with this a way faster. Without it, cloud-init will look for too much different location to find a valid config. LG Florian Von: "Eitan Raviv" An: "Ryan McCabe" CC: "users" , "geoff carr" Gesendet: Mittwoch, 20. Juni 2018 08:20:54 Betreff: [ovirt-users] Re: cloud-init reverting static network settings to DHCP on shutdown and restart Hi Ryan, This behaviour reproduces for me as well with ovirt-engine-latest-nightly-snapshot, cloud-init-0.7.9-24.el7.x86_64, Centos-7.4.1708 VM. Can you comment? Thanks On Thu, Jun 7, 2018 at 10:45 AM, Luca 'remix_tj' Lorenzetto < [ mailto:lorenzetto.l...@gmail.com | lorenzetto.l...@gmail.com ] > wrote: Hello Geoff, On Wed, Jun 6, 2018 at 9:14 PM, < [ mailto:geoff.c...@beazley.com | geoff.c...@beazley.com ] > wrote: > I think that before a shutdown / restart the cloud-init configuration is > attached as there is /dev/sr1 visible. On shutdown / restart the config is no > longer attached and there is seemingly an error related to not being able to > find the data source: - > > 2018-06-06 15:15:11,297 - handlers.py[DEBUG]: finish: > init-network/search-NoCloudNet: SUCCESS: no network data found from > DataSourceNoCloudNet > 2018-06-06 15:15:11,298 - util.py[WARNING]: No instance datasource found! > Likely bad things to come! > 2018-06-06 15:15:11,298 - util.py[DEBUG]: No instance datasource found! > Likely bad things to come! > Traceback (most recent call last): > File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 236, in > main_init > init.fetch(existing=existing) > File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 343, in > fetch > return self._get_data_source(existing=existing) > File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 253, in > _get_data_source > pkg_list, self.reporter) > File "/usr/lib/python2.7/site-packages/cloudinit/sources/__init__.py", line > 320, in find_source > raise DataSourceNotFoundException(msg) > DataSourceNotFoundException: Did not find any data source, searched classes: > (DataSourceNoCloudNet) > 2018-06-06 15:15:11,302 - util.py[DEBUG]: Reading from > /sys/class/net/eth0/carrier (quiet=False) > 2018-06-06 15:15:11,303 - util.py[DEBUG]: Read 2 bytes from > /sys/class/net/eth0/carrier > 2018-06-06 15:15:11,303 - util.py[DEBUG]: Reading from > /sys/class/net/eth0/address (quiet=False) > 2018-06-06 15:15:11,303 - util.py[DEBUG]: Read 18 bytes from > /sys/class/net/eth0/address > 2018-06-06 15:15:11,303 - stages.py[DEBUG]: applying net config names for > {'version': 1, 'config': [{'subnets': [{'type': 'dhcp'}], 'type': 'physical', > 'name': 'eth0', 'mac_address': '00:1a:4a:16:01:05'}]} I have the same issue since some months. Since cloud-init doesn't sees any configuration, applies the default, which is to use dhcp. I don't remember if it is a bug of cloud-init or a misconfiguration, but now i solved removing cloud-init package after the first boot. In case you want redeploying, you can keep cloud-init and disable its work by disabling the service: touch /etc/cloud/cloud-init.disabled Luca -- "E' assurdo impiegare gli uomini di intelligenza eccellente per fare calcoli che potrebbero essere affidati a chiunque se si usassero delle macchine" Gottfried Wilhelm von Leibnitz, Filosofo e Matematico (1646-1716) "Internet è la più grande biblioteca del mondo. Ma il problema è che i libri sono tutti sparsi sul pavimento" John Allen Paulos, Matematico (1945-vivente) Luca 'remix_tj' Lorenzetto, [ http://www.remixtj.net/ | http://www.remixtj.net ] , < [ mailto:lorenzetto.l...@gmail.com | lorenzetto.l...@gmail.com ] > ___ Users mailing list -- [ mailto:users@ovirt.org | users@ovirt.org ] To unsubscribe send an email to [ mailto:users-le...@ovirt.org | users-le...@ovirt.org ] Privacy Statement: [ https://www.ovirt.org/site/privacy-policy/ |
[ovirt-users] Re: cloud-init reverting static network settings to DHCP on shutdown and restart
Hello Geoff, On Wed, Jun 6, 2018 at 9:14 PM, wrote: > I think that before a shutdown / restart the cloud-init configuration is > attached as there is /dev/sr1 visible. On shutdown / restart the config is no > longer attached and there is seemingly an error related to not being able to > find the data source: - > > 2018-06-06 15:15:11,297 - handlers.py[DEBUG]: finish: > init-network/search-NoCloudNet: SUCCESS: no network data found from > DataSourceNoCloudNet > 2018-06-06 15:15:11,298 - util.py[WARNING]: No instance datasource found! > Likely bad things to come! > 2018-06-06 15:15:11,298 - util.py[DEBUG]: No instance datasource found! > Likely bad things to come! > Traceback (most recent call last): > File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 236, in > main_init > init.fetch(existing=existing) > File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 343, in > fetch > return self._get_data_source(existing=existing) > File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 253, in > _get_data_source > pkg_list, self.reporter) > File "/usr/lib/python2.7/site-packages/cloudinit/sources/__init__.py", line > 320, in find_source > raise DataSourceNotFoundException(msg) > DataSourceNotFoundException: Did not find any data source, searched classes: > (DataSourceNoCloudNet) > 2018-06-06 15:15:11,302 - util.py[DEBUG]: Reading from > /sys/class/net/eth0/carrier (quiet=False) > 2018-06-06 15:15:11,303 - util.py[DEBUG]: Read 2 bytes from > /sys/class/net/eth0/carrier > 2018-06-06 15:15:11,303 - util.py[DEBUG]: Reading from > /sys/class/net/eth0/address (quiet=False) > 2018-06-06 15:15:11,303 - util.py[DEBUG]: Read 18 bytes from > /sys/class/net/eth0/address > 2018-06-06 15:15:11,303 - stages.py[DEBUG]: applying net config names for > {'version': 1, 'config': [{'subnets': [{'type': 'dhcp'}], 'type': 'physical', > 'name': 'eth0', 'mac_address': '00:1a:4a:16:01:05'}]} I have the same issue since some months. Since cloud-init doesn't sees any configuration, applies the default, which is to use dhcp. I don't remember if it is a bug of cloud-init or a misconfiguration, but now i solved removing cloud-init package after the first boot. In case you want redeploying, you can keep cloud-init and disable its work by disabling the service: touch /etc/cloud/cloud-init.disabled Luca -- "E' assurdo impiegare gli uomini di intelligenza eccellente per fare calcoli che potrebbero essere affidati a chiunque se si usassero delle macchine" Gottfried Wilhelm von Leibnitz, Filosofo e Matematico (1646-1716) "Internet è la più grande biblioteca del mondo. Ma il problema è che i libri sono tutti sparsi sul pavimento" John Allen Paulos, Matematico (1945-vivente) Luca 'remix_tj' Lorenzetto, http://www.remixtj.net , ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/site/privacy-policy/ oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/7BCX7R4XVUVLOWTKNC5HHUOCQ4NTAB2L/
[ovirt-users] Re: cloud-init reverting static network settings to DHCP on shutdown and restart
I think that before a shutdown / restart the cloud-init configuration is attached as there is /dev/sr1 visible. On shutdown / restart the config is no longer attached and there is seemingly an error related to not being able to find the data source: - 2018-06-06 15:15:11,297 - handlers.py[DEBUG]: finish: init-network/search-NoCloudNet: SUCCESS: no network data found from DataSourceNoCloudNet 2018-06-06 15:15:11,298 - util.py[WARNING]: No instance datasource found! Likely bad things to come! 2018-06-06 15:15:11,298 - util.py[DEBUG]: No instance datasource found! Likely bad things to come! Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 236, in main_init init.fetch(existing=existing) File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 343, in fetch return self._get_data_source(existing=existing) File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 253, in _get_data_source pkg_list, self.reporter) File "/usr/lib/python2.7/site-packages/cloudinit/sources/__init__.py", line 320, in find_source raise DataSourceNotFoundException(msg) DataSourceNotFoundException: Did not find any data source, searched classes: (DataSourceNoCloudNet) 2018-06-06 15:15:11,302 - util.py[DEBUG]: Reading from /sys/class/net/eth0/carrier (quiet=False) 2018-06-06 15:15:11,303 - util.py[DEBUG]: Read 2 bytes from /sys/class/net/eth0/carrier 2018-06-06 15:15:11,303 - util.py[DEBUG]: Reading from /sys/class/net/eth0/address (quiet=False) 2018-06-06 15:15:11,303 - util.py[DEBUG]: Read 18 bytes from /sys/class/net/eth0/address 2018-06-06 15:15:11,303 - stages.py[DEBUG]: applying net config names for {'version': 1, 'config': [{'subnets': [{'type': 'dhcp'}], 'type': 'physical', 'name': 'eth0', 'mac_address': '00:1a:4a:16:01:05'}]} ___ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-le...@ovirt.org Privacy Statement: https://www.ovirt.org/site/privacy-policy/ oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/4TXBGJ7WYAANWQJG3KCCK3O4SAETSHA5/