summaryrefslogtreecommitdiff
path: root/extensions/writeexts.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix bug in fstab layout generationRichard Ipsum2015-11-021-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a bug in our fstab layout generation, currently we fail to generate the complete fstab layout, so /etc/fstab in any newly deployed or upgraded baserocks contains just: # Morph default system layout UUID=<uuid> / btrfs defaults,rw,noatime 0 1 This is actually a pretty bad problem because it breaks system-version-manager, since systemd creates a btrfs subvolume and mounts it to /var/lib/machines if /var/lib/machines doesn't already exist[1]. As a result system-version-manager when asked to remove an image will fail to do so, since it will fail to remove the /run subvolume because of the subvolume created at /run/var/lib/machines. The result is a partially removed image that cannot be removed with system-version-manager. The fstab layout we use currently: UUID=<uuid> / btrfs defaults,rw,noatime 0 1 UUID=<uuid> /var btrfs subvol=/state/var,defaults,rw,noatime 0 2 UUID=<uuid> /opt btrfs subvol=/state/opt,defaults,rw,noatime 0 2 UUID=<uuid> /srv btrfs subvol=/state/srv,defaults,rw,noatime 0 2 UUID=<uuid> /root btrfs subvol=/state/root,defaults,rw,noatime 0 2 UUID=<uuid> /home btrfs subvol=/state/home,defaults,rw,noatime 0 2 ensures that anything created under /var goes into a shared /state/var subvolume, so when systemd creates its 'machines' subvolume it will be under state/ which doesn't cause any problems when we try to remove a system. To reproduce, deploy an upgrade to your machine, reboot into the upgraded system, when you cat /etc/fstab you should see only one entry, mounting /. Now switch back to the previous image with, system-version-manager set-default <previous image name> reboot remove the newly deployed image with, system-version-manager remove <upgraded image name> after some time this will fail with an error message similar to this: Removing system: faultylayout Delete subvolume (no-commit): '/tmp/tmp1gdIL2/systems/faultylayout/run' ERROR: cannot delete '/tmp/tmp1gdIL2/systems/faultylayout/run' - Directory not empty Delete subvolume (no-commit): '/tmp/tmp1gdIL2/systems/faultylayout/orig' Traceback (most recent call last): File "/usr/bin/system-version-manager", line 421, in <module> SystemVersionManager(sys.argv, mount_dir).run() File "/usr/bin/system-version-manager", line 401, in run self.cmd_remove(args.system_name) File "/usr/bin/system-version-manager", line 363, in cmd_remove shutil.rmtree(system_root) File "/usr/lib/python2.7/shutil.py", line 247, in rmtree rmtree(fullname, ignore_errors, onerror) File "/usr/lib/python2.7/shutil.py", line 247, in rmtree rmtree(fullname, ignore_errors, onerror) File "/usr/lib/python2.7/shutil.py", line 247, in rmtree rmtree(fullname, ignore_errors, onerror) File "/usr/lib/python2.7/shutil.py", line 247, in rmtree rmtree(fullname, ignore_errors, onerror) File "/usr/lib/python2.7/shutil.py", line 256, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/usr/lib/python2.7/shutil.py", line 254, in rmtree os.rmdir(path) OSError: [Errno 1] Operation not permitted: '/tmp/tmp1gdIL2/systems/faultylayout/run/var/lib/machines [1]: http://cgit.freedesktop.org/systemd/systemd/commit/?id=113b3fc1a8061f4a24dd0db74e9a3cd0083b2251 Change-Id: I9c160d1fdd75fbbf9a3336d1ce35e4ce8ed7787d
* Rawdisk partitioning v2: Add partitioning functionsEdward Cragg2015-10-241-40/+283
| | | | | | Add partitioning functions to the rawdisk.write deployment extension Change-Id: I45bcabc191951d086b8f4ae028a248f95a5e6f2e
* writeexts.py: Capture stderr so that errors are capturedEdward Cragg2015-07-301-1/+1
| | | | | | | | The conversion from cliapp to the direct use of subprocess left a call which did not capture stderr, so `stderr=subprocess.STDOUT` is added to maintain the expected behaviour. Change-Id: I3ee0c064f9813d15004234d4daea81dc8219fc42
* Remove dependencies on morphlib and cliapp from deployment extensionsbaserock/adamcoldrick/remove-dependencies-v3Adam Coldrick2015-06-111-56/+167
| | | | | | | | | | | | | | | | This is done by either copying some utility functions from morph into writeexts.py, and using the `subprocess` module rather than cliapp's runcmd and ssh_runcmd. Note that this means that these extensions will require "$definitions_checkout/extensions" in PYTHONPATH when they are run. This commit also updates VERSION to 5, since the PYTHONPATH requirement means that this change is incompatible with old versions of morph. Change-Id: Iec6fa7e3c7219619ce55e18493e5c37c36e97816
* Stop writeexts.py depending on morphlibAdam Coldrick2015-06-101-6/+17
| | | | Change-Id: I7f3702e80678aeee89dd22116510a6d8d7e04841
* Put writeexts.py in extensions subdirectoryAdam Coldrick2015-06-101-0/+624
Change-Id: I6eb8fe69416bbf483ffa8c1c317c8f8cea56ef0e