1. Add an 'has_storage()' test and then see if the LXD_POOL storage is set
up; if it is then exit.
Thanks and Regards,
Narinder Gupta
Canonical, Ltd.
+1.281.736.5150
Ubuntu- Linux for human beings | www.ubuntu.com | www.canonical.com
On Thu, Apr 18, 2019 at 2:45 PM Alex Kavanagh <email address hidden>
wrote:
> Thanks Narinda
>
> I think I've worked out what the bug is, although I'm not quite sure the
> best way to fix it.
>
> -- Notes for fix:
>
> The main issue is in hooks/lxd_utils.py at line 192:
>
> if filesystem_mounted('/var/lib/lxd'):
> log('/var/lib/lxd already configured, skipping')
> return
>
> With LXD 3.x.x and greater, lxc storage is used, and so there is no
> filesystem mounted at /var/lib/lxd. Therefore, whenever the config-
> changed hook fires, it will try to re-setup the block device as the
> charm hasn't detected that it's already set up.
>
> There are a couple of ways to fix the bug:
>
> 1. Add an 'has_storage()' test and then see if the LXD_POOL storage is set
> up; if it is then exit.
> 2. Use the the fact that the /var/lib/lxd directory exists as evidence
> that the storage device has been set-up; it's more efficient than 1. but
> maybe not as dependable (e.g. if the previous config-change failed due to
> the block device not being mounted, but the directory was made).
>
> I'm leaning towards 1. as an appropriate fix.
>
> ** Changed in: charm-lxd
> Status: New => Confirmed
>
> ** Changed in: charm-lxd
> Importance: Undecided => High
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1825393
>
> Title:
> upgrade charm from 19.01 to 19.04 fails on initalize storage pool
>
> Status in OpenStack LXD Charm:
> Confirmed
>
> Bug description:
> Deploy using 19.02 charm then upgrade to 19.04 charm. config-change
> hook error.
>
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/1.config-changed
> subprocess.CalledProcessError: Command '['lxc', 'storage', 'create', 'lxd',
> 'btrfs', 'source=/dev/sdh']' returned non-zero exit status 1
> unit-lxd-1: 16:21:16 ERROR juju.worker.uniter.operation hook
> "config-changed" failed: exit status 1
> unit-lxd-0: 16:21:14 INFO unit.lxd/0.juju-log Configuring LXD container
> storage
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed
> +------+-------------+--------+--------------------------------------+---------+
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed | NAME |
> DESCRIPTION | DRIVER | SOURCE | USED BY |
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed
> +------+-------------+--------+--------------------------------------+---------+
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed | lxd |
> | btrfs | 4e0bbaa6-6fad-4428-8ffd-81828cdf5746 | 0 |
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed
> +------+-------------+--------+--------------------------------------+---------+
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed Error: The storage
> pool already exists
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed Traceback (most
> recent call last):
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed File
> "/var/lib/juju/agents/unit-lxd-0/charm/hooks/config-changed", line 173, in
> <module>
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed main()
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed File
> "/var/lib/juju/agents/unit-lxd-0/charm/hooks/config-changed", line 166, in
> main
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed
> hooks.execute(sys.argv)
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed File
> "/var/lib/juju/agents/unit-lxd-0/charm/hooks/charmhelpers/core/hookenv.py",
> line 914, in execute
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed
> self._hooks[hook_name]()
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed File
> "/var/lib/juju/agents/unit-lxd-0/charm/hooks/config-changed", line 86, in
> config_changed
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed
> configure_lxd_block()
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed File
> "/var/lib/juju/agents/unit-lxd-0/charm/hooks/lxd_utils.py", line 233, in
> configure_lxd_block
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed
> config_btrfs(dev)
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed File
> "/var/lib/juju/agents/unit-lxd-0/charm/hooks/lxd_utils.py", line 246, in
> config_btrfs
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed check_call(cmd)
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed File
> "/usr/lib/python2.7/subprocess.py", line 190, in check_call
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed raise
> CalledProcessError(retcode, cmd)
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/0.config-changed
> subprocess.CalledProcessError: Command '['lxc', 'storage', 'create', 'lxd',
> 'btrfs', 'source=/dev/sdh']' returned non-zero exit status 1
> unit-lxd-0: 16:21:14 ERROR juju.worker.uniter.operation hook
> "config-changed" failed: exit status 1
> unit-lxd-1: 16:21:16 INFO unit.lxd/1.juju-log Configuring LXD container
> storage
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/1.config-changed
> +------+-------------+--------+--------------------------------------+---------+
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/1.config-changed | NAME |
> DESCRIPTION | DRIVER | SOURCE | USED BY |
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/1.config-changed
> +------+-------------+--------+--------------------------------------+---------+
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/1.config-changed | lxd |
> | btrfs | d33d8b1b-8096-48a4-8a4c-447168e6d049 | 0 |
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/1.config-changed
> +------+-------------+--------+--------------------------------------+---------+
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/1.config-changed Error: The storage
> pool already exists
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/1.config-changed Traceback (most
> recent call last):
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/1.config-changed File
> "/var/lib/juju/agents/unit-lxd-1/charm/hooks/config-changed", line 173, in
> <module>
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/1.config-changed main()
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/1.config-changed File
> "/var/lib/juju/agents/unit-lxd-1/charm/hooks/config-changed", line 166, in
> main
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/1.config-changed
> hooks.execute(sys.argv)
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/1.config-changed File
> "/var/lib/juju/agents/unit-lxd-1/charm/hooks/charmhelpers/core/hookenv.py",
> line 914, in execute
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/1.config-changed
> self._hooks[hook_name]()
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/charm-lxd/+bug/1825393/+subscriptions
>
I agreed Alex and appropriate to have fix no 1.
1. Add an 'has_storage()' test and then see if the LXD_POOL storage is set
up; if it is then exit.
Thanks and Regards,
Narinder Gupta
Canonical, Ltd.
+1.281.736.5150
Ubuntu- Linux for human beings | www.ubuntu.com | www.canonical.com
On Thu, Apr 18, 2019 at 2:45 PM Alex Kavanagh <email address hidden>
wrote:
> Thanks Narinda mounted( '/var/lib/ lxd'): /bugs.launchpad .net/bugs/ 1825393 1.config- changed CalledProcessEr ror: Command '['lxc', 'storage', 'create', 'lxd', uniter. operation hook 0.config- changed +------ ------- +------ --+---- ------- ------- ------- ------- ------+ ------- --+ 0.config- changed | NAME | 0.config- changed +------ ------- +------ --+---- ------- ------- ------- ------- ------+ ------- --+ 0.config- changed | lxd | 6fad-4428- 8ffd-81828cdf57 46 | 0 | 0.config- changed +------ ------- +------ --+---- ------- ------- ------- ------- ------+ ------- --+ 0.config- changed Error: The storage 0.config- changed Traceback (most 0.config- changed File juju/agents/ unit-lxd- 0/charm/ hooks/config- changed" , line 173, in 0.config- changed main() 0.config- changed File juju/agents/ unit-lxd- 0/charm/ hooks/config- changed" , line 166, in 0.config- changed sys.argv) 0.config- changed File juju/agents/ unit-lxd- 0/charm/ hooks/charmhelp ers/core/ hookenv. py", 0.config- changed hook_name] () 0.config- changed File juju/agents/ unit-lxd- 0/charm/ hooks/config- changed" , line 86, in 0.config- changed lxd_block( ) 0.config- changed File juju/agents/ unit-lxd- 0/charm/ hooks/lxd_ utils.py" , line 233, in 0.config- changed 0.config- changed File juju/agents/ unit-lxd- 0/charm/ hooks/lxd_ utils.py" , line 246, in 0.config- changed check_call(cmd) 0.config- changed File python2. 7/subprocess. py", line 190, in check_call 0.config- changed raise ror(retcode, cmd) 0.config- changed CalledProcessEr ror: Command '['lxc', 'storage', 'create', 'lxd', uniter. operation hook 1.config- changed +------ ------- +------ --+---- ------- ------- ------- ------- ------+ ------- --+ 1.config- changed | NAME | 1.config- changed +------ ------- +------ --+---- ------- ------- ------- ------- ------+ ------- --+ 1.config- changed | lxd | 8096-48a4- 8a4c-447168e6d0 49 | 0 | 1.config- changed +------ ------- +------ --+---- ------- ------- ------- ------- ------+ ------- --+ 1.config- changed Error: The storage 1.config- changed Traceback (most 1.config- changed File juju/agents/ unit-lxd- 1/charm/ hooks/config- changed" , line 173, in 1.config- changed main() 1.config- changed File juju/agents/ unit-lxd- 1/charm/ hooks/config- changed" , line 166, in 1.config- changed sys.argv) 1.config- changed File juju/agents/ unit-lxd- 1/charm/ hooks/charmhelp ers/core/ hookenv. py", 1.config- changed hook_name] () /bugs.launchpad .net/charm- lxd/+bug/ 1825393/ +subscriptions
>
> I think I've worked out what the bug is, although I'm not quite sure the
> best way to fix it.
>
> -- Notes for fix:
>
> The main issue is in hooks/lxd_utils.py at line 192:
>
> if filesystem_
> log('/var/lib/lxd already configured, skipping')
> return
>
> With LXD 3.x.x and greater, lxc storage is used, and so there is no
> filesystem mounted at /var/lib/lxd. Therefore, whenever the config-
> changed hook fires, it will try to re-setup the block device as the
> charm hasn't detected that it's already set up.
>
> There are a couple of ways to fix the bug:
>
> 1. Add an 'has_storage()' test and then see if the LXD_POOL storage is set
> up; if it is then exit.
> 2. Use the the fact that the /var/lib/lxd directory exists as evidence
> that the storage device has been set-up; it's more efficient than 1. but
> maybe not as dependable (e.g. if the previous config-change failed due to
> the block device not being mounted, but the directory was made).
>
> I'm leaning towards 1. as an appropriate fix.
>
> ** Changed in: charm-lxd
> Status: New => Confirmed
>
> ** Changed in: charm-lxd
> Importance: Undecided => High
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https:/
>
> Title:
> upgrade charm from 19.01 to 19.04 fails on initalize storage pool
>
> Status in OpenStack LXD Charm:
> Confirmed
>
> Bug description:
> Deploy using 19.02 charm then upgrade to 19.04 charm. config-change
> hook error.
>
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/
> subprocess.
> 'btrfs', 'source=/dev/sdh']' returned non-zero exit status 1
> unit-lxd-1: 16:21:16 ERROR juju.worker.
> "config-changed" failed: exit status 1
> unit-lxd-0: 16:21:14 INFO unit.lxd/0.juju-log Configuring LXD container
> storage
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> +------
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> DESCRIPTION | DRIVER | SOURCE | USED BY |
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> +------
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> | btrfs | 4e0bbaa6-
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> +------
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> pool already exists
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> recent call last):
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> "/var/lib/
> <module>
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> "/var/lib/
> main
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> hooks.execute(
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> "/var/lib/
> line 914, in execute
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> self._hooks[
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> "/var/lib/
> config_changed
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> configure_
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> "/var/lib/
> configure_lxd_block
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> config_btrfs(dev)
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> "/var/lib/
> config_btrfs
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> "/usr/lib/
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> CalledProcessEr
> unit-lxd-0: 16:21:14 DEBUG unit.lxd/
> subprocess.
> 'btrfs', 'source=/dev/sdh']' returned non-zero exit status 1
> unit-lxd-0: 16:21:14 ERROR juju.worker.
> "config-changed" failed: exit status 1
> unit-lxd-1: 16:21:16 INFO unit.lxd/1.juju-log Configuring LXD container
> storage
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/
> +------
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/
> DESCRIPTION | DRIVER | SOURCE | USED BY |
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/
> +------
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/
> | btrfs | d33d8b1b-
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/
> +------
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/
> pool already exists
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/
> recent call last):
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/
> "/var/lib/
> <module>
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/
> "/var/lib/
> main
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/
> hooks.execute(
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/
> "/var/lib/
> line 914, in execute
> unit-lxd-1: 16:21:16 DEBUG unit.lxd/
> self._hooks[
>
> To manage notifications about this bug go to:
> https:/
>