← Back to team overview

group.of.nepali.translators team mailing list archive

[Bug 1712455] [NEW] LXD 2.0.10 doesn't properly auto-update images

 

Public bug reported:

A number of issues interfere with LXD 2.0.10's ability to update images:
 - The auto_update flag doesn't properly get set on newly downloaded images
 - The cached flag doesn't get properly copied when an image gets refreshed

The combination of those means that LXD effectively only updates images
when a user requests a new container. This at least means that there is
no security impact from this, but this also slows things down quite a
bit and is certainly not the expected behavior.

This fix cherry-picks two upstream fixes that resolve the two
highlighted issues and applies an extra change which will automatically
restore the auto_update flag for any image that is marked as "cached" in
the store.

== Rationale
LXD regressed in its background update code, leading to most LXD hosts storing stale images and only refreshing them when a user asks for a new container to be created.

This is pretty different from the expected behavior of LXD refreshing
all its images every 6 hours.

The fix restores the old behavior and attempts to reset the update flag
on images which are supposed to auto-update.

== Test case
1) Setup two LXD hosts on LXD 2.0.10
2) On the first LXD host, copy an image ("lxc image copy ubuntu:16.04 local: --alias blah")
3) Add teh first LXD host as a remote to the second LXD host
4) Create a container on the second LXD host using ("lxc init <remote>:blah c1")
5) On the first host, change the target of the alias ("lxc image copy ubuntu:14.04 local: --alias blah")
6) On the second host, look at the content of the image store ("lxc image list")
7) On the second host, restart LXD ("systemctl restart lxd")
8) On the second host, confirm that LXD is done starting ("tail -f /var/log/lxd/lxd.log")
9) On the second host, look at the content of the image store again ("lxc image list")

On a properly functionaling LXD, at step 9) you'll see the new image in
the image store with the old one gone. On a broken LXD, the initial
image is there and there's no sign of the new one.

== Regression potential
The changes being pushed here are coming from existing LXD releases (2.16) so have seen significant use already. The main risk I can think of is in the DB patch that's included in this change.

That code is very restrictive and will only set the auto-update flag on
an image which is marked as cached (was automatically downloaded) and
has a known source (as required for auto-update).

This will not fix images which have been already updated by LXD through
container launch as those will have lost their cached flag due to the
other bug we're fixing here, but attempting to fix those would just be
guesswork as any information on how the image ended up in the store is
lost at that point.

** Affects: lxd (Ubuntu)
     Importance: Undecided
         Status: Fix Released

** Affects: lxd (Ubuntu Trusty)
     Importance: Undecided
         Status: New

** Affects: lxd (Ubuntu Xenial)
     Importance: High
     Assignee: Stéphane Graber (stgraber)
         Status: In Progress

** Also affects: lxd (Ubuntu Trusty)
   Importance: Undecided
       Status: New

** Also affects: lxd (Ubuntu Xenial)
   Importance: Undecided
       Status: New

** Changed in: lxd (Ubuntu)
       Status: New => Fix Released

** Changed in: lxd (Ubuntu Xenial)
       Status: New => In Progress

** Changed in: lxd (Ubuntu Xenial)
     Assignee: (unassigned) => Stéphane Graber (stgraber)

** Changed in: lxd (Ubuntu Xenial)
   Importance: Undecided => High

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1712455

Title:
  LXD 2.0.10 doesn't properly auto-update images

Status in lxd package in Ubuntu:
  Fix Released
Status in lxd source package in Trusty:
  New
Status in lxd source package in Xenial:
  In Progress

Bug description:
  A number of issues interfere with LXD 2.0.10's ability to update images:
   - The auto_update flag doesn't properly get set on newly downloaded images
   - The cached flag doesn't get properly copied when an image gets refreshed

  The combination of those means that LXD effectively only updates
  images when a user requests a new container. This at least means that
  there is no security impact from this, but this also slows things down
  quite a bit and is certainly not the expected behavior.

  This fix cherry-picks two upstream fixes that resolve the two
  highlighted issues and applies an extra change which will
  automatically restore the auto_update flag for any image that is
  marked as "cached" in the store.

  == Rationale
  LXD regressed in its background update code, leading to most LXD hosts storing stale images and only refreshing them when a user asks for a new container to be created.

  This is pretty different from the expected behavior of LXD refreshing
  all its images every 6 hours.

  The fix restores the old behavior and attempts to reset the update
  flag on images which are supposed to auto-update.

  == Test case
  1) Setup two LXD hosts on LXD 2.0.10
  2) On the first LXD host, copy an image ("lxc image copy ubuntu:16.04 local: --alias blah")
  3) Add teh first LXD host as a remote to the second LXD host
  4) Create a container on the second LXD host using ("lxc init <remote>:blah c1")
  5) On the first host, change the target of the alias ("lxc image copy ubuntu:14.04 local: --alias blah")
  6) On the second host, look at the content of the image store ("lxc image list")
  7) On the second host, restart LXD ("systemctl restart lxd")
  8) On the second host, confirm that LXD is done starting ("tail -f /var/log/lxd/lxd.log")
  9) On the second host, look at the content of the image store again ("lxc image list")

  On a properly functionaling LXD, at step 9) you'll see the new image
  in the image store with the old one gone. On a broken LXD, the initial
  image is there and there's no sign of the new one.

  == Regression potential
  The changes being pushed here are coming from existing LXD releases (2.16) so have seen significant use already. The main risk I can think of is in the DB patch that's included in this change.

  That code is very restrictive and will only set the auto-update flag
  on an image which is marked as cached (was automatically downloaded)
  and has a known source (as required for auto-update).

  This will not fix images which have been already updated by LXD
  through container launch as those will have lost their cached flag due
  to the other bug we're fixing here, but attempting to fix those would
  just be guesswork as any information on how the image ended up in the
  store is lost at that point.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lxd/+bug/1712455/+subscriptions


Follow ups