Vim seems lost and breaks syntax highlighting when it is dealing with
unescaped asterisks in the markdown content. Let's escape the asterisks
to make it happy.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Running 'make' or 'make html' will now convert the links to .md files
into links to .html files so that the documentation can be browsed
locally as HTML files. This will also produce the HTML output under
html/.
Running 'make discourse' will convert the links to .md files into links
to the existing discourse pages. The output MD files will be placed
under discourse/
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
For some reason, pandoc seems to struggle to create anchor links if
there is no space between the <a> tag and the title. Add a newline to
make it happy.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
If subiquity detects it should not add a swapfile (e.g., swap partition
present, or root filesystem on btrfs), it renders this curtin config:
swap:
swap: 0
But that should be:
swap:
size: 0
Per the curtin docs [1]:
swap
size: <Size string>
Configure the exact size of the swapfile. Setting size to 0 will disable swap.
[1] https://curtin.readthedocs.io/en/latest/topics/config.html#swap
Tests: (build snap/modify ISO as in README.md)
- before:
$ cat /proc/swaps
Filename ...
/swap.img ...
/dev/vda3 ...
$ sudo grep -A1 ^swap: \
/var/log/installer/curtin-install/subiquity-partitioning.conf
swap:
swap: 0
- after:
$ cat /proc/swaps
Filename ...
/dev/vda3 ...
$ sudo grep -A1 ^swap: \
/var/log/installer/curtin-install/subiquity-partitioning.conf
swap:
size: 0
LP: #1927103
Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
In the following patch:
4c59e1ee never return a PROBING response from guided_POST
we fixed a UI crash occurring when a storage probing operation was
ongoing while the user would enter the partitioning screen with "Use
an entire disk".
To address the issue, we made POST /storage/guided return the last
(cached) successful probe result rather than returning a potential
PROBING status result.
That being said, when "Custom Storage Layout" is selected, we are using
a different HTTP call: GET /storage which can also return a PROBING
status result. So our fix was only partial.
This patch adds a "use_cached_result" parameter (which defaults to
false) to GET /storage. This makes the call return the last successful
probe result.
When the client selects "Custom Storage Layout" we now explicitly
request a cached result so that we don't have to deal with a potential
PROBING status response.
Ideally, we should either:
* make the client aware that a PROBING status can be returned and act
accordingly.
* pass the wait=true argument to GET /storage or POST /storage/guided
But doing so has other implications and the kinetic release is imminent.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
For some reason that we have not yet determined, the overlay that we use
for the drivers code sometimes fails to unmount with EBUSY.
When it happens, the _list_drivers task would fail, making subsequent
GET calls to /drivers?wait=true fail as well and produce an error
report.
We now mark failures in the overlay unmount operation as non fatal.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The apt.overlay construct unmounts the overlay at the end of the with
body. To do so, it leans on subprocess.run(["umount", ...], check=True).
If we want to catch the unmount error, we need to do:
try:
with apt.overlay():
# do stuff
except subprocess.CalledProcessError:
# handle the unmount exception
However, we do not want the subprocess exceptions that happen in
the with body to be caught in the same except block.
If the umount call fails, we now wrap the exception in a
OverlayCleanupError ; therefore we can make the distinction between an
unmount error and a subprocess error that would happen in the body.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The behavior of asyncio.get_event_loop() will change in a future Python
version. It is deprecated starting Python 3.10.
The functions that we can use instead are:
* asyncio.new_event_loop() - which creates a new event loop
* asyncio.get_running_loop() - which returns the event loop only if it
is already running
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Creating a aiohttp connector when no event loop is running is not
considered safe. Under the hood, aiohttp invokes
asyncio.get_event_loop() which:
1. currently creates a new event loop if one does not already exist
2. will stop creating a new event loop in a future Python release
3. is deprecated starting Python 3.10
We want to make sure Subiquity creates the event loop itself, so we now
create the aiohttp connector in a coroutine.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
When size: -1 is specified on a given partition, we attempt to determine
the its right size by looping through the partitions and computing a
list of available gaps.
That said, when looping through the partitions, we also include the one
which has an incomplete (i.e. = -1) size. This makes the computation
rely on a negative value and this often leads to incorrect result.
Fixed by excluding the current partition when determining its
appropriate size.
https://bugs.launchpad.net/ubuntu/+source/subiquity/+bug/1991929
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
When storage version 2 is used, partitions require an offset. When
loading partitions via an autoinstall file, we now make sure to assign
offsets automatically if the user did not specify offsets.
https://bugs.launchpad.net/ubuntu/+source/subiquity/+bug/1991413
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The available_for_partitions function wrongly assumed that the
underlying disk had a GPT partition table. Updated the implementation to
use the alignment data as expected.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
In the new tests recently added to test_filesystem.py, the initial disk
object was marked having a msdos partition table.
This is fine for computing offsets manually. However, what really needs
to be done is to mark the partition table as msdos in the YAML itself.
Otherwise, the disk is reformatted as GPT.
This makes gap functions use the right alignment data when computing the
list of gaps available.
Sadly it breaks the tests because of other issues, so I added FIXME tags
in the broken tests.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
To avoid having nested contexts for one step. It's a bit unsatisfying
because conceptually the code in CurtinPartitioningStep.run should be
considered part of the same context but I don't see a good way to do
that and it's not of practical significance.