Skip to content
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

feat: support local iso mount for unattended install #673

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

starbops
Copy link
Member

@starbops starbops commented Mar 9, 2024

Problem:

We want a blazing-fast way to spin up virtualized Harvester nodes for testing or something. It'd be better to have dependencies as few as possible.

Solution:

When in the auto-install mode and the local keyword is provided in the ISO_URL variable, the installer will try to mount the ISO from the local device /dev/sr0.

Related Issue:

harvester/harvester#5385

Test plan:

Fire the following two commands to create a 2-node Harvester cluster.

# create mode (static)
CPUS=8
MEM=16384
DISK=300
HOSTNAME=node-0
IP=192.168.48.224
GW=192.168.48.1
NETMASK=255.255.255.0
DNS=1.1.1.1
MGMT_NIC=ens3
ISO=/tmp/harvester-master-amd64.iso
PASSWD=password
TOKEN=thisissecret
VIP=192.168.48.240

virt-install \
    --name="$HOSTNAME" \
    --cpu=host-passthrough \
    --vcpus="$CPUS" \
    --memory="$MEM" \
    --disk path="$HOSTNAME"-disk-0.qcow2,format=qcow2,bus=virtio,size="$DISK" \
    --location="$ISO",kernel=boot/kernel,initrd=boot/initrd \
    --network=bridge=br0,model=virtio \
    --os-type=linux \
    --os-variant=auto \
    --extra-args=" \
        console=tty1 \
        ip=$IP::$GW:$NETMASK:$HOSTNAME:$MGMT_NIC:none:$DNS \
        net.ifnames=1 \
        rd.cos.disable \
        rd.live.dir=/ \
        rd.live.squashimg=rootfs.squashfs \
        root=live:CDLABEL=COS_LIVE \
        harvester.os.dns_nameservers=$DNS \
        harvester.os.hostname=$HOSTNAME \
        harvester.os.ntp_servers=0.suse.pool.ntp.org \
        harvester.os.password=$PASSWD \
        harvester.scheme_version=1 \
        harvester.token=$TOKEN \
        harvester.install.automatic=true \
        harvester.install.device=/dev/vda \
        harvester.install.iso_url=local \
        harvester.install.management_interface.bond_options.miimon=100 \
        harvester.install.management_interface.bond_options.mode=balance-tlb \
        harvester.install.management_interface.gateway=$GW \
        harvester.install.management_interface.interfaces=name:$MGMT_NIC \
        harvester.install.management_interface.ip=$IP \
        harvester.install.management_interface.method=static \
        harvester.install.management_interface.subnet_mask=$NETMASK \
        harvester.install.mode=create \
        harvester.install.skipchecks=true \
        harvester.install.tty=tty1 \
        harvester.install.vip=$VIP \
        harvester.install.vip_mode=static" \
    --noautoconsole \
    --graphics=vnc \
    --wait
# join mode (static)
CPUS=4
MEM=8192
DISK=300
HOSTNAME=node-1
IP=192.168.48.225
GW=192.168.48.1
NETMASK=255.255.255.0
DNS=1.1.1.1
MGMT_NIC=ens3
ISO=/tmp/harvester-master-amd64.iso
PASSWD=password
TOKEN=thisissecret
VIP=192.168.48.240

virt-install \
    --name="$HOSTNAME" \
    --cpu=host-passthrough \
    --vcpus="$CPUS" \
    --memory="$MEM" \
    --disk path="$HOSTNAME"-disk-0.qcow2,format=qcow2,bus=virtio,size="$DISK" \
    --location="$ISO",kernel=boot/kernel,initrd=boot/initrd \
    --network=bridge=br0,model=virtio \
    --os-type=linux \
    --os-variant=auto \
    --extra-args=" \
        console=tty1 \
        ip=$IP::$GW:$NETMASK:$HOSTNAME:$MGMT_NIC:none:$DNS \
        net.ifnames=1 \
        rd.cos.disable \
        rd.live.dir=/ \
        rd.live.squashimg=rootfs.squashfs \
        root=live:CDLABEL=COS_LIVE \
        harvester.os.dns_nameservers=$DNS \
        harvester.os.hostname=$HOSTNAME \
        harvester.os.ntp_servers=0.suse.pool.ntp.org \
        harvester.os.password=$PASSWD \
        harvester.scheme_version=1 \
        harvester.server_url=https://$VIP:443 \
        harvester.token=$TOKEN \
        harvester.install.automatic=true \
        harvester.install.device=/dev/vda \
        harvester.install.iso_url=local \
        harvester.install.management_interface.bond_options.miimon=100 \
        harvester.install.management_interface.bond_options.mode=balance-tlb \
        harvester.install.management_interface.gateway=$GW \
        harvester.install.management_interface.interfaces=name:$MGMT_NIC \
        harvester.install.management_interface.ip=$IP \
        harvester.install.management_interface.method=static \
        harvester.install.management_interface.subnet_mask=$NETMASK \
        harvester.install.mode=join \
        harvester.install.skipchecks=true \
        harvester.install.tty=tty1" \
    --noautoconsole \
    --graphics=vnc \
    --wait

When in the auto-install mode and the "local" keyword is provided in
the "ISO_URL" variable, the installer will try to mount the ISO from the
local device /dev/sr0.

Signed-off-by: Zespre Chang <zespre.chang@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant