/srv/irclogs.ubuntu.com/2017/03/17/#cloud-init.txt

askbAre there any known issues reading shell env variables before executing a script from the user-data ?05:02
askbthe script is unable to read the updated $PATH from /etc/environment ?05:02
amaraoHello. Did anyone knows how to deal with random interfaces names? I'm trying to use cloud-init on baremetal instances, and there are many possible interface names (ens3, p4p1, e4s5, etc), and sometimes them just not 'up' for DHCP.10:34
=== shardy is now known as shardy_lunch
smoseramarao, hey.13:34
smoserso there are a couple ways to do this.13:34
amaraoHello.13:34
smoserone way is to change the random interface names off13:35
smoser https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/13:35
smoserthat gets you the old 'eth0' and the like.13:35
amaraoYes, that's one way I though. Is any cloud-init-like way to say 'use all interfaces available'?13:36
smoserthe bad thing about that is that .... it was changed for a reason.  nothing was ever really guaranteeing that nics would come up named correctly, and even the udev renaming code can fail13:36
smoserwhat do you want it to do ?13:36
amaraoTo have such image, which would be able to boot (get metadata) regardless of the name of interfaces.13:37
smosersome more background.. if cloud-init can find networking configuration from the "datasource" (the cloud provider ... whatever you want to call that), then it can use that and configure the system as described.13:37
smoserthis happens on openstack with config drive and in smartOS and in maas (there, more indirectly).13:37
amaraoYes, but if that datasource is openstack metadata, it needs dhcp...13:38
smoserso you are on openstack ?13:38
smoserironic ?13:38
amaraoIronic, to be precise.13:38
amaraoYep.13:38
smoserand not (ubuntu 12.04 precise) to be precise.13:39
amaraoAnd I found that 4 my lab servers each has different names for their interfaces...13:39
smoseri thought that at one point ironic deployment would provide a config drive or put the config drive data somehwere in the deployed sysstem.13:39
amaraoNah. I want to run Xenial, Jessie, Centos7, and, maybe, some suse.13:39
smoseris that not the case now?13:39
smoserhow is this "supposed" to work on ironic?13:40
amaraosmoser: Not exactly. There was a bug in ironic (until I report it) which prevented to usage of config drive with cloud init at all.13:40
smoserso, with a config drive, it should work.13:40
=== rangerpbzzzz is now known as rangerpb
amaraohttps://bugs.launchpad.net/ironic/+bug/165685413:41
smoser'unbound' means "not connected" ?13:41
amaraoI tried to use ConfigDrive, but it very unrelable. Older versions of cloud-init does not want to configure network from config drive. I was able to make it works with Xenial, but jessie is not good (cloud-init 0.7.6)13:42
smoseryeah, you're going to need newer cloud-init13:42
smosersorry, but that just is what it is.13:42
amaraoAnd centos7 has no newver version at all... (+ 30Mb of python dependencies which come with 0.7.6->0.7.7). So I'm falling back to dhcp...13:43
smoseramarao, thats a well written bug, thank you!13:43
smoserwhere do the 30M of python dependencies come from ?13:43
smoserprobably in a python2 -> python3 change i suspect13:43
smosercloud-init can still run in python213:44
smoserbut the packaging would have to be addressed to support that.13:44
smoseri realize thats a lot, and you just want it to work13:44
smoseramarao, so have you tried xenial with that unbound fix in place ?13:45
amaraoYep. For jessie I was able to use backports, (with 0.7.7), but with centos7 I feel very exhausted...13:45
smoseramarao, ^13:46
amaraosmoser: That bug (with 'unbound') is fixed now, and we has our fix in place (just replaces 'unbound' with 'physical' at metadata creation). I show it as illustration that 'ConfigDrive' is not an expected way for Ironic. When I asked guys at #ironic they said that it's unusual (to use CloudDrive).13:46
amaraoAnd there is one more problem. In ironic cloud drive is /dev/sda2 (partition at the end of the physical disk or raid array). And cloud-init docs says that CloudDrive should be whole disk, not partition.13:47
amarao"Must be a un-partitioned block device (/dev/vdb, not /dev/vdb1)" http://cloudinit.readthedocs.io/en/latest/topics/datasources/configdrive.html#version-213:47
smoseramarao, if it has a correct label (config-v2) then it probably will work13:49
amaraoI can't say this is Ironic bug, because there is no way to create 'whole disk' out of nothing in hardware environment. (And it worked as /dev/sda2 for Xenial, anyway). So it looks like bug in docs for cloud-init.13:49
smoserlet me check, and i'd fix that in cloud-init.13:49
amaraoShould I report it as a bug for cloud-init?13:50
smoseri'm pretty sure the doc is just wrong13:50
smoseramarao, have you tried?13:53
smoseramarao, i'm also interested in thoughts on how this realistically could work for bare metal without any locally provided information..13:53
smoserwhat would cloud-init be expected to do?13:53
smoserdhcp on all nics and attempt to load http://169.254.169.254/openstack on each one is going to be unreliable / timeout / racey13:54
=== shardy_lunch is now known as shardy
smoseri'm pretty sure reading current code that if the filesystem has a label of 'config-2', then it will work13:57
smoserie, does not have to be a full dis.13:57
smoserdisk13:57
amarao smoser It's a nice point about multiple DCHP....13:57
amaraoI'll report it as bug for cloud-init docs, I think.13:57
amaraoit == whole disk thing13:58
smoserwell,. please test and make sure i'm right or wrong :)13:58
smoseramarao, sorry to pester you... where do you get the ubuntu image / how do you make it ?14:01
amaraosmoser: I build it myself.14:05
smoserhow?14:05
amaraoHere the main part:       DIB_CLOUD_INIT_DATASOURCES: "ConfigDrive, OpenStack"14:05
amarao+ cloud-init-datasources element.14:06
smoserthere is some tool that you use i guess ?14:06
amaraodiskimage-builder mostly.14:06
amaraoPlus dibctl to manage it.14:06
amarao(The last one is self-made and under development at https://github.com/serverscom/dibctl)14:07
smoserwhat pops out of diskimage-builder ?14:07
smoserie, what is the file format of the image ?14:08
amaraoqcow image. baremetal-ubuntu-xenial.img.qcow214:08
smoserand its a full disk image ? partitioned with bootloader? ?14:08
amaraoIronic (with agent_ipmitool) write it to the baremetal node, and then writes a small ConfigDrive partition at the end (if nova boot used with --config-drive True).14:09
amaraoYes, it's a whole image with grub inside.14:09
amaraoElements: cache-url cloud-init-datasources dib-run-parts dpkg install-static package-installs ubuntu-minimal vm14:10
smoserso agent_ipmitool does a dd of that qcow image (converted to raw) to hopefully the bios boot disk.14:10
amaraoubuntu-minimal => debootstrap14:10
smoserand then it edits the partition table to add a partition at the end of the disk ?14:10
amaraoYes. It uses ipmitool to switch into PXE, and server is configured to use 1st disk to boot.14:10
amaraoI believe so, but I never looked into IPA (agent) code. But there is a /dev/sda2 inside instance with all metadata (including networking-data.json)14:11
amaraoUnfortunately networking-data.json is ignored by older cloud-inits :(14:11
amarao<0.7.714:11
smoseramarao, yes it is.14:20
amaraosmoser: thanks, I got confirmation. I'll try to use ConfigDrive before giving up. Jessie probably would work eventually, centos is harder to do. If not, I'll dance again around dhcp-for-everyone...14:22
smoseramarao, the cloud provider (ironic in this case) really needs to some how tell the system what the networking configuration is expected to be.14:36
smoseramarao, i'd be pretty interested in knowing how this "builder" script works14:40
amaraosmoser: ... and it's a real pain... Ironic now even does not support multiple switches (physical networks).14:40
smoserhttp://paste.ubuntu.com/24195576/ <--14:40
smoseri'd suspect htat has a fair chance of being something that could be used.14:41
amaraocloud-image-utils: /usr/bin/mount-image-callback14:42
smoser?14:42
amaraoI've just searched what is 'mount-image-callback'14:43
smoserah. yeah. its nice.  https://ubuntu-smoser.blogspot.com/2014/08/mount-image-callback-easily-modify.html?showComment=145326569007114:43
amaraosmoser, I have other question about cloud-init. If I boot instance with ConfigDrive and dhcp, it writes into interfaces.d/ that interface should be dhcp, not the ip from networking-data.json. Is this a bug, feature or  just coincidence?14:44
smoser"with configdrive and dhcp" ?14:45
smoserif cloud-init does not find networking information (such as networking-data.json) then it will render "fallback" networking config that would be the equivalent of "dhcp on eth0"14:45
smoserso.. .you could be hitting that14:45
smoser /var/log/cloud-init.log will have info14:45
amaraoI mean I boot instance with dhcp-enabled network and --config-drive=True. And it created file /etc/network/interfaces.d/50-cloud-init.cfg with content 'auto eno2  iface eno2 inet dhcp'14:46
amaraopplying network configuration from ds bringup=False: {'version': 1, 'config': [{'name': 'eno2', 'mac_address': '18:66:da:5f:07:f5', 'subnets': [{'type': 'dhcp4'}], 'type': 'physical', 'mtu': 1500}, {'address': '8.8.8.8', 'type': 'nameserver'}]}14:47
amarao2017-03-17 12:14:39,022 - util.py[DEBUG]: Writing to /etc/network/interfaces.d/50-cloud-init.cfg - wb: [420] 408 bytes14:47
amarao2017-03-17 12:14:39,022 - main.py[DEBUG]: [local] Exiting. datasource DataSourceConfigDrive [net,ver=2][source=/dev/sda2] not in local mode.14:47
amaraoIt sounds like ConfigDrive which created dhcp interface...14:47
amarao*dhcp settings for interface.14:48
smoseri'm confused.15:03
smoserit soulds like you cloud-init did what it should have.15:03
smoserno?15:03
smoserthat ll looks like working to me15:03
smoserunless you're saying 'auto eno2  iface' is on one line15:03
smoseramarao, ^ ?15:12
amaraoI just shorten it up.15:13
amaraoI thought about it, it looks reasonable to me. If network is 'dhcp' type interfaces should be dhcp.15:13
amarao(My initial expectation was that if ConfigDrive is enabled, it always would be a static ip, but I was wrong).15:13
smoserah. right. as you showed there, the network config provided (if you snow network-data.json it'd be good). but it certainly looks like network-data.json told cloud-init to dhcp on that nic.15:15
amaraonetwork was '--enable-dhcp' type, it had worked fine (until I deleted it just now). But I'll try now to use ConfigDrive with static IPs (no dhcp). It's my actual goal and the best how it may work for us.15:16
amarao smoser, btw, where is a bugtracker for cloud-init? I tried to find one and I failed.15:17
rharperhttps://bugs.launchpad.net/cloud-init15:19
rharperamarao: ^15:19
amaraoOh, thanks.15:19
powersjmagicalChicken: around?16:06
powersjmagicalChicken: nevermind, figured it out :)16:33
paulmeyrangerpb, Odd_Bloke: I'm going to figure out if the hostname reported matters in any way16:33
paulmeyI don't think it should, since it's all keyed off of the container ID16:34
paulmeythe wire server knows which VM is talking to it and should attribute the status update accordingly16:34
paulmey(otherwise, it's time to file some bugs here...)16:35
Odd_Blokepaulmey: Thanks!16:37
smoserpowersj, i dont understand16:50
smoserhttps://code.launchpad.net/~powersj/cloud-init/+git/cloud-init/+merge/31987816:50
smoserwhen i ran with the .py files input, it ran my tests.. ithought16:50
powersjsmoser: double check because when I ran it wan exactly 0 tests for those two16:50
smoserPasswordListTest inherits from CloudTestCase16:50
powersjhttps://paste.ubuntu.com/24195907/16:50
smoserso why would you need16:50
smoser TestPasswordList(base.PasswordListTest, base.CloudTestCase):16:50
smoserexplicitly ?16:50
powersjI believe it has to do with where we are running nose from and how nose discovers tests16:51
smoseragreed on the 'base' filling up, if we do have that problem, we just move that to 'passwordtests.py' or something.16:51
smoseri dont understand.16:52
smoserwhy would it not think this needs testing:16:52
smoserhttp://paste.ubuntu.com/24196107/16:52
powersjI didn't try a pass hmm16:53
smoserthat has 'Test' in its name, and extends (indirectly) from UnitTest.TestCase16:53
smoserso... i dont know why it would not liek16:53
magicalChickensmoser: discovery isn't done via the unittest loader directly17:01
magicalChickensmoser: because we have to be able to get the data and cloud-config into the testcase's attributes17:01
magicalChickensee tests/cloud_tests/testcases/__init__.py17:02
magicalChickeni agree that it would be better for just base.PasswordListTest to work, i can see if i can extend the way i detect inheritance from base.CloudTestCase to handle a test class indirectly inheriting from there17:03
magicalChickeni can't create instances there though, since that has to be done via the unittest loader, and it is a bit more difficult to do that on types17:03
smosermagicalChicken, i dont understand though.17:05
smoseri dont understand why powersj's' change made any difference17:05
magicalChickenbecause CloudTestCase needs to be a base for the individual test class17:06
magicalChickenthe way it is currently written it doesn't recurse through base classes to check, so it doesn't realize that PasswordListTest inherits from CloudTestCase17:07
magicalChickeni can modify it to be able to detect that though, once i finish up debugging centos tests17:08
smoserhm.. where is that check ?17:17
smoseryou didnt' just check isinstance ?17:17
magicalChickenit isn't possible to use isinstance there because its just the class type, not an instance17:17
magicalChickenits in tests/cloud_tests/testcases/__init__.py on line 2317:17
smoserah17:18
smosermagicalChicken, http://stackoverflow.com/questions/1401661/list-all-base-classes-in-a-hierarchy-of-given-class17:20
smosergetmro ?17:20
magicalChickensmoser: nice, i didn't know inspect had that17:21
magicalChickenshould be easy to switch over17:21
magicalChickeni can throw together a separate mp for that real quick17:22
smoserrharper, https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/32023317:30
smosernow has tests17:30
smoserhttps://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/319943 i'd like your thoguths as if its ok to take that ... perhaps we should just open a bug to handle the _write_network path... i will do that17:31
smoserand then i hitnk that one is good17:31
smoserand  https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/320212 too17:31
magicalChickensmoser: i got the mp for switching to inspect.getmro() in if you want that in for the password list test17:34
magicalChickenhttps://code.launchpad.net/~wesley-wiedenmeier/cloud-init/+git/cloud-init/+merge/32023417:34
smoseryou commit message is odd17:35
smoserin english sometimes we use a '.' to separate sentences. not only the '- '17:36
smoser:)17:36
smoserie, your list there could just be a paragraph17:36
magicalChickensmoser: right :)17:36
magicalChickeni think almost all of the integration-testing commits are formatted like that17:36
smoserwell, when you do a lot of things in a single commit or MP, it makes sometimes sense to list what you did17:37
smoserbut when you do one thing , a list isnt necessary17:37
magicalChickenyeah, this is a 1 liner though17:37
smoseri'll pull ;)17:37
magicalChickenthanks17:37
smoserpowersj, ^ now you should be able to simpllify your test like i suggested17:41
powersjsmoser: ok will take a look. The getmro find is cool, never heard of that17:41
powersjsmoser: updated17:48
magicalChickenpowersj: have you looked into building rpms for integration-testing on centos?17:53
powersjmagicalChicken: no I have not17:53
magicalChickeni think the only remaining test failures in teh distro-features branch are just because i only have a 0.7.5 rpm17:53
magicalChickenpowersj: oh, ok17:53
magicalChickeni've tried to get rpmbuild working but there's something wrong with how i did the spec file17:54
powersjmagicalChicken: did you see how brpm works?18:00
magicalChickenpowersj: yeah, i'm basing my spec file off the template it uses, and the call to rpmbuild looks good18:01
magicalChickenits failing the install stage though becasue the default config files aren't where it expects18:01
rharpersmoser: ok, reviewed both, approved second18:08
smoserrharper, ok. thanks. responded to second, will make some changes.18:24
rharpercool18:24
smoserer... to the one that needed fixing18:24
rharperright18:24
smoserrharper, https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/320212 <--18:30
smoserthat is pretty simple.18:30
smoserother than being arguably not necessary, it seems safe18:30
rharpersmoser: +118:31
smoserrharper, updated https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/32023318:59
rharperk19:01
rharpersmoser: so does lp not update the MR with the new diff?  I'm not seeing the new changes yet19:02
* smoser adds --force19:04
smoserrharper, reload19:04
rharpery19:04
rharpersmoser: missing the execption for none found19:05
rharperand the unittest of that19:05
rharpersmoser: one other comment in MR;  we should use /etc/network/interfaces.d as it's owned by ifupdown package (where eni is not since it's volatile )19:07
rharperw.r.t verifying paths in eni.available19:07
smoserbut we dont require /etc/network/interfaces.d19:10
smoserif its not there and the renderer shoudl be used, then it will work fine19:10
rharpertrue; but it's going to be present if ifupdown is installed19:10
rharperno19:10
rharperwe will recreate the path19:10
smoserright.19:10
rharperbut we expect ti to be there19:10
smoserwhich is fine.19:10
rharperthe facthat we recreate it is someone bogus19:10
rharpersomewhat19:11
rharperit's part of the package; we're using dir paths to avoid doing package lookups19:11
smoseri dont know. we dont need it to be there, and the fact that it is there does not give us any more information as to whether or not it should be used.19:14
smoserwhere as lack of /etc/network/interfaces indicates that at least currently, it will not work.19:14
rharperwell it *should* be there if you have ifupdown installed19:14
rharperwhich image would we encounter if it's not there?;  its the same for the sysconfig paths; they might not be there (and maybe sysconfig render also does extra ensure dirs which we should have to)19:15
rharperin many cases we "fix up stuff" and others we "raise exceptions"; I can see this either way;  so I won't push any more;19:16
smoserhttp://paste.ubuntu.com/24196962/19:17
smoserdirectories owned by packages are wierd.19:17
smoserespecially empty ones.19:17
rharperyeah19:17
smoserdpkg itself doesnt even care that i deleted it19:17
rharperwell, dpkg likely has a bug19:18
smoserno. it really doesnt track directories19:18
rharperbecause if you query what owns the dir it tells you19:18
smoserits only there for cleanup19:18
rharperdpkg -S clearly does19:18
smoserwhen you removve it if the directory is empty it will clean it up19:18
rharperso, inconsistency/bug ..19:18
smosermultiple things can own a directory too19:18
smoserthe same one and no conflicts19:18
rharperwhich path does dpkg -S return a list of multiple packages?19:18
rharperoh19:19
rharper /etc19:19
rharperawsome19:19
smoser:)19:19
smoseryeah.19:19
smoserit just means "create on install, remove if empty on removal"19:19
smoserat least that is my experience.19:19
rharperwell, then in general I'm not so sure we should be checking paths at all then19:20
rharpermaybe in the sysconfig available we can check other binaries that present but not elsewhere19:20
smoserwell, we're trying to check "is this the used network tool"19:20
rharperright19:20
rharperI don't think we have a good way to do that reliably19:20
rharperthese are just guesses19:20
smoserthe path i check in sysconfig *is* a binary19:20
rharperoh, yes we have some19:21
smoseretc/sysconfig/network-scripts/ifdown-eth19:21
smoseris effectively a binary.19:21
rharperI just meant we dont have a way to ask "OS, which networking configuration system are you using"19:21
smoserso... the goal here is to determine "is this thing the network tool for this system".19:21
rharpercentos/fedora likely have both sysconfig and network-manager (much like we have in UC16)19:21
smoserright19:21
rharperor even sysconfig/networkd/network-manager and we won't really know19:22
smoserso i think over time we'll just improve this.19:22
rharpery19:22
smoseras it is right now, it does what it did before19:22
smoserunless you try to trick it19:22
smoserhm...19:23
smoserthinking of my desktop19:23
smoserit uses both ifupdown and network manager19:23
smoser(or at least it could)19:23
smoserwheeee!19:23
rharperyeah19:25
smoserrharper, so we dont write /etc/network/interfaces19:35
smoserright ?19:35
smosercurrently, we expect it is there.19:35
smoserand that it has 'source /etc/network/interfaces.d/' in it19:36
smoserand bah. i had the other test case you asked fro locally19:38
smosersmoser git fail today19:38
smoserrharper, you're still working on https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/31925919:50
smoser?19:50
rharpersmoser: yes, waiting for your two changes to land in master and then I'll rebase19:53
rharperstepping out for 30 mins, have to go pickup the kids; then I'll finish up the rebase19:53
smoserhttps://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/32023319:54
smoserrharper, ^ quick ...19:54
rharpery19:54
smosercan you click agree if you do ?19:54
smoserthen i'll pull19:54
smoserif you dont thats fine too, but i thoguht we were in agreement at this point19:54
rharperyes19:55
smosersuck.19:55
rharperbbiab19:56
smosergo now read when you return on that link... i'll put some text there19:56
smoserrangerpb, around ?19:57
smoserin the case where you use NetworkManager to bring up networking19:57
smoserrharper, just pushed another commit on top of that branch... woudl like your feedback when you see it.20:37
rharpersmoser: ok20:56
rharpersmoser: so, I'm for (a) since it means we don't touch stages.py ;  that said, this is effectively the same as just having a hard-coded default in the distro20:58
rharperI had suggested that the distro class itself could set a default policy is none is found;20:59
smoserrharper, well i implemented something like a'21:00
smoserin  my commit21:00
smoserbut with  more information21:00
rharperok21:09
rharperI'm find with that;  we can drop the exception for hardcoded default in the distro if we wanted to later21:10
paulmeyrangerpb, Odd_Bloke: it seems that on Azure, the intent is that the instance DNS name is equal to the hostname set on the VM21:25
paulmeythe waagent publish_hostname functionality is proof of that21:26
paulmeyso the "with temporary_hostname(...)" code is not necessary if the hostname has been set correctly already21:27
paulmeyat least, that's how I interpret the intent of https://git.launchpad.net/cloud-init/tree/cloudinit/sources/DataSourceAzure.py#n7721:29
paulmeyand its usage here: https://git.launchpad.net/cloud-init/tree/cloudinit/sources/DataSourceAzure.py#n12021:30
Odd_Blokepaulmey: When you say "correctly", you mean "set to the same as the DNS name", right?  This code was introduced because people sometimes want a hostname on an instance that is different to the hostname that Azure expects an instance to have.21:32
paulmeyif it was ever the case that Azure cared about the hostname, that is no longer so21:45
paulmeyAzure provides the hostname that people put in at VM creation time through the ovf file21:46
paulmeybut people are free to change that21:46
paulmeythe agent has code to detect a hostname change and bounce the interface to update DNS21:47
paulmeybut that is just a convenience21:47
=== rangerpb is now known as rangerpbzzzz

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