Merge "DevStack: Support for creating UEFI VMs"
This commit is contained in:
commit
5cb06385f2
@ -80,6 +80,12 @@ def main():
|
||||
help='Path to emulator bin for vm template')
|
||||
parser.add_argument('--disk-format', default='qcow2',
|
||||
help='Disk format to use.')
|
||||
parser.add_argument('--uefi-loader', default='',
|
||||
help='The absolute path of the UEFI firmware blob.')
|
||||
parser.add_argument('--uefi-nvram', default='',
|
||||
help=('The absolute path of the non-volatile memory '
|
||||
'to store the UEFI variables. Should be used '
|
||||
'only when --uefi-loader is also specified.'))
|
||||
args = parser.parse_args()
|
||||
|
||||
env = jinja2.Environment(loader=jinja2.FileSystemLoader(templatedir))
|
||||
@ -96,7 +102,9 @@ def main():
|
||||
'bridge': args.bridge,
|
||||
'nicdriver': args.libvirt_nic_driver,
|
||||
'emulator': args.emulator,
|
||||
'disk_format': args.disk_format
|
||||
'disk_format': args.disk_format,
|
||||
'uefi_loader': args.uefi_loader,
|
||||
'uefi_nvram': args.uefi_nvram,
|
||||
}
|
||||
|
||||
if args.emulator:
|
||||
|
@ -12,7 +12,7 @@ export PS4='+ ${BASH_SOURCE:-}:${FUNCNAME[0]:-}:L${LINENO:-}: '
|
||||
# Keep track of the DevStack directory
|
||||
TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
|
||||
|
||||
while getopts "n:c:m:d:a:b:e:E:p:f:l:" arg; do
|
||||
while getopts "n:c:m:d:a:b:e:E:p:f:l:L:N:" arg; do
|
||||
case $arg in
|
||||
n) NAME=$OPTARG;;
|
||||
c) CPU=$OPTARG;;
|
||||
@ -27,11 +27,18 @@ while getopts "n:c:m:d:a:b:e:E:p:f:l:" arg; do
|
||||
p) VBMC_PORT=$OPTARG;;
|
||||
f) DISK_FORMAT=$OPTARG;;
|
||||
l) LOGDIR=$OPTARG;;
|
||||
L) UEFI_LOADER=$OPTARG;;
|
||||
N) UEFI_NVRAM=$OPTARG;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
if [ -z "$UEFI_LOADER" ] && [ ! -z "$UEFI_NVRAM" ]; then
|
||||
echo "Parameter -N (UEFI NVRAM) cannot be used without -L (UEFI Loader)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LIBVIRT_NIC_DRIVER=${LIBVIRT_NIC_DRIVER:-"virtio"}
|
||||
LIBVIRT_STORAGE_POOL=${LIBVIRT_STORAGE_POOL:-"default"}
|
||||
LIBVIRT_CONNECT_URI=${LIBVIRT_CONNECT_URI:-"qemu:///system"}
|
||||
@ -66,6 +73,15 @@ else
|
||||
fi
|
||||
VOL_NAME="${NAME}.${DISK_FORMAT}"
|
||||
|
||||
UEFI_OPTS=""
|
||||
if [ ! -z "$UEFI_LOADER" ]; then
|
||||
UEFI_OPTS="--uefi-loader $UEFI_LOADER"
|
||||
|
||||
if [ ! -z "$UEFI_NVRAM" ]; then
|
||||
UEFI_OPTS+=" --uefi-nvram $UEFI_NVRAM"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create bridge and add VM interface to it.
|
||||
# Additional interface will be added to this bridge and
|
||||
# it will be plugged to OVS.
|
||||
@ -93,7 +109,7 @@ if ! virsh list --all | grep -q $NAME; then
|
||||
$TOP_DIR/scripts/configure-vm.py \
|
||||
--bootdev network --name $NAME --image "$volume_path" \
|
||||
--arch $ARCH --cpus $CPU --memory $MEM --libvirt-nic-driver $LIBVIRT_NIC_DRIVER \
|
||||
--bridge br-$NAME --disk-format $DISK_FORMAT $VM_LOGGING --engine $ENGINE $vm_opts >&2
|
||||
--bridge br-$NAME --disk-format $DISK_FORMAT $VM_LOGGING --engine $ENGINE $UEFI_OPTS $vm_opts >&2
|
||||
|
||||
# Createa Virtual BMC for the node if IPMI is used
|
||||
if [[ $(type -P vbmc) != "" ]]; then
|
||||
|
@ -5,6 +5,12 @@
|
||||
<os>
|
||||
<type arch='{{ arch }}' machine='pc-1.0'>hvm</type>
|
||||
<boot dev='{{ bootdev }}'/>
|
||||
{% if uefi_loader %}
|
||||
<loader readonly='yes' type='pflash'>{{ uefi_loader }}</loader>
|
||||
{% if uefi_nvram %}
|
||||
<nvram>{{ uefi_nvram }}</nvram>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<bootmenu enable='no'/>
|
||||
<bios useserial='yes'/>
|
||||
</os>
|
||||
@ -25,8 +31,15 @@
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='{{ disk_format }}' cache='writeback'/>
|
||||
<source file='{{ imagefile }}'/>
|
||||
<!-- NOTE(lucasagomes): The virtio disk controller apparently does
|
||||
not work with UEFI, so let's use IDE. -->
|
||||
{% if uefi_loader %}
|
||||
<target dev='vda' bus='ide'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
{% else %}
|
||||
<target dev='vda' bus='virtio'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
|
||||
{% endif %}
|
||||
</disk>
|
||||
<controller type='ide' index='0'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
|
Loading…
Reference in New Issue
Block a user