Skip to content

Linstor support #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,17 @@ used:
- `yumdl.conf.tmpl` used to download files for the RPM repository
included in the ISO

* The "repo" layers (e.g. `updates`) each provide a yum repo
configuration file, and optionally an `INCLUDE` file to pull
additional base repo layers. The `base` layer will always be in the
include chain.
* The "repo" layers (e.g. `updates`) each provide:
- `yum-repos.conf.tmpl`, a yum repo configuration template
- optional `INCLUDE` file to pull additional base repo layers. The
`base` layer contains a few extra files, and needs always be in
the include chain.

Template files will be expanded by string substitution of
`@@KEYWORD@@` patterns. Some of them are for the scripts' internal
use to fulfill tools requirements, a few of them are user-tunable,
notably the `@@SRCURL@@` one, controlled by the `--srcurl` and
`--srcurl:<overlay>` command-line flags.

Other recognized config files:

Expand Down Expand Up @@ -205,6 +212,36 @@ sudo ./scripts/create-installimg.sh \
8.3:testing install-8.3.testing.img
```

### 8.3 updates and linstor

The standalone linstor ISO requires extra packages from a separate
repository.

```
./scripts/mirror-repos.sh 8.3 ~/mirrors/xcpng
./scripts/mirror-repos.sh https://repo.vates.tech/xcp-ng/8/8.3 ~/mirrors/xcpng-rvt/8.3

sudo ./scripts/create-installimg.sh \
--srcurl file://$HOME/mirrors/xcpng/8.3 \
--output install-8.3.img \
8.3:updates

./scripts/create-iso.sh \
--srcurl file://$HOME/mirrors/xcpng/8.3 \
--srcurl:linstor file://$HOME/mirrors/xcpng-rvt/8.3 \
--output xcp-ng-8.3.linstor.iso \
--extra-packages "xcp-ng-linstor" \
-V "XCP-NG_830_TEST" \
8.3:updates:linstor install-8.3.img
```

> [!NOTE]
>
> This example only pulls the latest version of the LINSTOR packages.
> To be suitable for update of a LINSTOR-enabled XCP-ng 8.2.1, it must
> *also* be provided with the version matching the 8.2.1 installation.
Comment on lines +238 to +242
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's not handled in this PR, we'll need to spawn a new work item to address that before 8.2.1 EOL.



### tip of 8.2 (8.2 + updates)

```
Expand Down
1 change: 1 addition & 0 deletions configs/8.2/yumdl.conf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ basearch=@@RPMARCH@@
reposdir=@@YUMREPOSD@@
cachedir=@@CACHEDIR@@
persistdir=/dev/null
skip_missing_names_on_install=0
1 change: 1 addition & 0 deletions configs/8.3/yumdl.conf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ basearch=@@RPMARCH@@
reposdir=@@YUMREPOSD@@
cachedir=@@CACHEDIR@@
persistdir=/dev/null
skip_missing_names_on_install=0
6 changes: 6 additions & 0 deletions configs/linstor/yum-repos.conf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[xcpng-linstor]
name=xcpng - linstor
baseurl=@@SRCURL@@/linstor/@@RPMARCH@@/
gpgkey=https://xcp-ng.org/RPM-GPG-KEY-xcpng
failovermethod=priority
skip_if_unavailable=False
Copy link
Contributor Author

@ydirson ydirson Jun 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That last one is the default documented value already, we can surely drop it (and from everywhere else).

OTOH it is missing skip_missing_names_on_install=0 Edit: in fact no, that one is a [main] flag, not a per-repo one

1 change: 0 additions & 1 deletion scripts/create-installimg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ EOF
VERBOSE=
OUTPUT_IMG=
FORCE_OVERWRITE=0
SRCURL=
declare -A CUSTOM_REPOS=()
RPMARCH="x86_64"
while [ $# -ge 1 ]; do
Expand Down
22 changes: 19 additions & 3 deletions scripts/create-iso.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ Options:
-V <VOLID> (mandatory) ISO volume ID
--srcurl <URL> get RPMs from base-config and overlays from <URL>
default: https://updates.xcp-ng.org/<MAJOR>/<DIST>
--srcurl:<OVERLAY> <URL> get RPMs for specified <OVERLAY> from <URL>
default: the global <URL> controled by --srcurl
-D|--define-repo <NICK>!<URL>
add yum repo with name <NICK> and base URL <URL>
--extra-packages "<PACKAGE> [<PACKAGE> ...]"
include packages and their dependencies in repo
--efi-installer <mode> select how to build the GRUB EFI binary. Valid modes:
rpm: take prebuilt xenserver/grubx64.efi from rpm
mkimage: call mkimage to generate an EFI binary
Expand All @@ -35,7 +39,7 @@ OUTISO=
FORCE_OVERWRITE=0
DOREPO=1
SIGNSCRIPT=
SRCURL=
EXTRA_PACKAGES=
declare -A CUSTOM_REPOS=()
RPMARCH="x86_64"
EFIMODE="rpm"
Expand Down Expand Up @@ -69,6 +73,13 @@ while [ $# -ge 1 ]; do
SRCURL="$2"
shift
;;
--srcurl:*)
[ $# -ge 2 ] || die_usage "$1 needs an argument"
OVL="${1#--srcurl:}"
[ -n "$OVL" -a -d "$topdir/configs/$OVL" ] || die_usage "$1 does not name an existing overlay"
SRCURLS["$OVL"]="$2"
shift
;;
-D|--define-repo)
[ $# -ge 2 ] || die_usage "$1 needs an argument"
case "$2" in
Expand All @@ -83,6 +94,11 @@ while [ $# -ge 1 ]; do
CUSTOM_REPOS["$nick"]="$url"
shift
;;
--extra-packages)
[ $# -ge 2 ] || die_usage "$1 needs an argument"
EXTRA_PACKAGES="$2"
shift
;;
--efi-installer)
[ $# -ge 2 ] || die_usage "$1 needs an argument"
case "$2" in
Expand Down Expand Up @@ -148,7 +164,7 @@ ISODIR=$(mktemp -d "$TMPDIR/installiso.XXXXXX")
# temporary for storing downloaded files etc
SCRATCHDIR=$(mktemp -d "$TMPDIR/tmp.XXXXXX")

setup_yum_download "$DIST" "$RPMARCH" "$SRCURL"
setup_yum_download "$DIST" "$RPMARCH"


## put all bits together
Expand Down Expand Up @@ -231,7 +247,7 @@ if [ $DOREPO = 1 ]; then

mkdir ${VERBOSE} "$ISODIR/Packages"

get_rpms --depends "$ISODIR/Packages" xcp-ng-deps kernel-alt
get_rpms --depends "$ISODIR/Packages" xcp-ng-deps kernel-alt ${EXTRA_PACKAGES}
Comment on lines -234 to +250
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After stepping back, this clearly calls for getting packages from template files directly, the hardcoded xcp-ng-deps kernel-alt should have inspired this to start with - but given the timeframe, that will be for later (and that new option can still be useful)


createrepo_c ${VERBOSE} "$ISODIR"
if [ -n "$SIGNSCRIPT" ]; then
Expand Down
8 changes: 5 additions & 3 deletions scripts/lib/misc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ find_all_configs() {

# default src URL depending on selected $DIST

SRCURL=
declare -A SRCURLS=()

maybe_set_srcurl() {
[ $# = 1 ] || die "maybe_set_srcurl: need exactly 1 argument"
DIST="$1"
Expand Down Expand Up @@ -111,10 +114,9 @@ yumdl_is_dnf() {
}

setup_yum_download() {
[ $# = 3 ] || die "setup_yum_download: need exactly 3 arguments"
[ $# = 2 ] || die "setup_yum_download: need exactly 2 arguments"
DIST="$1"
RPMARCH="$2"
SRCURL="$3"

YUMDLCONF_TMPL=$(find_config yumdl.conf.tmpl)

Expand Down Expand Up @@ -154,7 +156,7 @@ setup_yum_repos() {
reponame=$(basename $(dirname "$YUMREPOSCONF_TMPL"))
cat "$YUMREPOSCONF_TMPL" |
sed \
-e "s,@@SRCURL@@,$SRCURL," \
-e "s,@@SRCURL@@,${SRCURLS[$reponame]:-$SRCURL}," \
-e "s,@@RPMARCH@@,$RPMARCH," \
> "$YUMREPOSD/$reponame.repo"
done
Expand Down
2 changes: 1 addition & 1 deletion scripts/mirror-repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ command -v lftp >/dev/null || die "required tool not found: lftp"
lftp -c mirror \
--verbose \
--delete \
--exclude="/Source/|-debuginfo-|-devel[-_]|/xs-opam-repo|/ocaml|/golang|/java" \
--exclude="/Source/|-debuginfo-|-debug-|-devel[-_]|/xs-opam-repo|/ocaml|/golang" \
"$SRCURL" "$TARGET"