~paolo-de-rosa/curtin/curtin

« back to all changes in this revision

Viewing changes to tools/launch

  • Committer: Ryan Harper
  • Date: 2016-04-04 15:48:10 UTC
  • mfrom: (366.1.1 merge-a-few)
  • Revision ID: ryan.harper@canonical.com-20160404154810-qm68p671rfd0uf6q
add s390x support to curtin and vmtest
  
- use virtio ccw bus by default
- bump install_timeout to 30 minutes
  (kvm on zvm can be slow, installing things across the atlantic)
- query "default" architecture from python
- add zipl support
- use a bootloader agnostic "successful" installation watermark
- vmtests: Add arch_skip field to allow vmtests to be skipped on specific
  arches For example, bcache is currently broken on s390x, and uefi will
  never work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
   options:
23
23
           --add  F[:T] add file 'F' to the curtin archive at T
24
24
      -a | --append     append args to kernel cmdline (--kernel)
 
25
      -A | --arch   A   assume guest kernel architecture A
25
26
      -d | --disk   D   add a disk 'D' format (path[:size])
26
27
           --uefi   N   enable uefi boot method, store nvram at N
27
28
      -h | --help       show this message
235
236
}
236
237
 
237
238
main() {
238
 
    local short_opts="a:d:h:i:k:n:p:v"
239
 
    local long_opts="add:,append:,bios:,disk:,dowait,help,initrd:,kernel:,mem:,netdev:,no-dowait,power:,publish:,silent,serial-log:,uefi:,verbose,vnc:"
 
239
    local short_opts="a:A:d:h:i:k:n:p:v"
 
240
    local long_opts="add:,append:,arch:,bios:,disk:,dowait,help,initrd:,kernel:,mem:,netdev:,no-dowait,power:,publish:,silent,serial-log:,uefi:,verbose,vnc:"
240
241
    local getopt_out=""
241
242
    getopt_out=$(getopt --name "${0##*/}" \
242
243
        --options "${short_opts}" --long "${long_opts}" -- "$@") &&
251
252
    local pubs="" disks="" pstate="null"
252
253
    local uefi="" bios=""
253
254
    local netdevs="" install_deps="--install-deps"
254
 
    local video="-curses -vga std" serial_log="file:serial.log"
 
255
    local arch_hint=""
 
256
    local video="-curses -vga std" serial_log="serial.log"
255
257
    # dowait: run xkvm with a '&' and then 'wait' on the pid.
256
258
    #  the reason to do this or not do this has to do with interactivity
257
259
    #  if detached with &, then user input will not go to xkvm.
274
276
        case "$cur" in
275
277
               --add) addfiles[${#addfiles[@]}]="$next"; shift;;
276
278
            -a|--append) uappend="$next"; shift;;
 
279
            -A|--arch) arch_hint="$next"; shift;;              
277
280
            -d|--disk) disks[${#disks[@]}]="$next"; shift;;
278
281
            -h|--help) Usage ; exit 0;;
279
282
            -i|--initrd) initrd="$next"; shift;;
297
300
                    video="-vnc $next"
298
301
                    debug 1 "VNC requested - $next"
299
302
                    shift;;
300
 
               --serial-log) serial_log="file:$next"; shift;;
 
303
               --serial-log) serial_log="$next"; shift;;
301
304
            -v|--verbose) VERBOSITY=$((${VERBOSITY}+1));;
302
305
               --dowait) pt[${#pt[@]}]="$cur"; dowait=true;;
303
306
               --no-dowait) pt[${#pt[@]}]="$cur"; dowait=false;;
520
523
            root="/dev/vda1"
521
524
        fi
522
525
        append="root=$root ds=nocloud-net;seedfrom=$burl"
523
 
        append="${append} console=ttyS0 $uappend"
 
526
        if [ "${arch_hint}" != "s390x" ]; then
 
527
            append="${append} console=ttyS0"
 
528
        fi
 
529
        append="${append} $uappend"
524
530
        seedargs=( "${seedargs[@]}" -kernel "$kernel" )
525
531
        [ -n "$initrd" ] && seedargs=( "${seedargs[@]}" -initrd "$initrd" )
526
532
        seedargs=( "${seedargs[@]}" -append "$append" )
537
543
        netargs=( "${netargs[@]}" "--netdev=${dev}" )
538
544
    done
539
545
 
540
 
    local cmd
541
 
    [ "${serial_log}" = "file:none" ] && serial_log=""
542
 
    [ "${serial_log}" = "file:stdio" ] && serial_log="stdio"
 
546
    local cmd serial_args="" chardev_arg=""
 
547
    [ "${serial_log}" = "none" ] && serial_log=""
 
548
    if [ -n "${serial_log}" ]; then
 
549
        if [ "${arch_hint}" = "s390x" ]; then
 
550
            if [ "${serial_log}" = "stdio" ]; then
 
551
                chardev_arg="stdio"
 
552
            else
 
553
                chardev_arg="file,path=${serial_log}"
 
554
            fi
 
555
            serial_args="-nodefaults -chardev ${chardev_arg},id=charconsole0 -device sclpconsole,chardev=charconsole0,id=console0"
 
556
        else
 
557
            serial_args="-serial file:${serial_log}"
 
558
        fi
 
559
    fi
543
560
    cmd=( 
544
561
        xkvm "${pt[@]}" "${netargs[@]}" --
545
562
        "${bios_opts[@]}"
546
 
        -m ${mem} ${serial_log:+-serial "${serial_log}"} ${video}
 
563
        -m ${mem} ${serial_args} ${video}
547
564
        -drive "file=$bootimg,if=virtio,cache=unsafe,format=qcow2"
548
565
        "${disk_args[@]}"
549
566
        "${seedargs[@]}"