Re: [lxc-users] LXD: modify IP of snapshot before starting

2018-12-07 Thread Serge E. Hallyn
On Fri, Dec 07, 2018 at 09:34:14AM -0600, Steven Spencer wrote:
> All,
> 
> My Google search turned up empty, so I'm turning to the list to see if this
> is possible:
> 
> * In LXD I make a copy of a container, but want to create a new container
> from it
> * The container has a static assigned IP address, so if I bring up the new

How is the static ip address assigned?  Using raw.lxc, using dhcp config
on the host, using /etc/network/interfaces or the like in the container's
rootfs?

How are you currently copying it?  Are you using lxc copy --stateless?
Can you just pass '-c ' to the lxc copy command to change the
ipv4 configuration?

> container with the other one running, I'm going to end up with an IP
> conflict
> * What I'd like to be able to do is to change the IP of the snapshot before
> creating a container out of it.
> 
> Is that possible, or am I missing another method.  I've already done this
> step before, which works, but isn't the best if you want to keep systems up.
> 
> * Stop the original container
> * create the new container with the snapshot
> * modify the IP of the new container
> * start the original container
> 
> If it isn't possible, I'll continue on as I've been doing.
> 
> Thanks,
> Steven G. Spencer

> ___
> lxc-users mailing list
> lxc-users@lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users

___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users


Re: [lxc-users] lxd access from host to container rootfs

2018-12-07 Thread Serge E. Hallyn
On Wed, Dec 05, 2018 at 02:55:33PM +0100, Ingo Baab wrote:
> Hello All,
> how can I access the LXD/LXC containers rootfs from the host system?
> (if I am using ubuntu18.04 with snap lxc --version 3.7 on loopback-ZFS)
> 
> On other (real ZFS-based and U16.04) server I can access:
> 
>     "/var/lib/lxd/containers/{$containername}/rootfs/"
> 
> Any hints?
> Ingo

Well, I'm sure there is a better answer, but as I don't run the
snap version of lxd, i'm not sure of "the right" way, so...

the first thing you can do, if the container is running, is 

pid=$(lxc info $containername | awk '/Pid/ { print $2 }')
ls /proc/$pid/root

You also should be able to look at the open fds in the running
lxd for a hint as to where the info is being kept,

pid=$(pidof lxd | awk '{ print $1 }')
ls -l /proc/$pid/fd | grep $containername
or
ls -l /proc/$pid/fd | grep database
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users


Re: [lxc-users] LXD: modify IP of snapshot before starting

2018-12-07 Thread Andrey Repin
Greetings, Steven Spencer!

> My Google search turned up empty, so I'm turning to the list to see if this 
> is possible:


> * In LXD I make a copy of a container, but want to create a new container 
> from it
> * The container has a static assigned IP address, so if I bring up the new
> container with the other one running, I'm going to end up with an IP conflict
> * What I'd like to be able to do is to change the IP of the snapshot before 
> creating a container out of it.


> Is that possible, or am I missing another method.  I've already done this
> step before, which works, but isn't the best if you want to keep systems up.

That's because you're doing it wrong.
You should have a template container which "never" online, from it you could
create copies, edit them and start them as you pleased.

> * Stop the original container
> * create the new container with the snapshot
> * modify the IP of the new container
> * start the original container 


> If it isn't possible, I'll continue on as I've been doing.


-- 
With best regards,
Andrey Repin
Friday, December 7, 2018 20:32:59

Sorry for my terrible english...
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users


[lxc-users] LXD: modify IP of snapshot before starting

2018-12-07 Thread Steven Spencer
All,

My Google search turned up empty, so I'm turning to the list to see if this
is possible:

* In LXD I make a copy of a container, but want to create a new container
from it
* The container has a static assigned IP address, so if I bring up the new
container with the other one running, I'm going to end up with an IP
conflict
* What I'd like to be able to do is to change the IP of the snapshot before
creating a container out of it.

Is that possible, or am I missing another method.  I've already done this
step before, which works, but isn't the best if you want to keep systems up.

* Stop the original container
* create the new container with the snapshot
* modify the IP of the new container
* start the original container

If it isn't possible, I'll continue on as I've been doing.

Thanks,
Steven G. Spencer
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users