After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 739416 - List deployment versions in bootloader UI
List deployment versions in bootloader UI
Status: RESOLVED FIXED
Product: ostree
Classification: Infrastructure
Component: general
2014.4
Other Linux
: Normal normal
: ---
Assigned To: OSTree maintainer(s)
OSTree maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-10-30 17:57 UTC by Matthew Barnes
Modified: 2014-11-11 02:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
First cut (4.41 KB, patch)
2014-10-30 17:57 UTC, Matthew Barnes
reviewed Details | Review
Revised patch (5.90 KB, patch)
2014-11-03 15:00 UTC, Matthew Barnes
reviewed Details | Review
Revised patch v2 (6.59 KB, patch)
2014-11-03 20:39 UTC, Matthew Barnes
committed Details | Review
Followup patch (1.91 KB, patch)
2014-11-10 01:04 UTC, Matthew Barnes
reviewed Details | Review
Followup patch (2.10 KB, patch)
2014-11-10 18:20 UTC, Matthew Barnes
committed Details | Review

Description Matthew Barnes 2014-10-30 17:57:47 UTC
Created attachment 289689 [details] [review]
First cut

Listing the deployment's version label in a bootloader UI is more user-friendly than an index value.

I imagine this will require a few iterations, so the attached patch is only a first cut.  Presently if a version can't be found for a deployment then the boot entry title just falls back to the old style.

I think Colin had some other criteria for this but I need more clarification.

Haven't actually tested this yet because I'm trying to figure out how to do so without running a whole compose.
Comment 1 Colin Walters 2014-10-31 18:54:23 UTC
Review of attachment 289689 [details] [review]:

I think this is pretty good.

A further elaboration of this would be to include the osname iff there are multiple.  (It's possible to use ostree to parallel install in separate roots the same OS version, with separate /etc and /var streams)
Comment 2 Matthew Barnes 2014-11-02 14:35:56 UTC
I thought of that afterward but then wasn't sure if PRETTY_NAME from /etc/os-release would sufficiently identify the OS.  Didn't consider the use case you mention, so I'll go ahead and do that.

Do you want me to make the fallback case look similar?  Don't know how often it would get used in practice, but maybe something like:

    $PRETTY_NAME ostree[:$OSNAME]:($VERSION|$INDEX)

IOW, show the osname iff there are multiple like you said, and show the index iff no version is available?
Comment 3 Matthew Barnes 2014-11-03 15:00:16 UTC
Created attachment 289898 [details] [review]
Revised patch

Revised patch uses the title format in comment #2.
Comment 4 Colin Walters 2014-11-03 17:48:29 UTC
Review of attachment 289898 [details] [review]:

Could you add a test for this in tests/admin-test.sh?  Something like:

diff --git a/tests/admin-test.sh b/tests/admin-test.sh
index 94aef64..cc92892 100755
--- a/tests/admin-test.sh
+++ b/tests/admin-test.sh
@@ -29,6 +29,7 @@ ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=te
 ostree admin --sysroot=sysroot status | tee status.txt
 
 assert_file_has_content status.txt 'Version: 1.0.10'
+assert_file_has_content sysroot/boot/loader/syslinux.conf 'TestOS 1.0.10'
 
 echo "ok deploy command"

::: src/libostree/ostree-sysroot-deploy.c
@@ +1367,3 @@
+
+  title_key = g_string_new (val);
+  g_string_append (title_key, " ostree:");

I go back and forth on whether this should be in the UI.  In a multi-boot scenario it makes sense, but if you're *only* using ostree it's kind of noise =/  Not sure.  

Maybe demote it to a suffix?  e.g.

Fedora Atomic Host 21.0 (ostree)

@@ +1653,3 @@
+       * here is not fatal to the whole operation.  We just gracefully
+       * fall back to the deployment index. */
+      ostree_sysroot_get_repo (self, &repo, cancellable, NULL);

I add (void) for things like this to please static analyzers like Coverity that want one to consistently check function return values.
Comment 5 Colin Walters 2014-11-03 17:48:35 UTC
Review of attachment 289898 [details] [review]:

Could you add a test for this in tests/admin-test.sh?  Something like:

diff --git a/tests/admin-test.sh b/tests/admin-test.sh
index 94aef64..cc92892 100755
--- a/tests/admin-test.sh
+++ b/tests/admin-test.sh
@@ -29,6 +29,7 @@ ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=quiet --os=te
 ostree admin --sysroot=sysroot status | tee status.txt
 
 assert_file_has_content status.txt 'Version: 1.0.10'
+assert_file_has_content sysroot/boot/loader/syslinux.conf 'TestOS 1.0.10'
 
 echo "ok deploy command"

::: src/libostree/ostree-sysroot-deploy.c
@@ +1367,3 @@
+
+  title_key = g_string_new (val);
+  g_string_append (title_key, " ostree:");

I go back and forth on whether this should be in the UI.  In a multi-boot scenario it makes sense, but if you're *only* using ostree it's kind of noise =/  Not sure.  

Maybe demote it to a suffix?  e.g.

Fedora Atomic Host 21.0 (ostree)

@@ +1653,3 @@
+       * here is not fatal to the whole operation.  We just gracefully
+       * fall back to the deployment index. */
+      ostree_sysroot_get_repo (self, &repo, cancellable, NULL);

I add (void) for things like this to please static analyzers like Coverity that want one to consistently check function return values.
Comment 6 Matthew Barnes 2014-11-03 20:39:35 UTC
Created attachment 289937 [details] [review]
Revised patch v2

Updated per your comments.

See the commit message for the overall title format.
Comment 7 Colin Walters 2014-11-03 20:58:23 UTC
Review of attachment 289937 [details] [review]:

Ok, this looks pretty good to me!
Comment 9 Colin Walters 2014-11-07 21:04:53 UTC
This actually broke the syslinux backend.  It does:

      else if (!parsing_label &&
               (g_str_has_prefix (line, "DEFAULT ")))
        {
          saw_default = TRUE;
          if (g_str_has_prefix (line, "DEFAULT ostree:"))
            regenerate_default = TRUE;


Which is kind of conceptually broken, but I was trying to avoid changing the default for existing syslinux installations.  We'll need to update this code to also do strstr("(ostree") as well or something?
Comment 10 Matthew Barnes 2014-11-10 01:04:32 UTC
Created attachment 290296 [details] [review]
Followup patch

I'm not yet familiar with the bootloader code at all and barely know the first thing about SYSLINUX so I'm pretty much trusting your suggestion, but also peppering the code with additional comments.
Comment 11 Colin Walters 2014-11-10 15:12:23 UTC
Review of attachment 290296 [details] [review]:

::: src/libostree/ostree-bootloader-syslinux.c
@@ +210,3 @@
+           *     but this hack is at least noted in the code that builds
+           *     the title to hopefully avoid regressions. */
+          if (strstr (line, "(ostree") != NULL)

We need to search for *both* patterns right?  For the case where we're upgrading from an ostree that used "ostree: " to one that uses "(ostree" right?

I think the flow would be:
- Running old version
- Deploy new tree (and still writing *old* titles)
- Reboot into new tree
- Upgrade *again* using new ostree (and thus read the *old* title config, but deploying *new*)
Comment 12 Matthew Barnes 2014-11-10 18:20:00 UTC
Created attachment 290371 [details] [review]
Followup patch

Yeah you're right.  More generally, I guess it's gonna have to know about *all* the variations if there's any further changes in the future.
Comment 13 Colin Walters 2014-11-10 18:31:55 UTC
Review of attachment 290371 [details] [review]:

This looks good to me.  An elaboration of this might be a magic comment in the syslinux config, like:

# OSTree managed default
DEFAULT blah

But this is fine.