zhhuabj

Untitled

Sep 22nd, 2026
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.09 KB | None | 0 0
  1. #The full test steps
  2.  
  3.  
  4. Test env - use existing test env described in lp bug
  5.  
  6. n1 system-id: 6bhqr3
  7. n1 net1: 172.16.1.201/24
  8. n1 net1 MAC: 52:54:00:87:02:a4
  9. x99/vsw1: 172.16.1.1
  10. MAAS/enp7s0: 172.16.1.253
  11. iSCSI portal: 172.16.1.1:3260
  12. iSCSI target: iqn.2017-02.com.quqi:storage
  13. Initiator: iqn.2017-02.com.quqi:lv-vm1
  14.  
  15. 1, Run on my working machine with fix, prepare the before-fix and after-fix
  16.  
  17. cd /bak/work/open-iscsi
  18. rm -rf /tmp/lp2147499-test
  19. mkdir -p /tmp/lp2147499-test
  20.  
  21. hua@y9000p:/bak/work/open-iscsi$ git log --oneline -3
  22. 06a3d32 (HEAD -> jammy-devel, zhhuabj/jammy-devel) changelog for static bootproto normalization
  23. 5dd7736 normalize static bootproto for initramfs netplan conversion
  24. 288b3bc (tag: import/2.1.5-1ubuntu1.1, origin/ubuntu/jammy-updates, jammy-updates) 2.1.5-1ubuntu1.1 (patches unapplied)
  25.  
  26. TIP_COMMIT=$(git rev-parse HEAD)
  27. FIX_COMMIT=$(git rev-parse HEAD^)
  28. BASE_COMMIT=$(git rev-parse HEAD^^)
  29. git show "${BASE_COMMIT}:debian/extra/initramfs.local-top" > /tmp/lp2147499-test/iscsi.before
  30. git show "${TIP_COMMIT}:debian/extra/initramfs.local-top" > /tmp/lp2147499-test/iscsi.after
  31. chmod 0755 /tmp/lp2147499-test/iscsi.before /tmp/lp2147499-test/iscsi.after
  32.  
  33. #verify the fix
  34. hua@y9000p:/bak/work/open-iscsi$ echo '=== BEFORE ===' && grep -nE 'STATIC\)|IPV4PROTO|PROTO="static"|PROTO="none"' /tmp/lp2147499-test/iscsi.before
  35. === BEFORE ===
  36. 110: PROTO="none"
  37. 172: STATIC) PROTO="static" ;;
  38.  
  39. hua@y9000p:/bak/work/open-iscsi$ echo '=== AFTER ==='
  40. grep -nE 'STATIC\)|IPV4PROTO|PROTO="static"|PROTO="none"' /tmp/lp2147499-test/iscsi.after
  41. === AFTER ===
  42. 110: PROTO="none"
  43. 111: IPV4PROTO=""
  44. 127: echo "IPV4PROTO='${IPV4PROTO}'"
  45. 175: IPV4PROTO="dhcp"
  46. 177: STATIC)
  47. 179: # Keep IPV4PROTO=static for consumers that parse /run/network/dynamic-interfaces.
  48. 180: PROTO="none"
  49. 181: IPV4PROTO="static"
  50. 185: IPV4PROTO="${v}"
  51.  
  52.  
  53.  
  54. 2, Test env is on the machine x99, so copy fixes into x99
  55.  
  56. scp -r /tmp/lp2147499-test hua@x99:/tmp/
  57.  
  58.  
  59. 3, on machine x99
  60.  
  61. cd /tmp/lp2147499-test
  62. nohup python3 -m http.server 8081 --bind 172.16.1.1 >/tmp/lp2147499-http.log 2>&1 &
  63.  
  64. #verify
  65. curl -f http://172.16.1.1:8081/iscsi.before | grep 'PROTO="static"'
  66. curl -f http://172.16.1.1:8081/iscsi.after |grep 'IPV4PROTO="static"'
  67.  
  68. 4, verify maas pxe url
  69.  
  70. hua@x99:/tmp/lp2147499-test$ curl -f http://172.16.1.253:5248/ipxe.cfg-52:54:00:87:02:a4
  71. #!ipxe
  72. # Boot the locally attached hard drives. On failure try the next locally
  73. # attached hard drive. Fail on the last hard drive, if booting fails.
  74. sanboot --no-describe --drive 0x80 ||
  75. sanboot --no-describe --drive 0x81 ||
  76. sanboot --no-describe --drive 0x82 ||
  77. sanboot --no-describe --drive 0x83
  78.  
  79.  
  80. 5, configure libvirt iBFT boot
  81.  
  82. hua@x99:/tmp/lp2147499-test$ sudo virsh dumpxml n1 > /tmp/n1.before-lp2147499.xml
  83. sha256sum /tmp/n1.before-lp2147499.xml
  84. acc97255513df510a75dc567364500eba7d7e9045dffaa32d2356c098aafd632 /tmp/n1.before-lp2147499.xml
  85.  
  86. sudo virt-xml n1 --edit --boot kernel=/usr/lib/ipxe/ipxe.lkrn,\
  87. kernel_args="ifclose net0 && ifclose net1 && set initiator-iqn iqn.2017-02.com.quqi:lv-vm1 && set net1/ip 172.16.1.201 && set net1/netmask 255.255.255.0 && set net1/gateway 172.16.1.1 && ifopen net1 && sanhook iscsi:172.16.1.1:::0:iqn.2017-02.com.quqi:storage && chain http://172.16.1.253:5248/ipxe.cfg-\${net1/mac} || shell"
  88. sudo virsh dumpxml n1 |sed -n '/<os>/,/<\/os>/p'
  89.  
  90. hua@x99:~$ curl -f http://172.16.1.253:5248/ipxe.cfg-52:54:00:87:02:a4
  91. #!ipxe
  92. kernel http://172.16.1.253:5248/images/ce7011b/ubuntu/amd64/ga-22.04/jammy/stable/boot-kernel
  93. imgargs boot-kernel nomodeset root=squash:http://172.16.1.253:5248/images/e5d9ed4/ubuntu/amd64/ga-22.04/jammy/stable/squashfs ip=::::n1:BOOTIF ip6=off cc:{'datasource_list': ['MAAS']}end_cc cloud-config-url=http://172.16.1.253:5248/MAAS/metadata/latest/by-id/6bhqr3/?op=get_preseed ro overlayroot=tmpfs overlayroot_cfgdisk=disabled log_host=172.16.1.253 log_port=5247 --- console=ttyS0,115200n8 iscsi_auto break=init BOOTIF=01-${mac}
  94. initrd http://172.16.1.253:5248/images/02e6022/ubuntu/amd64/ga-22.04/jammy/stable/boot-initrd
  95. boot
  96.  
  97. 6, run on maas vm
  98.  
  99. maas admin maas get-config name=kernel_opts |tee /tmp/lp2147499-kernel-opts.before
  100. maas admin maas set-config name=kernel_opts value="console=ttyS0,115200n8 iscsi_auto break=init"
  101. maas admin maas get-config name=kernel_opts
  102.  
  103. #verify
  104. ubuntu@maas:~$ maas admin maas get-config name=kernel_opts
  105. Success.
  106. Machine-readable output follows:
  107. "console=ttyS0,115200n8 iscsi_auto break=init"
  108.  
  109.  
  110. 7, do commission for n1
  111.  
  112. maas admin machine release 6bhqr3
  113. maas admin machine read 6bhqr3 |jq '{hostname,status_name,power_state}'
  114. maas admin machine commission 6bhqr3
  115.  
  116. #verify
  117. ubuntu@maas:~$ maas admin machine read 6bhqr3 |jq '{hostname,status_name,power_state}'
  118. {
  119. "hostname": "n1",
  120. "status_name": "Commissioning",
  121. "power_state": "on"
  122. }
  123.  
  124.  
  125. 8, connect n1 via console
  126.  
  127. sudo virsh console n1 |tee /tmp/lp2147499-console.log
  128.  
  129. hua@x99:~$ sudo virsh console n1 |tee /tmp/lp2147499-console.log
  130. Connected to domain 'n1'
  131. Escape character is ^] (Ctrl + ])
  132.  
  133. (initramfs) cat /proc/cmdline
  134. nomodeset root=squash:http://172.16.1.253:5248/images/e5d9ed4/ubuntu/amd64/ga-22.04/jammy/stable/squashfs ip=::::n1:BOOTIF ip6=off cc:{'datasource_list': ['MAAS']}end_cc cloud-config-url=http://172.16.1.253:5248/MAAS/metadata/latest/by-id/6bhqr3/?op=get_preseed ro overlayroot=tmpfs overlayroot_cfgdisk=disabled log_host=172.16.1.253 log_port=5247 --- console=ttyS0,115200n8 iscsi_auto break=init BOOTIF=01-52:54:00:87:02:a4
  135. (initramfs) ls /sys/firmware/ibft
  136. acpi_header target0 initiator ethernet0
  137. (initramfs) modprobe iscsi_ibft
  138. (initramfs) iscsistart -f | grep -E 'iface.bootproto|iface.ipaddress|iface.subne
  139. t_mask|iface.gateway|iface.net_ifacename|node.name'
  140. iface.bootproto = STATIC
  141. iface.ipaddress = 172.16.1.201
  142. iface.subnet_mask = 255.255.255.0
  143. iface.gateway = 172.16.1.1
  144. iface.net_ifacename = enp2s0
  145. node.name = iqn.2017-02.com.quqi:storage
  146.  
  147. #download fixes
  148. wget -O /tmp/iscsi.before http://172.16.1.1:8081/iscsi.before
  149. wget -O /tmp/iscsi.after http://172.16.1.1:8081/iscsi.after
  150. chmod 0755 /tmp/iscsi.before /tmp/iscsi.after
  151.  
  152. (initramfs) wget -O /tmp/iscsi.before http://172.16.1.1:8081/iscsi.before
  153. Connecting to 172.16.1.1:8081 (172.16.1.1:8081)
  154. iscsi.before 100% |********************************| 10297 0:00:00 ETA
  155. (initramfs) wget -O /tmp/iscsi.after http://172.16.1.1:8081/iscsi.after
  156. Connecting to 172.16.1.1:8081 (172.16.1.1:8081)
  157. iscsi.after 100% |********************************| 10631 0:00:00 ETA
  158. (initramfs) chmod 0755 /tmp/iscsi.before /tmp/iscsi.after
  159.  
  160.  
  161. 9, reproduce the problem by using iscsi.before
  162.  
  163. mkdir -p /run/initramfs /run/network /run/netplan
  164. cp /tmp/iscsi.before /scripts/local-top/iscsi
  165. chmod 0755 /scripts/local-top/iscsi
  166. rm -f /run/net-*.conf /run/net6-*.conf
  167. rm -f /run/initramfs/open-iscsi.interface
  168. rm -f /run/network/dynamic-interfaces
  169. rm -f /run/netplan/*.yaml
  170. /scripts/local-top/iscsi
  171. cat /run/net-enp2s0.conf
  172.  
  173. (initramfs) mkdir -p /run/initramfs /run/network /run/netplan
  174. (initramfs) cp /tmp/iscsi.before /scripts/local-top/iscsi
  175. (initramfs) chmod 0755 /scripts/local-top/iscsi
  176. (initramfs) rm -f /run/net-*.conf /run/net6-*.conf
  177. (initramfs) rm -f /run/initramfs/open-iscsi.interface
  178. (initramfs) rm -f /run/network/dynamic-interfaces
  179. (initramfs) rm -f /run/netplan/*.yaml
  180. (initramfs) /scripts/local-top/iscsi
  181. Setting up software interface enp2s0
  182. ip: RTNETLINK answers: File exists
  183. Begin: Waiting up to 180 secs for enp2s0 to become available ... done.
  184. no search or nameservers found in /run/net-enp2s0.conf /run/net-enp2s0.conf /run/net6-*.conf
  185. iscsistart: version 2.1.5
  186. iscsistart: Logging into iqn.2017-02.com.quqi:storage 172.16.1.1:3260,1
  187. iscsistart: initiator reported error (15 - session exists)
  188.  
  189. (initramfs) cat /run/net-enp2s0.conf
  190. DEVICE='enp2s0'
  191. PROTO='static'
  192. IPV4ADDR='172.16.1.201'
  193. IPV4BROADCAST=''
  194. IPV4NETMASK='255.255.255.0'
  195. IPV4GATEWAY='172.16.1.1'
  196. IPV4DNS0=''
  197. IPV4DNS1=''
  198. HOSTNAME=''
  199. DNSDOMAIN=''
  200. NISDOMAIN=''
  201. ROOTSERVER=''
  202. ROOTPATH=''
  203. UPTIME='0'
  204. DHCPLEASETIME='0'
  205. DOMAINSEARCH=''
  206.  
  207.  
  208. /scripts/init-bottom/cloud-initramfs-dyn-netconf
  209. mkdir -p /run/netplan
  210. . /scripts/functions
  211. netinfo_to_netplan /run/netplan /run/net-*.conf /run/net6-*.conf
  212. cat /run/netplan/enp2s0.yaml
  213.  
  214.  
  215. #successfully reproduce the problem
  216. (initramfs) /scripts/init-bottom/cloud-initramfs-dyn-netconf
  217. (initramfs) mkdir -p /run/netplan
  218. (initramfs) . /scripts/functions
  219. (initramfs) netinfo_to_netplan /run/netplan /run/net-*.conf /run/net6-*.conf
  220. (initramfs) cat /run/netplan/enp2s0.yaml
  221. network:
  222. version: 2
  223. ethernets:
  224. enp2s0:
  225.  
  226.  
  227. 10, fix the problem by using iscsi.after
  228.  
  229.  
  230. cp /tmp/iscsi.after /scripts/local-top/iscsi
  231. chmod 0755 /scripts/local-top/iscsi
  232. rm -f /run/net-*.conf /run/net6-*.conf
  233. rm -f /run/network/dynamic-interfaces
  234. rm -f /run/netplan/*.yaml
  235. /scripts/local-top/iscsi
  236. cat /run/net-enp2s0.conf
  237.  
  238. (initramfs) cp /tmp/iscsi.after /scripts/local-top/iscsi
  239. (initramfs) chmod 0755 /scripts/local-top/iscsi
  240. (initramfs) rm -f /run/net-*.conf /run/net6-*.conf
  241. (initramfs) rm -f /run/network/dynamic-interfaces
  242. (initramfs) rm -f /run/netplan/*.yaml
  243. (initramfs) /scripts/local-top/iscsi
  244. Setting up software interface enp2s0
  245. ip: RTNETLINK answers: File exists
  246. Begin: Waiting up to 180 secs for enp2s0 to become available ... done.
  247. no search or nameservers found in /run/net-enp2s0.conf /run/net-enp2s0.conf /run/net6-*.conf
  248. iscsistart: version 2.1.5
  249. iscsistart: Logging into iqn.2017-02.com.quqi:storage 172.16.1.1:3260,1
  250. iscsistart: initiator reported error (15 - session exists)
  251.  
  252. (initramfs) cat /run/net-enp2s0.conf
  253. DEVICE='enp2s0'
  254. PROTO='none'
  255. IPV4PROTO='static'
  256. IPV4ADDR='172.16.1.201'
  257. IPV4BROADCAST=''
  258. IPV4NETMASK='255.255.255.0'
  259. IPV4GATEWAY='172.16.1.1'
  260. IPV4DNS0=''
  261. IPV4DNS1=''
  262. HOSTNAME=''
  263. DNSDOMAIN=''
  264. NISDOMAIN=''
  265. ROOTSERVER=''
  266. ROOTPATH=''
  267. UPTIME='0'
  268. DHCPLEASETIME='0'
  269. DOMAINSEARCH=''
  270.  
  271.  
  272. /scripts/init-bottom/cloud-initramfs-dyn-netconf
  273. mkdir -p /run/netplan
  274. . /scripts/functions
  275. netinfo_to_netplan /run/netplan /run/net-*.conf /run/net6-*.conf
  276. cat /run/netplan/enp2s0.yaml
  277.  
  278. (initramfs) /scripts/init-bottom/cloud-initramfs-dyn-netconf
  279. (initramfs) mkdir -p /run/netplan
  280. (initramfs) . /scripts/functions
  281. (initramfs) netinfo_to_netplan /run/netplan /run/net-*.conf /run/net6-*.conf
  282. (initramfs) cat /run/netplan/enp2s0.yaml
  283. network:
  284. version: 2
  285. ethernets:
  286. enp2s0:
  287. addresses:
  288. - "172.16.1.201/24"
  289. gateway4: "172.16.1.1"
  290.  
  291.  
  292. 11, restore test env
  293.  
  294. sudo virsh destroy n1 2>/dev/null || true
  295. sudo virsh define /tmp/n1.before-lp2147499.xml
  296. kill "$(cat /tmp/lp2147499-http.pid)" 2>/dev/null || true
  297. rm -rf /tmp/lp2147499-test
  298. rm -f /tmp/lp2147499-http.pid
  299. rm -f /tmp/lp2147499-http.log
  300. sudo virsh domstate n1
  301. sudo iscsiadm -m session
  302.  
  303. 12, do sru, fetch iscsi.after from the package.
  304.  
  305. rm -rf /tmp/open-iscsi-proposed
  306. dpkg-deb -x open-iscsi_*_amd64.deb /tmp/open-iscsi-proposed
  307. cp /tmp/open-iscsi-proposed/usr/share/initramfs-tools/scripts/local-top/iscsi /tmp/lp2147499-test/iscsi.after
  308. chmod 0755 /tmp/lp2147499-test/iscsi.after
Advertisement
Add Comment
Please, Sign In to add comment