Skip to content

Instantly share code, notes, and snippets.

@nzwulfin
Created September 19, 2016 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nzwulfin/e2a1e79d6a41031e1dfd49ead0ccc80a to your computer and use it in GitHub Desktop.
Save nzwulfin/e2a1e79d6a41031e1dfd49ead0ccc80a to your computer and use it in GitHub Desktop.
Issues with ref parent with rollback vs upgrade
I chatted with miabbott on IRC to find the right `ostree rev-parse` syntax to find the parent of the current deployment:
`ostree rev-parse fedora-atomic/24/x86_64/docker-host^`
This would allow the test case to find the previous tree to deploy to test rollbacks and upgrades.
Building test cases for Tunir, I wanted to see what the error output would be for the very first tree in a release cycle (i.e. Fedora 24) so the test case wouldn't try to rollback to something that didn't exist.
After updating to the current tree (24.45) I then deployed 24, and rebooted. Once on 24, I rolled back to 24.45. The oddness happened here. I tried the `ostree rev-parse` command on this rolled back 24.45 and it threw the error as if the tree was still 24.
If I ran an upgrade from 24 to 24.45, the `ostree rev-parse` worked as expected and showed the parent, 24.44.
### Upgrade to latest (24.45)
[vagrant@fah-master ~]$ sudo atomic host upgrade
Updating from: fedora-atomic:fedora-atomic/24/x86_64/docker-host
128 metadata, 1587 content objects fetched; 115828 KiB transferred in 95 seconds
Copying /etc changes: 24 modified, 0 removed, 65 added
Transaction complete; bootconfig swap: yes deployment count change: 0
Freed objects: 479.3 MB
[vagrant@fah-master ~]$ sudo atomic host status
State: idle
Deployments:
fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24.45 (2016-09-18 01:58:21)
Commit: b1aaee15d913332740bb3badd493fe3ac9e2cc22914833481e2efca5cc48580b
OSName: fedora-atomic
● fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24.43 (2016-09-15 22:18:06)
Commit: b46e283bd4defb10757c4343ff4627f50ba10766a33b8f8c0a95b2f8824cdcb5
OSName: fedora-atomic
[vagrant@fah-master ~]$ sudo systemctl reboot
[vagrant@fah-master ~]$ sudo atomic host status
State: idle
Deployments:
● fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24.45 (2016-09-18 01:58:21)
Commit: b1aaee15d913332740bb3badd493fe3ac9e2cc22914833481e2efca5cc48580b
OSName: fedora-atomic
fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24.43 (2016-09-15 22:18:06)
Commit: b46e283bd4defb10757c4343ff4627f50ba10766a33b8f8c0a95b2f8824cdcb5
OSName: fedora-atomic
[vagrant@fah-master ~]$ ostree rev-parse fedora-atomic/24/x86_64/docker-host^
2304f6278e51ecc85404bfd6786e4b6181bef010a44f392a1a517975ddcc8e3c
### Deploy 24
[vagrant@fah-master ~]$ sudo atomic host deploy 24
Resolving version '24'
1019 metadata, 7017 content objects fetched; 250544 KiB transferred in 271 seconds
Copying /etc changes: 24 modified, 0 removed, 67 added
Transaction complete; bootconfig swap: yes deployment count change: 0
Freed objects: 154.0 MB
[vagrant@fah-master ~]$ sudo atomic host status
State: idle
Deployments:
fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24 (2016-07-20 17:21:21)
Commit: 076c89f879b14c24b5912c0daa389e1e8e227bc2456d4a59fe1619f5bd2c9202
OSName: fedora-atomic
● fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24.45 (2016-09-18 01:58:21)
Commit: b1aaee15d913332740bb3badd493fe3ac9e2cc22914833481e2efca5cc48580b
OSName: fedora-atomic
[vagrant@fah-master ~]$ sudo systemctl reboot
[vagrant@fah-master ~]$ sudo atomic host status
State: idle
Deployments:
● fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24 (2016-07-20 17:21:21)
Commit: 076c89f879b14c24b5912c0daa389e1e8e227bc2456d4a59fe1619f5bd2c9202
OSName: fedora-atomic
GPGSignature: (unsigned)
fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24.45 (2016-09-18 01:58:21)
Commit: b1aaee15d913332740bb3badd493fe3ac9e2cc22914833481e2efca5cc48580b
OSName: fedora-atomic
GPGSignature: (unsigned)
[vagrant@fah-master ~]$ ostree rev-parse fedora-atomic/24/x86_64/docker-host^
error: Commit 076c89f879b14c24b5912c0daa389e1e8e227bc2456d4a59fe1619f5bd2c9202 has no parent
### Rollback to 24.45, check `ostree rev-parse`
[vagrant@fah-master ~]$ sudo atomic host rollback
Moving 'b1aaee15d913332740bb3badd493fe3ac9e2cc22914833481e2efca5cc48580b.0' to be first deployment
Transaction complete; bootconfig swap: yes deployment count change: 0
[vagrant@fah-master ~]$ sudo systemctl reboot
[vagrant@fah-master ~]$ sudo atomic host status
State: idle
Deployments:
● fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24.45 (2016-09-18 01:58:21)
Commit: b1aaee15d913332740bb3badd493fe3ac9e2cc22914833481e2efca5cc48580b
OSName: fedora-atomic
fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24 (2016-07-20 17:21:21)
Commit: 076c89f879b14c24b5912c0daa389e1e8e227bc2456d4a59fe1619f5bd2c9202
OSName: fedora-atomic
[vagrant@fah-master ~]$ ostree rev-parse fedora-atomic/24/x86_64/docker-host^
error: Commit 076c89f879b14c24b5912c0daa389e1e8e227bc2456d4a59fe1619f5bd2c9202 has no parent
### Upgrade to 24.45 instead of rollback to 24.45
[vagrant@fah-master ~]$ sudo atomic host status
State: idle
Deployments:
● fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24 (2016-07-20 17:21:21)
Commit: 076c89f879b14c24b5912c0daa389e1e8e227bc2456d4a59fe1619f5bd2c9202
OSName: fedora-atomic
GPGSignature: (unsigned)
fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24.45 (2016-09-18 01:58:21)
Commit: b1aaee15d913332740bb3badd493fe3ac9e2cc22914833481e2efca5cc48580b
OSName: fedora-atomic
GPGSignature: (unsigned)
[vagrant@fah-master ~]$ ostree rev-parse fedora-atomic/24/x86_64/docker-host^
error: Commit 076c89f879b14c24b5912c0daa389e1e8e227bc2456d4a59fe1619f5bd2c9202 has no parent
[vagrant@fah-master ~]$ sudo atomic host upgrade
Updating from: fedora-atomic:fedora-atomic/24/x86_64/docker-host
Copying /etc changes: 24 modified, 0 removed, 73 added
Transaction complete; bootconfig swap: yes deployment count change: 0
[vagrant@fah-master ~]$ sudo atomic host status
State: idle
Deployments:
● fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24.45 (2016-09-18 01:58:21)
Commit: b1aaee15d913332740bb3badd493fe3ac9e2cc22914833481e2efca5cc48580b
OSName: fedora-atomic
fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24 (2016-07-20 17:21:21)
Commit: 076c89f879b14c24b5912c0daa389e1e8e227bc2456d4a59fe1619f5bd2c9202
OSName: fedora-atomic
[vagrant@fah-master ~]$ ostree rev-parse fedora-atomic/24/x86_64/docker-host^
2304f6278e51ecc85404bfd6786e4b6181bef010a44f392a1a517975ddcc8e3c
@nzwulfin
Copy link
Author

As far as I can tell, this happens with any rollback operation, not just rolling all the way back to the head. With a deploy of 24.44 from 24.45, a rollback shows the parent in ostree rev-parse shows the parent of 24.44 not the parent of 24.45.

[vagrant@fah-master ~]$ sudo atomic host status
State: idle
Deployments:
● fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24.44 (2016-09-16 23:15:10)
Commit: 2304f6278e51ecc85404bfd6786e4b6181bef010a44f392a1a517975ddcc8e3c
OSName: fedora-atomic

fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24.45 (2016-09-18 01:58:21)
Commit: b1aaee15d913332740bb3badd493fe3ac9e2cc22914833481e2efca5cc48580b
OSName: fedora-atomic
[vagrant@fah-master ~]$ ostree rev-parse fedora-atomic/24/x86_64/docker-host^
b46e283bd4defb10757c4343ff4627f50ba10766a33b8f8c0a95b2f8824cdcb5

[vagrant@fah-master ~]$ sudo atomic host rollback
Moving 'b1aaee15d913332740bb3badd493fe3ac9e2cc22914833481e2efca5cc48580b.1' to be first deployment
Transaction complete; bootconfig swap: no deployment count change: 0

[vagrant@fah-master ~]$ sudo atomic host status
State: idle
Deployments:
● fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24.45 (2016-09-18 01:58:21)
Commit: b1aaee15d913332740bb3badd493fe3ac9e2cc22914833481e2efca5cc48580b
OSName: fedora-atomic

fedora-atomic:fedora-atomic/24/x86_64/docker-host
Version: 24.44 (2016-09-16 23:15:10)
Commit: 2304f6278e51ecc85404bfd6786e4b6181bef010a44f392a1a517975ddcc8e3c
OSName: fedora-atomic
[vagrant@fah-master ~]$ ostree rev-parse fedora-atomic/24/x86_64/docker-host^
b46e283bd4defb10757c4343ff4627f50ba10766a33b8f8c0a95b2f8824cdcb5

Note the output is the same for both ostree rev-parse runs, even though we have a different active commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment