Comment 13 for bug 1817321

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Test procedure for the partman-iscsi changes
============================================

Based on the previous comment setup.

iSCSI initiator:
---------------

...

Note there's no 'iscsi_auto' in the kernel cmdline:

    iPXE> ifopen net0
    iPXE> kernel http://192.168.122.1:8000/vmlinuz initrd=initrd.gz --- console=ttyS0
    iPXE> initrd http://192.168.122.1:8000/initrd.gz
    iPXE> boot

Back to serial console.
Proceed with the installer.

In 'Users and passwords' dialogs, select 'Go back', and 'Execute a shell', and 'Continue'.

Bring up the iSCSI devices with iBFT
(manually or with patched disk-detect udeb)

    ~ # modprobe iscsi_ibft

    ~ # iscsistart -N
    Setting up software interface ens4

~ # iscsistart -b
iscsistart: Logging into iqn.2019-03.com.example:target1 10.0.0.1:3260,1
iscsistart: version 2.0-874
iscsistart: Connection1:0 to [target: iqn.2019-03.com.example:target1, portal: 10.0.0.1,3260] through [iface: default] is operational now

~ # dmesg | grep -e iBFT -e sd
[ 0.007308] iBFT found at 0x9e520.
[ 94.949058] iBFT detected.
[ 105.158333] sd 2:0:0:1: Attached scsi generic sg2 type 0
[ 105.158800] sd 2:0:0:1: Power-on or device reset occurred
[ 105.161642] sd 2:0:0:1: [sda] 16777216 512-byte logical blocks: (8.59 GB/8.00 GiB)
[ 105.161646] sd 2:0:0:1: [sda] 4096-byte physical blocks
[ 105.161970] sd 2:0:0:1: [sda] Write Protect is off
[ 105.161974] sd 2:0:0:1: [sda] Mode Sense: 69 00 10 08
[ 105.162645] sd 2:0:0:1: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA
[ 105.174899] sd 2:0:0:1: [sda] Attached SCSI disk

See interface 1 (ens3) is default interface in 192.168.122.0/24 range,
and interface 2 (ens4) is a iSCSI interface in 10.0.0.0/24 range.

~ # ip addr list
...
2: ens3: ...
    link/ether 52:54:00:00:00:01 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.162/24 brd 192.168.122.255 scope global ens3
...
3: ens4: ...
    link/ether 52:54:00:00:00:02 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.2/24 brd 10.0.0.255 scope global ens4
...

Return with 'exit' and proceed with the installer until the 'Partition disks' dialog.

Test #0) Original partman-iscsi
----

In 'Partition disks' dialogs, select 'Go back', and 'Change debconf priority', and 'Continue', and 'low'.

Return to the 'Partition disks' dialog.
Select 'Guided partitioning',
and 'Guided - use entire disk',
and 'SCSI3 (0,0,1) (sda) - 8.6 GB IET VIRTUAL-DISK,
and 'All files in one partition (recommended for new users)',
and 'Finish partitioning and write changes to disk',
and 'No' in 'No partitions for use as swap space',
and 'Yes' in 'Write the changes to disks?',
and 'Continue' and 'Continue' for swap file questions.

This should partition and format the disk, and return to the menu, as the debconf priority is 'low'.

Select 'Execute a shell', and 'Continue'.

See that the wrong network interface is used for the HWADDR field in iscsi.initramfs
(trailing :01 instead of :02).

~ # cat /target/etc/iscsi/iscsi.initramfs
HWADDR="52:54:00:00:00:01"
ISCSI_TARGET_NAME="iqn.2019-03.com.example:target1"
ISCSI_TARGET_IP="10.0.0.1"
ISCSI_TARGET_PORT="3260"
ISCSI_TARGET_GROUP="1"

Test #1) Patched partman-iscsi, changes for patch 1/2
----
(use the iSCSI interface for HWADDR and /etc/network/interfaces)

Install the patched udeb:

    ~ # wget http://ppa.launchpad.net/mfo/sf211547v2/ubuntu/pool/main/p/partman-iscsi/partman-iscsi_40ubuntu4.18.04.1_all.udeb
    ~ # udpkg --unpack partman-iscsi_40ubuntu4.18.04.1_all.udeb

Verify the new option is not yet enabled.

    ~ # debconf-get partman-iscsi/iscsi_auto
    false

Unmount the swap so 'Partition disks' can work again.

~ # swapoff /target/swapfile

Return with 'exit' and repeat the 'Partition disks'/'Execute a shell' procedure from Test #0.

See that the iSCSI network interface is now used in HWADDR:

~ # cat /target/etc/iscsi/iscsi.initramfs
HWADDR="52:54:00:00:00:02"
ISCSI_TARGET_NAME="iqn.2019-03.com.example:target1"
ISCSI_TARGET_IP="10.0.0.1"
ISCSI_TARGET_PORT="3260"
ISCSI_TARGET_GROUP="1"

Test #2) Patched partman-iscsi, changes for patch 2/2
----
(use ISCSI_AUTO=true in /etc/iscsi/iscsi.initramfs)

Now enable the 'partman-iscsi/iscsi_auto' option,
and start a new debconf/menu to detect its value:

Install the patched udeb again, so the option re-appears:

    ~ # debconf-get partman-iscsi/iscsi_auto
    ~ #

    ~ # udpkg --unpack partman-iscsi_40ubuntu4.19.04.1_all.udeb

    ~ # debconf-get partman-iscsi/iscsi_auto
    false
    ~ # debconf-set partman-iscsi/iscsi_auto true
    ~ # debconf-get partman-iscsi/iscsi_auto
    true

~ # swapoff /target/swapfile

    ~ # debconf -o d-i /usr/bin/main-menu

Repeat the 'Partition disks'/'Execute a shell' procedure from Test #0.

See that 'ISCSI_AUTO=true' is not configured in 'iscsi.initramfs'.

    ~ # cat /target/etc/iscsi/iscsi.initramfs
    ISCSI_AUTO=true

Return with 'exit', then 'Change debconf priority' to 'high' again, and proceed/finish the installation.

System reboots.

Back to VNC console, go again to iPXE shell:

    $ vncviewer <address>:1
    iPXE <...>
    <wait for NIC address detection>

    Press Ctrl-B for iPXE command line.
    ^B

    iPXE>

Configure iSCSI NIC:

    iPXE> ifopen net1
    iPXE> set net1/ip 10.0.0.2
    iPXE> set net1/netmask 255.255.255.0

Boot from iSCSI (iSCSI portal 10.0.0.1, LUN 1 on target iqn.<...>:target1)

    iPXE> sanboot iscsi:10.0.0.1:::1:iqn.2019-03.com.example:target1
    Registered SAN device 0x80
    Booting from SAN device 0x80

Back to serial console.
Watch the system boot with ISCSI_AUTO=true (no iscsi_auto kernel cmdline option):

 ...

 Setting up software interface ens4
 no search or nameservers found in /run/net-ens4.conf /run/net-ens4.conf /run/net6-*.conf
 iscsistart: Logging into iqn.2019-03.com.example:target1 10.0.0.1:3260,1
 iscsistart: version 2.0-874
 iscsistart: Connection1:0 to [target: iqn.2019-03.com.example:target1, portal: 10.0.0.1,3260] through [iface: default] is operational now
 /dev/sda1: recovering journal
 /dev/sda1: clean, 60269/524288 files, 479003/2096640 blocks

 ...

 ubuntu login: ubuntu
 Password:

 ubuntu@ubuntu:~$ mount | grep -w /
 /dev/sda1 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)

 ubuntu@ubuntu:~$ ls -ld /sys/block/sda
 lrwxrwxrwx 1 root root 0 Mar 22 20:15 /sys/block/sda -> ../devices/platform/host3/session1/target3:0:0/3:0:0:1/block/sda

 ubuntu@ubuntu:~$ cat /sys/devices/platform/host3/session1/iscsi_session/session1/targetname
 iqn.2019-03.com.example:target1

 ubuntu@ubuntu:~$ sudo cat /etc/iscsi/iscsi.initramfs
 ISCSI_AUTO=true

 ubuntu@ubuntu:~$ ip addr list
 ...
 2: ens3: ...
     link/ether 52:54:00:00:00:01 brd ff:ff:ff:ff:ff:ff
     inet 192.168.122.163/24 brd 192.168.122.255 scope global dynamic ens3
 ...
 3: ens4: ...
     link/ether 52:54:00:00:00:02 brd ff:ff:ff:ff:ff:ff
     inet 10.0.0.2/24 brd 10.0.0.255 scope global ens4
 ...

 ubuntu@ubuntu:~$ sudo cat /etc/netplan/01-netcfg.yaml
 # This file describes the network interfaces available on your system
 # For more information, see netplan(5).
 network:
   version: 2
   renderer: networkd
   ethernets:
     ens3:
       dhcp4: yes