← Back to team overview

cloud-init team mailing list archive

Re: Moving of stored data

 

On Wed, Mar 1, 2023 at 12:10 PM Robert Schweikert <rjschwei@xxxxxxxx> wrote:
>
> Hi,
>
> On 3/1/23 09:08, Neal Gompa wrote:
> > On Wed, Mar 1, 2023 at 9:05 AM Robert Schweikert <rjschwei@xxxxxxxx> wrote:
> >>
> >> Hi,
> >>
> >> At present cloud-init stores data in /var/lib/cloud. For systems with
> >> transactional-updates, i.e. opensuse-microos and other incarnations this
> >> location becomes read-only.
> >>
> >> Would it be OK to send a PR that moves the data to /var/cache/cloud ?
> >>
> >> I'd prefer a wholesale move of the data over various if conditions and
> >> checks whether or not /var/lib is writable. Also we'd know that as of
> >> version X of cloud-init the data has been moved.
> >>
> >> Basic idea is
> >>
> >> if no os.exists('/var/cache/cloud'):
> >>     create_it
> >> if os.exists('/var/lib/cloud'):
> >>     move_the_existing_data_to_new_location
> >>
> >> Do the above early enough in the process such that for all other
> >> locations in the code that access the data the change in location is
> >> transparent.
> >>
> >> Thoughts?
> >
> > That doesn't make any sense. openSUSE systems are explicitly supposed
> > to omit /var from the read-only root. That's why the RPM and DNF
> > databases were moved to /usr years ago. The whole point of /var is for
> > system specific data. It is supposed to be always writable.
> >
>
> Yes of course, I have too many things going on and wasn't paying
> attention. Thanks for pointing it out.
>
> The move is necessary to preserve the data between snapshots/reboots in
> a transactional-update system.
>
> /var/lib is discarded between reboots the data in /var/cache is
> available after reboot into the new snapshot. Meaning if the cloud-init
> data is not moved then it always looks like a new instance is being booted.
>

That sounds like a flaw in transactional-update. As a user, I would be
very surprised to see persistent data being thrown away. I would
expect /var/cache to be emptied, but not /var/lib. I think you need to
go back and fix that instead.



-- 
真実はいつも一つ!/ Always, there's only one truth!


Follow ups

References