-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
430 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
Cockpit Storage in Anaconda Mode | ||
================================ | ||
|
||
Anaconda (the OS Installer) can open the Cockpit "storaged" page for | ||
advanced setup of the target storage devices. When this is done, | ||
storaged is in a special "Anaconda mode" and behaves significantly | ||
different. | ||
|
||
In essence, the storaged page restricts itself to working with the | ||
target environment. It will hide the real root filesystem (on the USB | ||
stick that the Live environment was booted from, say), but let the | ||
user create a "fake" root filesystem on some block device. | ||
|
||
Entering Anaconda mode | ||
---------------------- | ||
|
||
The "storaged" page is put into Anaconda mode by storing a | ||
"cockpit_anaconda" item in its `window.localStorage`. The value | ||
should be a JSON encoded object, the details of which are explained | ||
below. | ||
|
||
Since both Anaconda and the storaged page are served from the same | ||
origin, Anaconda can just execute something like this: | ||
|
||
``` | ||
window.localStorage.setItem("cockpit_anaconda", | ||
JSON.stringify({ | ||
"mount_point_prefix": "/sysroot", | ||
"available_devices": [ "/dev/sda" ] | ||
})); | ||
window.open("/cockpit/@localhost/storage/index.html", "storage-tab"); | ||
``` | ||
|
||
Ignoring storage devices | ||
------------------------ | ||
|
||
Anaconda needs to tell Cockpit which devices can not be used to | ||
install the OS on. This is done with the "available_devices" entry, | ||
which is an array of strings. | ||
|
||
``` | ||
{ | ||
"available_devices": [ "/dev/sda" ] | ||
} | ||
``` | ||
|
||
This list should only contain entries for top-level block devices. It | ||
should not contain things like partitions, device mapper devices, or | ||
mdraid devices. | ||
|
||
Mount point prefix | ||
------------------ | ||
|
||
Cockpit can be put into a kind of "chroot" environment by giving it a | ||
mount point prefix like so: | ||
|
||
``` | ||
{ | ||
"mount_point_prefix": "/sysroot" | ||
} | ||
``` | ||
|
||
This works at the UI level: filesystems that have mount points outside | ||
of "/sysroot" are hidden from the user, and when letting the user work | ||
with mount points below "/sysroot", the "/sysroot" prefix is | ||
omitted. So when the user says to create a filesystem on "/var", they | ||
are actually creating one on "/sysroot/var". | ||
|
||
However, Cockpit (via UDisks2) will still write the new mount point | ||
configuration into the real /etc/fstab (_not_ /sysroot/etc/fstab). | ||
|
||
In addition to that, Cockpit will also store the mount points in the | ||
`"cockpit_mount_points"` item in `window.localStorage`, as a JSON | ||
encoded object, for the benefit of Anaconda. | ||
|
||
This is a simple map from mount point to block device, like | ||
|
||
``` | ||
{ | ||
"/boot": "/dev/vda1", | ||
"/": "/dev/vda2" | ||
} | ||
``` | ||
|
||
The mount points do not include the mount point prefix. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* This file is part of Cockpit. | ||
* | ||
* Copyright (C) 2023 Red Hat, Inc. | ||
* | ||
* Cockpit is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 2.1 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Cockpit is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Cockpit; If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import cockpit from "cockpit"; | ||
import React from "react"; | ||
import client from "./client.js"; | ||
|
||
import { StackItem } from "@patternfly/react-core/dist/esm/layouts/Stack/index.js"; | ||
import { Alert } from "@patternfly/react-core/dist/esm/components/Alert/index.js"; | ||
|
||
const _ = cockpit.gettext; | ||
|
||
export const AnacondaAdvice = () => { | ||
if (!client.in_anaconda_mode()) | ||
return null; | ||
|
||
return ( | ||
<StackItem> | ||
<Alert isInline | ||
variant='info' | ||
title={_("What you need to do")}> | ||
<p>Anaconda will tell us here what is wrong with the current config.</p> | ||
</Alert> | ||
</StackItem> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.