Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network issue running create #2

Closed
parak opened this issue May 31, 2016 · 7 comments
Closed

Network issue running create #2

parak opened this issue May 31, 2016 · 7 comments

Comments

@parak
Copy link

parak commented May 31, 2016

Hi,

I'm running test-kitchen 1.4.2 with kitchen-lxd_cli 0.1.6 on Ubuntu 16.04 with LXC 2.0.1 and LXD 2.0.1. I also ran lxd init and set up bridged networking for both IPv4 and IPv6. On a create for an instance, I get the following:

$ kitchen create test-ubuntu-1404 -l debug
-----> Starting Kitchen (v1.4.2)
-----> Creating <test-ubuntu-1404>...
D      Container test-ubuntu-1404 doesn't exist
D      Publish Image Name is kitchen-test-ubuntu-1404
D      Image Name is ubuntu1404
D      Image ubuntu1404 exists
       Initializing container test-ubuntu-1404
D      run_local_command ran: lxc init ubuntu1404 test-ubuntu-1404  
D      Command finished: pid 16118 exit 0
D      Container test-ubuntu-1404 isn't running
       Starting container test-ubuntu-1404
D      run_local_command ran: lxc start test-ubuntu-1404 
D      Command finished: pid 16132 exit 0
D      Waiting for /etc/resolvconf/resolv.conf.d/base to become available...
D      run_local_command ran: lxc exec test-ubuntu-1404 -- ls /etc/resolvconf/resolv.conf.d/base > /dev/null 2>&1
D      Command finished: pid 16226 exit 0
D      Found /etc/resolvconf/resolv.conf.d/base
D      Setting up the following dns servers via /etc/resolvconf/resolv.conf.d/base:
D      nameserver 8.8.8.8 nameserver 8.8.4.4 
D      Waiting for /run/resolvconf/interface to become available...
D      run_local_command ran: lxc exec test-ubuntu-1404 -- ls /run/resolvconf/interface > /dev/null 2>&1
D      Command finished: pid 16400 exit 0
D      Found /run/resolvconf/interface
D      Setting up /etc/hosts
D      Waiting for /etc/hosts to become available...
D      run_local_command ran: lxc exec test-ubuntu-1404 -- ls /etc/hosts > /dev/null 2>&1
D      Command finished: pid 16670 exit 0
D      Found /etc/hosts
       Waiting for network to become ready
D      Still waiting for IP Address...
D      Still waiting for IP Address...
D      Still waiting for IP Address...
D      Still waiting for IP Address...
D      Still waiting for IP Address...
D      Still waiting for IP Address...
D      Still waiting for IP Address...
D      Still waiting for IP Address...
D      Still waiting for IP Address...
D      Still waiting for IP Address...

The image in question was created from public ubuntu:14.04 image, with just my public key added to root authorized_keys. The container itself is up and running at this point, and I can ping as well as ssh into it using my key just fine, so I'm confused as to what kitchen is expecting still here.

Thanks!

@bradenwright
Copy link
Owner

My apologies, I was out of town when I saw... and forgot when I got back. If you can post your .kitchen.yml file. I haven't tested with new versions of lxd, but should have time to do so soon.

My guess is that I try to strip the ip address from lxc info https://github.com/bradenwright/kitchen-lxd_cli/blob/master/lib/kitchen/driver/lxd_cli.rb#L365

This may not work in newer versions of LXD

Sidenote:
I haven't tried newer version of LXD b/c I ran into networking issues with LXD 0.21, 0.22 https://github.com/lxc/lxd/issues/1259 it doesn't seem like they are willing to support ip addresses being setup outside of the container so I really have to rework certain pieces to work with newer version of LXD, and I really don't like how I have to do it now, so I've kind of avoided it for a little while hoping LXD would support setting ips. Probably about time I bite the bullet, and either remove ability to set static ip or do it in a way that is supported by current versions of LXD.

@parak
Copy link
Author

parak commented Jun 10, 2016

Yep, I've fixed this in my fork here.

I've also added some bits in order to get CentOS to work, but my ruby is pretty horrible so it probably shouldn't be taken at face value (though it does work). I'm also currently working on a change that allows mounting host folders as read/write, which is turning out to be fairly complicated (unless I'm missing an obvious way of doing it).

Thanks!

@bradenwright
Copy link
Owner

Awesome! Appreciated. To be honest my Ruby code isn't great either and I through this together rather quickly so my coding here definitely isn't the best :) The CentOS piece would definitely be nice to have!

Anyways if you want to make a PR I'll test/merge it. If I see anything jumping out in the Ruby code I can make corrections. You were willing to write the code, so I'll be willing to review/merge!!!

As for folders, I know I wrote that in, so are you saying its broken as well in LXD 2.x?

https://github.com/bradenwright/kitchen-lxd_cli#mount

@parak
Copy link
Author

parak commented Jun 11, 2016

Folders was apparently my own fault in that I didn't see that the config section is required to have rw access (namely the privileged bits). Since I didn't need the config section, I had removed it and was confused why I can't write to the folders, and even started digging into how to get container gid and uid on the source folders...

Anyway, once I realized that, I mucked a bit more with the code to make the section optional, so that's all good there now :) I'll be sure to send a PR over when I can.

@bradenwright
Copy link
Owner

So I pulled your branch and cofirmed with Lxd 2.0.2 that your fix works for ubuntu. Although the lxd-image command no longer exists so I have to fix importing the image. I tried centos7 but it didn't quite make it threw.

I think I'm going to make a 2.x branch to track these changes and probably go through settings a little more since I think a few things may have changed going from lxd 1 to 2

Anyways thanks again for helping out and giving me a little kick in the ass to work on lxd 2.x I think they may have given back the ability for static ips to be set similar to how I was so that's good news too.

@bradenwright
Copy link
Owner

FYI I pushed your changes another tweak or two to https://github.com/bradenwright/kitchen-lxd_cli/tree/lxd-2.x

My hope is to fix up image issue/part of it and hopefully merge it soon, maybe this weekend. Let me know if there is outstanding issues you know of.

Thanks again!

@parak
Copy link
Author

parak commented Jun 16, 2016

Great, thanks. I haven't tested CentOS 7 yet, just 6, and it seemed to work fine there as far as the resolv.conf bits go. I'll close this issue, and open new ones if I find anything else of interest :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants