/srv/irclogs.ubuntu.com/2020/06/01/#cloud-init.txt

meenaGood point10:49
meenai can't tell from the documentation a new network interface is considered10:50
meenafaa: i'd have to look at the code, and chances are, before i'm able to do that, someone more experienced with the project will have woken up10:51
faameena: thank, good news :)12:03
meenamy hour of laptop time has been wasted, and now i have to go and wake my daughter from her nap12:04
faathis is not an urgent problem, but I will be glad to any advice, because as far as I can see, now cloud-init does not have the ability to change the network configuration12:09
cjmm6Hi, I need help with latest cloud-init version. In machines that not needed or not works cloud-init, I use a systemd service (I cannot use boot parameters), that using a Before=cloud-init-local.service and some conditions, then write the file to disable cloud-init /etc/cloud/cloud-init.disable (or remove this file if need use cloud-init)13:11
cjmm6This works in previous versions of cloud-init13:11
cjmm6But in the last version not works because exists one previous task called "cloud-init-generator". Then, so i don't know how to make my systemd unit run before that task13:11
cjmm6My systemd unit is:13:13
cjmm6[Unit]13:13
cjmm6Description=Control cloud-init to enable or disable cloud-init dinamically at boot time13:13
cjmm6DefaultDependencies=no13:13
cjmm6After=systemd-remount-fs.service13:13
cjmm6Before=NetworkManager.service network.service network-pre.target13:13
cjmm6Before=shutdown.target sysinit.target13:13
cjmm6Before=cloud-config.service cloud-final.service cloud-init-local.service cloud-init.service cloud-config.target13:13
cjmm6Conflicts=shutdown.target13:13
cjmm6[Service]13:13
cjmm6Type=oneshot13:13
cjmm6ExecStart=/usr/local/bin/control-cloud-init.sh13:13
cjmm6RemainAfterExit=yes13:13
cjmm6TimeoutSec=013:13
cjmm6# Output needs to appear in instance console output13:13
smosercjmm6: you wont really be able to reliably run before a generator13:50
smoserat least not with a systemd unit13:50
smoseryou can disable the generator and then you'll get cloud-init behavior like before.13:54
smoserunfortunatlye "fully disabled" isn't really possible without the generator.  cloud-init will still run through all its stages and use the 'none' datasource.13:55
Odd_BlokeThe generator doesn't do much to the system, either, so it probably isn't the end of the world if it runs and then your custom unit disables all the cloud-init units that it just added to the boot graph.14:26
cjmm6disable is as follows?14:32
cjmm6ln -sf /dev/null /etc/systemd/system-generator/cloud-init-generator14:32
cjmm6because early systemd cannot use systemctl14:32
cjmm6and how to reenable generator without systemctl?14:33
Odd_BlokeThe generator runs before any units run, so you won't be able to disable the generator using a unit.14:37
Odd_BlokeAnd I was going to say that you should be able to disable the units in your own unit, but that may be too late for systemd to pick up the change.14:38
Odd_BlokeHmm.14:39
cjmm6I cannot try to disable all cloud-init units14:41
cjmm6error!14:41
Odd_Blokecjmm6: How do you get the systemd unit onto these systems?14:42
cjmm6i haven't tried disabling the unit systemd of cloud-init, i will test it if it works14:42
Odd_Blokecjmm6: Sorry, I meant how do you get the systemd service which was working with older versions of cloud-init onto the system?14:43
cjmm6Its because I use a VM image compatible with multiple environment systems.14:43
Odd_BlokeRight, so the conditions in the unit are used to determine enable/disable based on where you're booting?14:44
cjmm6Yes! Dinamically14:44
cjmm6Then, I use one unique VM image for multiple systems14:45
cjmm6https://github.com/cesarjorgemartinez/automate-virtual-machine-linux-images/tree/master/CentOS7Minimal14:45
cjmm6Until this challenge (Ubuntu):14:46
cjmm6https://github.com/cesarjorgemartinez/automate-virtual-machine-linux-images/tree/master/Ubuntu20Minimal14:46
smoserhttps://github.com/cesarjorgemartinez/automate-virtual-machine-linux-images/blob/master/Ubuntu20Minimal/files/control-cloud-init.sh14:47
smoseris that what is controlling cloud-init ?14:47
smoserit looks to me that you enable cloud-init on kvm and aws. and disable elsewhere.14:48
Odd_Blokecjmm6: OK, so one thing you could potentially do is configure cloud-init to only consider the data sources that will present on KVM and EC2.  The generator should then disable cloud-init when it fails to find those datasources.14:48
Odd_Blokes/find/detect the applicability of/14:48
smoserbut in reality... cloud-init really should do all the right things.14:48
smoseri'im surprised if it ever enables itself in a scenario where you think it should not run14:49
smoseror even disables itself where you think it should14:49
cjmm6Not ...  cloud-init really should do all the right things... In many systems it is even harmful14:51
smoserlike ?14:51
cjmm6Then, if you can test, Centos7 and 8 works correctly because not use the last cloud-init14:51
smoserthe intent of the generator is to enable cloud-init when there is a "datasource". and do nothing otherwise.14:52
smoseri'm sorry, i didn't follow.14:52
cjmm6Centos 7 => cloud-init-18.5-3.el7.centos.x86_6414:53
smoseri agree that cloud-init was very annoying in the past.14:53
smoserwithout the generator, when it ran and chose the "None" datasource, it would have undesireable side effects.14:53
cjmm6ubuntu 20 => 20.114:53
smoserbut the generator was intended to *fix* those.14:53
smosercan you actually provide examples when it ran and you think it should not have ran ?14:54
cjmm6ad-hoc environments, or cloud-init not supported14:54
cjmm6+ using compatible VMs between environments, as the purpose of this projet14:55
cjmm6"boot one image in multiple envs"14:56
smosercan you provide a 'cloud-init collect-logs' from any of those environments ?14:56
cjmm6without changes14:56
smoserubuntu cloud images are "one image" that boots in multiple envs14:57
smoserand all "just work" (and if they do not, then feel free to file bugs)14:57
smoseri'm not trying to be rude.  we want to make this work, but we've intended to solve the problem that you're having with the generator14:57
smoserso we want to fix the generator if it is not behaving correctly14:57
smoserrather than make users like yourself have to write scripts to do the right thing.14:58
smosercjmm6: ^15:00
smoserOdd_Bloke's suggesting of configuring the datasource_list should also work.  but the goal you're after of "one image" is already a design goal of the project.15:02
cjmm6but need one thing to disable, always... Only works in my test, if, when the VM is booted, enter to ssh and create /etc/cloud/cloud-init.disable, and second reboot15:04
smoseri dont understand.  "but need one thing to disable, always"15:06
smoserin some scenarios you want to stop cloud-init from running ?15:07
smoserwhat are those scenarios?15:07
cjmm6yes, in adhoc envs, when no need to change nothing. New envs without already cloud-init support, etc.15:08
cjmm6Situations that, exists a big bug with difficult solution, or the Operating Systems not update the cloud-init for their own reasons...15:10
smoserso how do you determine that this is such an environment?15:24
smoseras you seem to know, you can disable cloud-init always by touching /etc/cloud/cloud-init.disabled.15:27
rharpercjmm6: a couple of comments;  the image build process (https://github.com/cesarjorgemartinez/automate-virtual-machine-linux-images/blob/master/Ubuntu20Minimal/postscripts/post-stage-1.sh)  does a lot of work cleaning up the image due to the image being booted in the first place via packer;  you may want to look at using something like mount-image-callback (in Ubuntu's cloud-image-utils package) to allow you to mount the image without booting so you15:37
rharpercan add your various changes (injecting scripts and programs and updating defaults in the image);    second, for Centos 7/8 cloud-init, RedHat merges features/fixes from master; so while 18.5 is "old" the core capabilities around dynamically enabling/disabling cloud-init (via ds-identify);   third; I suspect that the cloud-init control script is not needed; the cloud-init generator using the ds-identify code (/usr/lib/cloud-init/ds-identify, writes15:37
rharperoutput to /run/cloud-init/* ) one can examine that to see why cloud-init gets enabled or not;  If you have a scenario where cloud-init ran when you did not want it to; or the reverse; capturing /run/cloud-init/* contents into a bug will let us help sort out if it's expected behavior or if there is a bug15:37
Odd_Blokesmoser: Can you still disable cloud-init by touching that file after the generator has run?16:09
smoserOdd_Bloke: well it wont next time16:14
smoserbut the ship has almost certainly sailed when you touch it otherwise.16:14
meenaanyone here seen / answered faa's problem of adding another network interface?16:21
rharpermeena: faa: by default, adding a nic won't trigger any update to existing network configuration rendered;  so that's expected behavior.    the instance-id is set by the meta-data in the NoCloud datasource;  changing the instance-id will boot like a new instance;16:23
rharper If you've added a nic, and you know what an updated network-config (v1) format should look like, you can use 'cloud-init devel net-convert'  to render a specific distro/renderer output; and then copy that to where you need ;  Long term, as we land support in Datasources for refreshing metadata and handling hotplug, https://github.com/canonical/cloud-init/pull/47  ;  I could see NoCloud (configured with an HTTP end-point instead of local files) could16:28
rharperrefresh (fetch metadata) on hotplug of nic.16:28
Odd_Blokeblackboxsw: rharper: Could one of you look over my proposed changes to https://github.com/canonical/cloud-init/pull/358, please?  They're minor, but as mruffell is out this week, I'd like at least one other person to check them before I land them.16:56
rharperOdd_Bloke: sure16:56
Odd_BlokeThanks!16:57
meenarharper: you set pr has gone staleā€¦17:38
rharperyes, it's still valid, just needs a refresh and push17:39
smoserrcj or maybe Odd_Bloke , or maybe one of the microsoft people here...18:29
smoserit was my impression in the past that when Ubuntu images were uploaded, that the upload was done with sparseness in-tact18:30
smoserbut then that the copy from region to region did not maintain that sparseness.18:30
smoserit seems that a feature went into some tools https://github.com/Azure/azure-cli/issues/1150918:31
smoserlate in 2019 that may make my knowledge obsolete.18:31
Odd_BlokeI believe we addressed that a while ago; I remember pairing with SteveZ (of Azure) to fix it at a F2F a few years back.18:32
smoserMy question then... Do infrastructure (user->user or region->region) copies inside azure now retain sparseness ?18:32
smosermy current employer is in a similar situation where we publish sparse images, but then use of those images was believed to entail non-sparse copies.18:34
smoseri'd love to have some link to doc that says otherwise, or link to a nice manual that I could RTFM.18:34
Odd_BlokeThe image copy/replication happens on the backend for Ubuntu image publication (kicked off via private APIs), so I don't know if knowledge from Ubuntu publication will transfer over to a third-party image publication flow.18:34
Odd_Bloke(We are categorically different from images uploaded by users.)18:35
smoserhm... yeah.18:36
smoserso what i'm after is18:36
smosera.) we publish an image (we do this i think as well as we can, using sparseness)18:36
smoserb.) user launches that image or imports it into their account18:36
smoseri'm not actually sure how they do that, but if its "click click" or otherwise somehow underlying infrastructure, then i'd certainly hope it was sparse.  and if it is *not* click click, then i'd like to at least know how to tell someone that they can copy it the right way.18:38
smoserthanks Odd_Bloke18:38
smoseri'm disappointed that cjmm6 disappeared. i was honestly interested in his/her use case.18:39
smoserwell, if someone ms knowledgeable could reach out, i'd love to chat some.18:42
Odd_Blokerharper: I've updated https://github.com/canonical/cloud-init/pull/358, could you take another quick look pls?19:49
rharperOdd_Bloke: yes19:49
Odd_BlokeThanks!19:49
rharperOdd_Bloke: one more comment, I just left for you20:13
blackboxswfalcojr: lucasmoura if either of you get a chance. I've put up a basic SRU doc  from which we'll work to validate this cloudinit SRU https://github.com/cloud-init/ubuntu-sru/pull/97/files20:14
blackboxswit basically creates a bunchof  broken links which we will fill in as we verify each cloud or manual work it20:15
blackboxswwork *item*20:15
Odd_Blokerharper: And replied.20:18
rharperk20:21
blackboxswlucasmoura: falcojr rharper the much anticipated quilt patches for xenial https://github.com/canonical/cloud-init/pull/40620:46
blackboxswand procedure20:46
lucasmourablackboxsw, ack20:46
blackboxswI'll do basically the same for bionic and eoan now.20:46
blackboxswwithout the procedural steps20:46
rharperok20:56
blackboxswrharper: falcojr lucasmoura https://github.com/canonical/cloud-init/pull/407 bionic21:01
rharperthx21:02
Odd_Blokerharper: Updated, thanks again for the review!21:03
blackboxswand eoan https://github.com/canonical/cloud-init/pull/40921:08
Odd_Blokeblackboxsw: rharper: https://github.com/canonical/cloud-init/pull/358 just landed, so we can SRU away now, I think.21:56
blackboxswnice Odd_Bloke I don't mind doing another new-upstream-snapshot round22:34
blackboxswmight as well22:34

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!