2014-02-06 15:12:12 +04:00
# Copyright (C) 2013, 2014 Red Hat, Inc.
2013-03-18 01:06:52 +04:00
#
2018-04-04 16:35:41 +03:00
# This work is licensed under the GNU GPLv2 or later.
2018-03-20 22:00:02 +03:00
# See the COPYING file in the top-level directory.
2013-03-18 01:06:52 +04:00
import atexit
2017-10-11 14:35:50 +03:00
import io
2013-03-18 01:06:52 +04:00
import os
import shlex
2013-09-29 01:23:23 +04:00
import shutil
2013-03-18 01:06:52 +04:00
import sys
import traceback
2020-09-18 23:26:28 +03:00
import pytest
2013-03-18 01:06:52 +04:00
2018-12-19 19:53:14 +03:00
try :
import argcomplete
except ImportError :
argcomplete = None
2020-01-27 18:13:03 +03:00
from gi . repository import Libosinfo
2019-06-17 04:12:39 +03:00
from virtinst import log
2019-08-02 01:57:36 +03:00
from virtinst import OSDB
2019-06-17 04:34:47 +03:00
from virtinst . install import unattended
2019-06-10 03:18:13 +03:00
2019-12-12 01:34:03 +03:00
from tests import setup_logging
2020-01-25 00:18:00 +03:00
from tests import virtinstall , virtclone , virtxml
2013-04-11 03:48:07 +04:00
from tests import utils
2013-03-18 01:06:52 +04:00
2013-09-28 22:42:37 +04:00
os . environ [ " HOME " ] = " /tmp "
os . environ [ " DISPLAY " ] = " :3.4 "
2018-06-12 19:26:13 +03:00
TMP_IMAGE_DIR = " /tmp/__virtinst_cli_ "
2020-08-30 15:54:41 +03:00
_ABSXMLDIR = utils . DATADIR + " /cli "
XMLDIR = os . path . relpath ( _ABSXMLDIR , utils . TOPDIR )
2020-09-09 00:48:40 +03:00
MEDIA_DIR = os . path . relpath ( utils . DATADIR + " /fakemedia " , utils . TOPDIR )
UNATTENDED_DIR = XMLDIR + " /unattended "
2019-01-30 19:55:40 +03:00
OLD_OSINFO = utils . has_old_osinfo ( )
2019-06-10 03:18:13 +03:00
NO_OSINFO_UNATTEND = not unattended . OSInstallScript . have_new_libosinfo ( )
2021-04-07 18:45:00 +03:00
HAS_xorriso = shutil . which ( " xorriso " )
2013-03-18 01:06:52 +04:00
2020-01-27 18:13:03 +03:00
# We use this check as a surrogate for a released libosinfo with a bug
# fix we need to get full test coverage
LIBOSINFO_SUPPORT_LOCAL_TREE = hasattr ( Libosinfo . Tree , " create_from_treeinfo " )
2013-03-18 01:06:52 +04:00
# Images that will be created by virt-install/virt-clone, and removed before
# each run
2020-07-17 23:33:18 +03:00
NEW_FILES = [
2018-06-12 19:26:13 +03:00
TMP_IMAGE_DIR + " new1.img " ,
TMP_IMAGE_DIR + " new2.img " ,
TMP_IMAGE_DIR + " new3.img " ,
TMP_IMAGE_DIR + " exist1-clone.img " ,
TMP_IMAGE_DIR + " exist2-clone.img " ,
2013-03-18 01:06:52 +04:00
]
# Images that are expected to exist before a command is run
2020-07-17 23:33:18 +03:00
EXIST_FILES = [
2018-06-12 19:26:13 +03:00
TMP_IMAGE_DIR + " exist1.img " ,
TMP_IMAGE_DIR + " exist2.img " ,
2013-03-18 01:06:52 +04:00
]
2020-07-17 23:33:18 +03:00
TEST_DATA = {
2018-06-12 18:48:11 +03:00
' URI-TEST-FULL ' : utils . URIs . test_full ,
' URI-TEST-REMOTE ' : utils . URIs . test_remote ,
2022-01-24 21:37:40 +03:00
' URI-KVM-X86 ' : utils . URIs . kvm_x86 ,
2018-06-12 18:48:11 +03:00
' URI-KVM-ARMV7L ' : utils . URIs . kvm_armv7l ,
' URI-KVM-AARCH64 ' : utils . URIs . kvm_aarch64 ,
' URI-KVM-PPC64LE ' : utils . URIs . kvm_ppc64le ,
' URI-KVM-S390X ' : utils . URIs . kvm_s390x ,
2019-04-04 13:49:42 +03:00
' URI-QEMU-RISCV64 ' : utils . URIs . qemu_riscv64 ,
2018-06-12 19:26:13 +03:00
2019-11-22 01:38:46 +03:00
' XMLDIR ' : XMLDIR ,
2018-06-12 19:26:13 +03:00
' NEWIMG1 ' : " /dev/default-pool/new1.img " ,
' NEWIMG2 ' : " /dev/default-pool/new2.img " ,
2020-07-17 23:33:18 +03:00
' NEWCLONEIMG1 ' : NEW_FILES [ 0 ] ,
' NEWCLONEIMG2 ' : NEW_FILES [ 1 ] ,
' NEWCLONEIMG3 ' : NEW_FILES [ 2 ] ,
2018-06-12 19:26:13 +03:00
' EXISTIMG1 ' : " /dev/default-pool/testvol1.img " ,
' EXISTIMG2 ' : " /dev/default-pool/testvol2.img " ,
2020-07-17 23:33:18 +03:00
' EXISTIMG3 ' : EXIST_FILES [ 0 ] ,
' EXISTIMG4 ' : EXIST_FILES [ 1 ] ,
2020-09-09 00:48:40 +03:00
' ISOTREE ' : " %s /fake-fedora17-tree.iso " % MEDIA_DIR ,
' ISOLABEL ' : " %s /fake-centos65-label.iso " % MEDIA_DIR ,
' ISO-NO-OS ' : " %s /fake-no-osinfo.iso " % MEDIA_DIR ,
' ISO-WIN7 ' : " %s /fake-win7.iso " % MEDIA_DIR ,
' ISO-F26-NETINST ' : " %s /fake-f26-netinst.iso " % MEDIA_DIR ,
' ISO-F29-LIVE ' : " %s /fake-f29-live.iso " % MEDIA_DIR ,
' TREEDIR ' : " %s /fakefedoratree " % MEDIA_DIR ,
2018-06-12 19:26:13 +03:00
' COLLIDE ' : " /dev/default-pool/collidevol1.img " ,
2020-09-09 00:48:40 +03:00
' ADMIN-PASSWORD-FILE ' : " %s /admin-password.txt " % UNATTENDED_DIR ,
' USER-PASSWORD-FILE ' : " %s /user-password.txt " % UNATTENDED_DIR ,
2013-03-18 01:06:52 +04:00
}
2019-01-30 19:55:40 +03:00
def has_old_osinfo ( ) :
if OLD_OSINFO :
return " osinfo is too old "
2021-04-07 18:45:00 +03:00
def missing_xorriso ( ) :
if not HAS_xorriso :
return " xorriso not installed "
2019-01-30 19:55:40 +03:00
2019-06-10 03:18:13 +03:00
def no_osinfo_unattend_cb ( ) :
if NO_OSINFO_UNATTEND :
return " osinfo is too old for unattended testing "
2019-10-03 13:57:42 +03:00
def no_osinfo_unattended_win_drivers_cb ( ) :
win7 = OSDB . lookup_os ( " win7 " )
devs = win7 . get_pre_installable_devices ( " x86_64 " )
devids = [ d . get_id ( ) for d in devs ]
if " http://pcisig.com/pci/1af4/1005 " not in devids :
return " osinfo is too old for this win7 unattended test "
2013-03-18 01:06:52 +04:00
######################
# Test class helpers #
######################
2019-05-16 20:18:12 +03:00
class SkipChecks :
"""
Class to track all ' skip ' style checks we might do . All checks
can be callable functions , or version strings to check against libvirt
: param prerun_check : If check resolves , skip before running the command
: param precompare_check : If check resolves , skip after running the command
but before comparing output
: param predefine_check : If check resolves , skip after comparing output
but before defining it
"""
def __init__ ( self , parent_skip_checks ,
precompare_check = None ,
predefine_check = None ,
prerun_check = None ) :
p = parent_skip_checks
self . precompare_check = precompare_check or ( p and p . precompare_check )
self . predefine_check = predefine_check or (
p and p . predefine_check )
self . prerun_check = prerun_check or ( p and p . prerun_check )
def _check ( self , conn , check ) :
if check is None :
return
if callable ( check ) :
msg = check ( )
skip = bool ( msg )
else :
2019-06-07 21:48:59 +03:00
skip = not conn . support . _check_version ( check ) # pylint: disable=protected-access
2019-05-16 20:18:12 +03:00
msg = " Skipping check due to version < %s " % check
if skip :
2020-09-18 23:26:28 +03:00
raise pytest . skip ( msg )
2019-05-16 20:18:12 +03:00
def prerun_skip ( self , conn ) :
self . _check ( conn , self . prerun_check )
def precompare_skip ( self , conn ) :
self . _check ( conn , self . precompare_check )
def predefine_skip ( self , conn ) :
self . _check ( conn , self . predefine_check )
2013-03-18 01:06:52 +04:00
class Command ( object ) :
"""
Instance of a single cli command to test
"""
2019-05-16 20:18:12 +03:00
def __init__ ( self , cmd , input_file = None , need_conn = True , grep = None ,
nogrep = None , skip_checks = None , compare_file = None , env = None ,
2019-06-14 19:10:00 +03:00
check_success = True , input_text = None , * * kwargs ) :
2019-05-16 20:18:12 +03:00
# Options that alter what command we run
2020-07-17 23:33:18 +03:00
self . cmdstr = cmd % TEST_DATA
2013-03-18 01:06:52 +04:00
app , opts = self . cmdstr . split ( " " , 1 )
2014-01-19 02:01:43 +04:00
self . app = app
2013-03-18 01:06:52 +04:00
self . argv = [ os . path . abspath ( app ) ] + shlex . split ( opts )
2019-05-16 20:18:12 +03:00
self . env = env
self . input_file = input_file
2019-06-14 19:10:00 +03:00
self . input_text = input_text
2019-05-16 20:18:12 +03:00
self . need_conn = need_conn
# Options that alter the results we check for
self . check_success = check_success
self . compare_file = compare_file
self . grep = grep
self . nogrep = nogrep
# Options that determine when we skip tests
self . skip_checks = SkipChecks ( skip_checks , * * kwargs )
2013-03-18 01:06:52 +04:00
2014-01-30 17:50:52 +04:00
def _launch_command ( self , conn ) :
2019-06-17 04:12:39 +03:00
log . debug ( self . cmdstr )
2013-03-18 01:06:52 +04:00
app = self . argv [ 0 ]
2018-12-18 22:20:57 +03:00
oldenv = None
2013-03-18 01:06:52 +04:00
oldstdout = sys . stdout
oldstderr = sys . stderr
2014-01-26 03:16:16 +04:00
oldstdin = sys . stdin
2013-03-18 01:06:52 +04:00
oldargv = sys . argv
try :
2018-12-18 22:20:57 +03:00
if self . env :
oldenv = os . environ . copy ( )
os . environ . update ( self . env )
2018-01-27 22:19:12 +03:00
out = io . StringIO ( )
2017-10-11 14:36:00 +03:00
2013-03-18 01:06:52 +04:00
sys . stdout = out
sys . stderr = out
sys . argv = self . argv
2014-01-26 03:16:16 +04:00
if self . input_file :
2017-05-05 21:19:54 +03:00
sys . stdin = open ( self . input_file )
2019-06-14 19:10:00 +03:00
elif self . input_text :
sys . stdin = io . StringIO ( self . input_text + " \n " )
else :
sys . stdin = io . StringIO ( )
sys . stdin . close ( )
2013-03-18 01:06:52 +04:00
2014-02-09 01:36:45 +04:00
exc = " "
2013-03-18 01:06:52 +04:00
try :
2018-02-14 03:04:08 +03:00
if " virt-install " in app :
2013-03-18 01:06:52 +04:00
ret = virtinstall . main ( conn = conn )
2018-02-14 03:04:08 +03:00
elif " virt-clone " in app :
2013-03-18 01:06:52 +04:00
ret = virtclone . main ( conn = conn )
2018-02-14 03:04:08 +03:00
elif " virt-xml " in app :
2014-02-06 04:09:26 +04:00
ret = virtxml . main ( conn = conn )
2017-05-05 19:47:21 +03:00
except SystemExit as sys_e :
2013-03-18 01:06:52 +04:00
ret = sys_e . code
2014-02-09 01:36:45 +04:00
except Exception :
ret = - 1
exc = " \n " + " " . join ( traceback . format_exc ( ) )
2013-03-18 01:06:52 +04:00
if ret != 0 :
ret = - 1
2014-02-09 01:36:45 +04:00
outt = out . getvalue ( ) + exc
2013-03-18 01:06:52 +04:00
if outt . endswith ( " \n " ) :
outt = outt [ : - 1 ]
return ( ret , outt )
finally :
sys . stdout = oldstdout
sys . stderr = oldstderr
2014-01-26 03:16:16 +04:00
sys . stdin = oldstdin
2013-03-18 01:06:52 +04:00
sys . argv = oldargv
2018-12-18 22:20:57 +03:00
if oldenv :
os . environ = oldenv
2019-12-12 01:34:03 +03:00
# Reset logging
setup_logging ( )
2013-03-18 01:06:52 +04:00
2014-01-30 17:50:52 +04:00
def _get_output ( self , conn ) :
2013-03-18 01:06:52 +04:00
try :
2020-07-17 23:33:18 +03:00
cleanup ( clean_all = False )
2013-03-18 01:06:52 +04:00
2014-01-30 17:50:52 +04:00
code , output = self . _launch_command ( conn )
2013-03-18 01:06:52 +04:00
2019-06-17 04:12:39 +03:00
log . debug ( " %s \n " , output )
2013-03-18 01:06:52 +04:00
return code , output
2017-05-05 19:47:21 +03:00
except Exception as e :
2013-03-18 01:06:52 +04:00
return ( - 1 , " " . join ( traceback . format_exc ( ) ) + str ( e ) )
2019-05-16 20:18:12 +03:00
def _check_compare_file ( self , conn , output ) :
self . skip_checks . precompare_skip ( conn )
2013-08-17 21:50:36 +04:00
2019-05-14 16:54:12 +03:00
if " --print-diff " in self . argv and output . count ( " \n " ) > 3 :
# 1) Strip header
# 2) Simplify context lines to reduce churn when
# libvirt or testdriver changes
newlines = [ ]
for line in output . splitlines ( ) [ 3 : ] :
if line . startswith ( " @@ " ) :
line = " @@ "
newlines . append ( line )
output = " \n " . join ( newlines )
2022-01-11 20:26:19 +03:00
# Make sure all test output has trailing newline, simplifies diffing
if not output . endswith ( " \n " ) :
output + = " \n "
utils . diff_compare ( output , self . compare_file )
2019-05-14 16:54:12 +03:00
2019-05-16 20:18:12 +03:00
self . skip_checks . predefine_skip ( conn )
2019-05-16 02:41:44 +03:00
2019-05-14 17:09:57 +03:00
# Define the <domain>s generated for compare output, to ensure
# we are generating valid XML
if " --print-xml " in self . argv or " --print-step " in self . argv :
for domxml in output . split ( " </domain> " ) :
if " <domain " not in domxml :
continue
domxml = domxml + " </domain> "
try :
dom = conn . defineXML ( domxml )
dom . undefine ( )
except Exception as e :
2020-09-15 19:33:31 +03:00
# pylint: disable=raise-missing-from
2019-05-14 17:09:57 +03:00
raise AssertionError ( " Bad XML: \n %s \n \n Error was: %s : %s " %
( domxml , e . __class__ . __name__ , str ( e ) ) )
2019-05-16 20:18:12 +03:00
def _run ( self ) :
2019-05-14 16:54:12 +03:00
conn = None
for idx in reversed ( range ( len ( self . argv ) ) ) :
if self . argv [ idx ] == " --connect " :
conn = utils . URIs . openconn ( self . argv [ idx + 1 ] )
break
if not conn and self . need_conn :
raise RuntimeError ( " couldn ' t parse URI from command %s " %
self . argv )
2019-05-16 20:18:12 +03:00
self . skip_checks . prerun_skip ( conn )
2019-05-14 16:54:12 +03:00
code , output = self . _get_output ( conn )
def _raise_error ( _msg ) :
raise AssertionError (
( " Command was: %s \n " % self . cmdstr ) +
( " Error code : %d \n " % code ) +
( " Output was: \n %s " % output ) +
( " \n \n \n TESTSUITE: " + _msg + " \n " ) )
if bool ( code ) == self . check_success :
_raise_error ( " Expected command to %s , but it didn ' t. \n " %
( self . check_success and " pass " or " fail " ) )
if self . grep and self . grep not in output :
_raise_error ( " Didn ' t find grep= %s " % self . grep )
if self . nogrep and self . nogrep in output :
_raise_error ( " Found grep= %s when we shouldn ' t see it " %
self . nogrep )
if self . compare_file :
2019-05-16 20:18:12 +03:00
self . _check_compare_file ( conn , output )
2019-05-14 16:54:12 +03:00
2020-09-18 23:26:28 +03:00
def run ( self ) :
self . _run ( )
2013-03-18 01:06:52 +04:00
2013-08-17 17:44:11 +04:00
class _CategoryProxy ( object ) :
2019-05-16 20:18:12 +03:00
"""
Category of an App . Let ' s us register chunks of suboptions per logical
grouping of tests . So we may have a virt - install ' storage ' group which
specifies default install options like - - pxe but leaves storage
specification up to each individual test .
"""
def __init__ ( self , app , name , default_args , * * kwargs ) :
2013-08-17 17:44:11 +04:00
self . _app = app
self . _name = name
2014-01-30 17:50:52 +04:00
self . default_args = default_args
2019-05-16 20:18:12 +03:00
self . skip_checks = SkipChecks ( self . _app . skip_checks , * * kwargs )
2014-01-30 17:50:52 +04:00
2013-08-17 17:44:11 +04:00
def add_valid ( self , * args , * * kwargs ) :
return self . _app . add_valid ( self . _name , * args , * * kwargs )
def add_invalid ( self , * args , * * kwargs ) :
return self . _app . add_invalid ( self . _name , * args , * * kwargs )
def add_compare ( self , * args , * * kwargs ) :
return self . _app . add_compare ( self . _name , * args , * * kwargs )
2013-04-24 00:16:30 +04:00
class App ( object ) :
2019-05-16 20:18:12 +03:00
"""
Represents a top level app test suite , like virt - install or virt - xml
"""
def __init__ ( self , appname , uri = None , * * kwargs ) :
2013-04-24 00:16:30 +04:00
self . appname = appname
self . categories = { }
self . cmds = [ ]
2019-05-16 20:18:12 +03:00
self . skip_checks = SkipChecks ( None , * * kwargs )
2018-02-20 23:00:46 +03:00
self . uri = uri
2013-04-24 00:16:30 +04:00
2019-06-11 19:23:09 +03:00
def _default_args ( self , cli , iscompare ) :
2013-04-24 00:16:30 +04:00
args = " "
if not iscompare :
args = " --debug "
2014-02-06 04:09:26 +04:00
if " --connect " not in cli :
2018-06-12 19:26:13 +03:00
uri = self . uri or utils . URIs . test_suite
2018-02-20 23:00:46 +03:00
args + = " --connect %s " % uri
2013-04-24 00:16:30 +04:00
if self . appname in [ " virt-install " ] :
2020-01-15 18:28:53 +03:00
# Excluding 'lxc' is a hack. We need to remove this, but it
# will take some work
if " --ram " not in cli and " lxc " not in cli :
2013-04-24 00:16:30 +04:00
args + = " --ram 64 "
2019-06-11 19:23:09 +03:00
if iscompare :
2013-04-24 00:16:30 +04:00
if self . appname == " virt-install " :
2018-02-14 03:04:08 +03:00
if ( " --print-xml " not in cli and
" --print-step " not in cli and
" --quiet " not in cli ) :
2013-04-24 00:16:30 +04:00
args + = " --print-step all "
elif self . appname == " virt-clone " :
2018-02-14 03:04:08 +03:00
if " --print-xml " not in cli :
2013-04-24 00:16:30 +04:00
args + = " --print-xml "
2020-09-03 22:59:59 +03:00
args + = " --__test-nodry "
2013-04-24 00:16:30 +04:00
return args
2019-05-16 20:18:12 +03:00
def add_category ( self , catname , default_args , * args , * * kwargs ) :
obj = _CategoryProxy ( self , catname , default_args , * args , * * kwargs )
2014-01-30 17:50:52 +04:00
self . categories [ catname ] = obj
return obj
2019-05-16 20:18:12 +03:00
def _add ( self , catname , testargs , compbase , * * kwargs ) :
2014-01-30 17:50:52 +04:00
category = self . categories [ catname ]
args = category . default_args + " " + testargs
2019-06-11 19:23:09 +03:00
use_default_args = kwargs . pop ( " use_default_args " , True )
if use_default_args :
args = category . default_args + " " + testargs
defargs = self . _default_args ( args , bool ( compbase ) )
args + = " " + defargs
else :
args = testargs
cmdstr = " ./ %s %s " % ( self . appname , args )
2019-05-16 20:18:12 +03:00
kwargs [ " skip_checks " ] = category . skip_checks
if compbase :
2018-06-12 19:26:13 +03:00
compare_XMLDIR = " %s /compare " % XMLDIR
2019-05-16 20:18:12 +03:00
kwargs [ " compare_file " ] = " %s / %s - %s .xml " % (
compare_XMLDIR , os . path . basename ( self . appname ) , compbase )
cmd = Command ( cmdstr , * * kwargs )
2013-04-24 00:16:30 +04:00
self . cmds . append ( cmd )
2013-08-17 21:50:36 +04:00
def add_valid ( self , cat , args , * * kwargs ) :
2019-05-16 20:18:12 +03:00
self . _add ( cat , args , None , check_success = True , * * kwargs )
2013-08-17 21:50:36 +04:00
def add_invalid ( self , cat , args , * * kwargs ) :
2022-02-11 22:22:48 +03:00
if " grep " not in kwargs :
raise Exception ( " grep= must be passed for add_invalid " )
2019-05-16 20:18:12 +03:00
self . _add ( cat , args , None , check_success = False , * * kwargs )
def add_compare ( self , cat , args , compbase , * * kwargs ) :
self . _add ( cat , args , compbase ,
check_success = not compbase . endswith ( " -fail " ) ,
* * kwargs )
2013-04-24 00:16:30 +04:00
#
# The test matrix
#
# add_valid: A test that should pass
# add_invalid: A test that should fail
# add_compare: Get the generated XML, and compare against the passed filename
2020-01-27 02:29:39 +03:00
# in tests/data/cli/compare/
2013-04-24 00:16:30 +04:00
#
2014-12-10 17:33:02 +03:00
######################
# virt-install tests #
######################
2013-08-17 17:44:11 +04:00
2014-12-10 17:33:02 +03:00
vinst = App ( " virt-install " )
2013-08-17 17:44:11 +04:00
2014-12-10 17:33:02 +03:00
#############################################
# virt-install verbose XML comparison tests #
#############################################
2022-01-24 21:37:40 +03:00
c = vinst . add_category ( " xml-comparsion " , " --connect % (URI-KVM-X86)s --noautoconsole --os-variant fedora-unknown " , prerun_check = has_old_osinfo )
2014-12-10 17:33:02 +03:00
2022-02-18 17:39:19 +03:00
# many-devices, the main XML coverage tester
2019-05-14 18:25:52 +03:00
c . add_compare ( """
2022-02-18 17:39:19 +03:00
- - boot firmware = efi , \
firmware . feature0 . enabled = true , firmware . feature0 . name = secure - boot , \
firmware . feature1 . enabled = off , firmware . feature1 . name = enrolled - keys , \
emulator = / new / emu , bootloader = / new / bootld , bootloader_args = ' --append single ' , rebootTimeout = 3 , \
initargs = " foo=bar baz=woo " , initdir = / my / custom / cwd , inituser = tester , initgroup = 1000 , \
bios . useserial = no , bios . rebootTimeout = 60 , cmdline = root = / foo , \
bootmenu . enable = yes , bootmenu . timeout = 5000 , \
loader_ro = yes , loader . type = rom , loader = / tmp / foo , loader_secure = no , \
acpi . table = / path / to / slic . dat , acpi . table . type = slic , \
initenv0 . name = MYENV , initenv0 = ' some value ' , initenv1 . name = FOO , initenv1 = bar , \
initdir = / my / custom / cwd , inituser = tester , initgroup = 1000
- - vcpus vcpus = 9 , vcpu . placement = static , \
vcpus . vcpu2 . id = 0 , vcpus . vcpu2 . enabled = no , \
vcpus . vcpu3 . id = 1 , vcpus . vcpu3 . hotpluggable = no , vcpus . vcpu3 . enabled = yes , \
vcpus . vcpu . id = 3 , vcpus . vcpu0 . enabled = yes , vcpus . vcpu0 . order = 3 , \
vcpus . vcpu1 . id = 2 , vcpus . vcpu1 . enabled = yes
2019-05-14 18:25:52 +03:00
2014-12-10 17:33:02 +03:00
2021-07-29 15:34:24 +03:00
- - cpu foobar , + x2apic , + x2apicagain , - distest , forbid = foo , forbid = bar , disable = distest2 , optional = opttest , require = reqtest , match = strict , vendor = meee , mode = custom , check = partial , \
2022-02-18 17:39:19 +03:00
topology . sockets = 1 , topology . dies = 1 , topology . cores = 3 , topology . threads = 3 , \
model . fallback = allow , model . vendor_id = GenuineIntel , \
virtinst: Add NUMA distance support
Now that libvirt has support for administration of distances between NUMA cells
it would be nice to be able to set those with virt-install directly instead of
having to 'virsh edit' the domain XML manually after installation.
For example
--cpu cell0.memory=1234,cell0.cpus=0-3,cell1.memory=5678,cell1.cpus=4-7,\
cell0.distances.sibling0.id=0,cell0.distances.sibling0.value=10,\
cell0.distances.sibling1.id=1,cell0.distances.sibling1.value=21,\
cell1.distances.sibling0.id=0,cell1.distances.sibling0.value=21,\
cell1.distances.sibling1.id=1,cell1.distances.sibling1.value=10
would generate the following XML:
<cpu>
<numa>
<cell cpus="0-3" memory="1234">
<distances>
<sibling id="0" value="10"/>
<sibling id="1" value="21"/>
</distances>
</cell>
<cell cpus="4-7" memory="5678">
<distances>
<sibling id="0" value="21"/>
<sibling id="1" value="10"/>
</distances>
</cell>
</numa>
</cpu>
Signed-off-by: Menno Lageman <menno.lageman@oracle.com>
(crobinso: rework cli format, drop some validation, drop man changes)
2018-01-22 15:36:00 +03:00
cell . id = 0 , cell . cpus = 1 , 2 , 3 , cell . memory = 1024 , \
cell1 . id = 1 , cell1 . memory = 256 , cell1 . cpus = 5 - 8 , \
2021-08-03 20:41:33 +03:00
numa . cell2 . id = 2 , numa . cell2 . memory = 256 , numa . cell2 . unit = KiB , numa . cell2 . cpus = 4 , numa . cell2 . memAccess = shared , numa . cell2 . discard = no , \
virtinst: Add NUMA distance support
Now that libvirt has support for administration of distances between NUMA cells
it would be nice to be able to set those with virt-install directly instead of
having to 'virsh edit' the domain XML manually after installation.
For example
--cpu cell0.memory=1234,cell0.cpus=0-3,cell1.memory=5678,cell1.cpus=4-7,\
cell0.distances.sibling0.id=0,cell0.distances.sibling0.value=10,\
cell0.distances.sibling1.id=1,cell0.distances.sibling1.value=21,\
cell1.distances.sibling0.id=0,cell1.distances.sibling0.value=21,\
cell1.distances.sibling1.id=1,cell1.distances.sibling1.value=10
would generate the following XML:
<cpu>
<numa>
<cell cpus="0-3" memory="1234">
<distances>
<sibling id="0" value="10"/>
<sibling id="1" value="21"/>
</distances>
</cell>
<cell cpus="4-7" memory="5678">
<distances>
<sibling id="0" value="21"/>
<sibling id="1" value="10"/>
</distances>
</cell>
</numa>
</cpu>
Signed-off-by: Menno Lageman <menno.lageman@oracle.com>
(crobinso: rework cli format, drop some validation, drop man changes)
2018-01-22 15:36:00 +03:00
cell0 . distances . sibling0 . id = 0 , cell0 . distances . sibling0 . value = 10 , \
cell0 . distances . sibling1 . id = 1 , cell0 . distances . sibling1 . value = 21 , \
2019-05-15 23:14:33 +03:00
numa . cell1 . distances . sibling0 . id = 0 , numa . cell1 . distances . sibling0 . value = 21 , \
2021-08-03 20:54:51 +03:00
numa . cell2 . cache0 . level = 1 , numa . cell2 . cache0 . associativity = direct , numa . cell2 . cache0 . policy = writeback , \
numa . cell2 . cache0 . size . value = 256 , numa . cell2 . cache0 . size . unit = KiB , numa . cell2 . cache0 . line . value = 256 , numa . cell2 . cache0 . line . unit = KiB , \
virtinst: Add NUMA distance support
Now that libvirt has support for administration of distances between NUMA cells
it would be nice to be able to set those with virt-install directly instead of
having to 'virsh edit' the domain XML manually after installation.
For example
--cpu cell0.memory=1234,cell0.cpus=0-3,cell1.memory=5678,cell1.cpus=4-7,\
cell0.distances.sibling0.id=0,cell0.distances.sibling0.value=10,\
cell0.distances.sibling1.id=1,cell0.distances.sibling1.value=21,\
cell1.distances.sibling0.id=0,cell1.distances.sibling0.value=21,\
cell1.distances.sibling1.id=1,cell1.distances.sibling1.value=10
would generate the following XML:
<cpu>
<numa>
<cell cpus="0-3" memory="1234">
<distances>
<sibling id="0" value="10"/>
<sibling id="1" value="21"/>
</distances>
</cell>
<cell cpus="4-7" memory="5678">
<distances>
<sibling id="0" value="21"/>
<sibling id="1" value="10"/>
</distances>
</cell>
</numa>
</cpu>
Signed-off-by: Menno Lageman <menno.lageman@oracle.com>
(crobinso: rework cli format, drop some validation, drop man changes)
2018-01-22 15:36:00 +03:00
cell1 . distances . sibling1 . id = 1 , cell1 . distances . sibling1 . value = 10 , \
2021-08-03 20:59:34 +03:00
numa . interconnects . latency0 . initiator = 0 , numa . interconnects . latency0 . target = 0 , numa . interconnects . latency0 . type = access , numa . interconnects . latency0 . value = 5 , \
numa . interconnects . latency1 . initiator = 0 , numa . interconnects . latency1 . target = 2 , numa . interconnects . latency1 . cache = 1 , numa . interconnects . latency1 . type = access , numa . interconnects . latency1 . value = 10 , numa . interconnects . latency1 . unit = ns , \
numa . interconnects . bandwidth0 . initiator = 0 , numa . interconnects . bandwidth0 . target = 0 , numa . interconnects . bandwidth0 . type = access , numa . interconnects . bandwidth0 . value = 204800 , \
numa . interconnects . bandwidth1 . initiator = 0 , numa . interconnects . bandwidth1 . target = 2 , numa . interconnects . bandwidth1 . cache = 1 , numa . interconnects . bandwidth1 . type = access , numa . interconnects . bandwidth1 . value = 409600 , numa . interconnects . bandwidth1 . unit = KiB , \
2019-05-14 18:25:52 +03:00
cache . mode = emulate , cache . level = 3
2022-02-18 17:39:19 +03:00
- - numatune 1 , 2 , 3 , 5 - 7 , ^ 6 , mode = strict , \
memnode0 . cellid = 1 , memnode0 . mode = strict , memnode0 . nodeset = 2
2021-08-06 17:56:21 +03:00
- - cputune shares = 2048 , period = 1000000 , quota = - 1 , global_period = 1000000 , global_quota = - 1 , emulator_period = 1000000 , emulator_quota = - 1 , iothread_period = 1000000 , iothread_quota = - 1 , \
vcpupin0 . vcpu = 0 , vcpupin0 . cpuset = 0 - 3 , emulatorpin . cpuset = 1 , 7 , iothreadpin0 . iothread = 1 , iothreadpin0 . cpuset = 1 , 7 , \
2021-08-06 18:42:43 +03:00
emulatorsched . scheduler = rr , emulatorsched . priority = 99 , vcpusched0 . vcpus = 0 - 3 , ^ 2 , vcpusched0 . scheduler = fifo , vcpusched0 . priority = 95 , iothreadsched0 . iothreads = 1 , 2 , iothreadsched0 . scheduler = fifo , iothreadsched0 . priority = 90 , \
2021-08-07 12:03:35 +03:00
cachetune0 . vcpus = 0 - 3 , \
cachetune0 . cache0 . level = 3 , cachetune0 . cache0 . id = 0 , cachetune0 . cache0 . type = both , cachetune0 . cache0 . size = 3 , cachetune0 . cache0 . unit = MiB , \
cachetune0 . cache1 . level = 3 , cachetune0 . cache1 . id = 1 , cachetune0 . cache1 . type = both , cachetune0 . cache1 . size = 3 , cachetune0 . cache1 . unit = MiB , \
cachetune0 . monitor0 . level = 3 , cachetune0 . monitor0 . vcpus = 2 , \
cachetune0 . monitor1 . level = 3 , cachetune0 . monitor1 . vcpus = 0 - 3 , ^ 2 , \
cachetune1 . vcpus = 4 - 5 , \
cachetune1 . monitor0 . level = 3 , cachetune1 . monitor0 . vcpus = 4 , \
cachetune1 . monitor1 . level = 3 , cachetune1 . monitor1 . vcpus = 5 , \
2021-08-06 18:42:43 +03:00
memorytune0 . vcpus = 0 - 3 , memorytune0 . node0 . id = 0 , memorytune0 . node0 . bandwidth = 60
2022-02-18 17:39:19 +03:00
2019-05-14 18:25:52 +03:00
- - memtune hard_limit = 10 , soft_limit = 20 , swap_hard_limit = 30 , min_guarantee = 40
2022-02-18 17:39:19 +03:00
2019-07-25 13:15:57 +03:00
- - blkiotune weight = 100 , device_path = / home / test / 1. img , device_weight = 200 , read_bytes_sec = 10000 , write_bytes_sec = 10000 , read_iops_sec = 20000 , write_iops_sec = 20000
2022-02-18 17:39:19 +03:00
2019-05-16 18:29:12 +03:00
- - memorybacking size = 1 , unit = ' G ' , nodeset = 0 , 1 , nosharepages = yes , locked = yes , discard = yes , allocation . mode = immediate , access_mode = shared , source_type = file , hugepages . page . size = 12 , hugepages . page1 . size = 1234 , hugepages . page1 . unit = MB , hugepages . page1 . nodeset = 2
2022-02-18 17:39:19 +03:00
- - iothreads iothreads = 5 , iothreadids . iothread1 . id = 1 , iothreadids . iothread2 . id = 2
- - metadata title = my - title , description = my - description , uuid = 00000000 - 1111 - 2222 - 3333 - 444444444444 , genid = e9392370 - 2917 - 565e-692 b - d057f46512d6 , genid_enable = yes
- - features apic . eoi = off , hap = on , hyperv . synic . state = on , hyperv . reset . state = off , hyperv . spinlocks . state = on , hyperv . spinlocks . retries = 5678 , pae = on , pmu . state = on , pvspinlock . state = off , smm . state = off , viridian = on , vmcoreinfo . state = on , vmport . state = off , kvm . hidden . state = on , hyperv . vapic . state = off , hyperv . relaxed . state = off , gic . version = host , kvm . hint - dedicated . state = on , kvm . poll - control . state = on , ioapic . driver = qemu , acpi = off , eoi = on , privnet = on , hyperv_synic = on , hyperv_reset = on , hyperv_spinlocks = on , hyperv_spinlocks_retries = 5678 , vmport = off , pmu = off , vmcoreinfo = on , kvm_hidden = off , hyperv_vapic = on , smm = off
- - clock offset = utc , hpet_present = no , rtc_tickpolicy = merge , timer2 . name = hypervclock , timer3 . name = pit , timer1 . present = yes , timer3 . tickpolicy = delay , timer2 . present = no , timer4 . name = rtc , timer5 . name = tsc , timer6 . name = tsc , timer4 . track = wall , timer5 . frequency = 10 , timer6 . mode = emulate , timer7 . name = rtc , timer7 . tickpolicy = catchup , timer7 . catchup . threshold = 123 , timer7 . catchup . slew = 120 , timer7 . catchup . limit = 10000 , rtc_present = no , pit_present = yes , pit_tickpolicy = catchup , tsc_present = no , platform_present = no , hypervclock_present = no , platform_tickpolicy = foo , hpet_tickpolicy = bar , tsc_tickpolicy = wibble , kvmclock_tickpolicy = wobble , hypervclock_tickpolicy = woo
- - keywrap cipher0 . name = aes , cipher0 . state = on
2020-09-10 19:06:13 +03:00
2019-05-14 18:25:52 +03:00
- - pm suspend_to_mem = yes , suspend_to_disk = no
2014-12-10 17:33:02 +03:00
2022-02-18 17:39:19 +03:00
- - resource / virtualmachines / production , fibrechannel . appid = myapplication
2014-12-10 17:33:02 +03:00
2019-05-15 23:43:43 +03:00
2022-02-18 17:39:19 +03:00
- - events on_poweroff = destroy , on_reboot = restart , on_crash = preserve , on_lockfailure = ignore
2019-05-15 22:31:43 +03:00
2022-02-18 17:39:19 +03:00
- - idmap uid_start = 0 , uid_target = 1000 , uid_count = 10 , gid_start = 0 , gid_target = 1000 , gid_count = 10
- - sysinfo type = smbios , bios_vendor = " Acme LLC " , bios_version = 1.2 .3 , bios_date = 01 / 01 / 1970 , bios_release = 10.22
- - sysinfo type = smbios , system_manufacturer = " Acme Inc. " , system_product = Computer , system_version = 3.2 .1 , system_serial = 123456789 , system_uuid = 00000000 - 1111 - 2222 - 3333 - 444444444444 , system_sku = abc - 123 , system_family = Server
- - sysinfo type = smbios , baseBoard_manufacturer = " Acme Corp. " , baseBoard_product = Motherboard , baseBoard_version = A01 , baseBoard_serial = 1234 - 5678 , baseBoard_asset = Tag , baseBoard_location = Chassis
- - sysinfo type = smbios , chassis . manufacturer = " Chassis Corp. " , chassis . serial = 1234 chassis , chassis . asset = chasset , chassis . sku = chassku , chassis . version = 4.0
- - sysinfo type = smbios , oemStrings . entry2 = " complicated parsing, foo=bar " , oemStrings . entry1 = test1 , oemStrings . entry0 = test0
- - sysinfo bios . vendor = " Acme LLC " , bios . version = 1.2 .3 , bios . date = 01 / 01 / 1970 , bios . release = 10.22 , system . manufacturer = " Acme Inc. " , system . product = Computer , system . version = 3.2 .1 , system . serial = 123456789 , system . uuid = 00000000 - 1111 - 2222 - 3333 - 444444444444 , system . sku = abc - 123 , system . family = Server , baseBoard . manufacturer = " Acme Corp. " , baseBoard . product = Motherboard , baseBoard . version = A01 , baseBoard . serial = 1234 - 5678 , baseBoard . asset = Tag , baseBoard . location = Chassis
2014-12-10 17:33:02 +03:00
2019-05-14 18:25:52 +03:00
2021-07-26 19:44:45 +03:00
- - disk type = block , source . dev = / dev / default - pool / UPPER , cache = writeback , io = threads , perms = sh , serial = WD - WMAP9A966149 , wwn = 123456789 abcdefa , boot_order = 2 , driver . iothread = 3 , driver . queues = 8
2022-02-03 21:30:50 +03:00
- - disk source . file = % ( NEWIMG1 ) s , sparse = false , size = .001 , perms = ro , error_policy = enospace , detect_zeroes = unmap , address . type = drive , address . controller = 0 , address . target = 2 , address . unit = 0
- - disk device = cdrom , bus = sata , read_bytes_sec = 1 , read_iops_sec = 2 , write_bytes_sec = 5 , write_iops_sec = 6 , driver . copy_on_read = on , geometry . cyls = 16383 , geometry . heads = 16 , geometry . secs = 63 , geometry . trans = lba , discard = ignore
2019-05-14 18:25:52 +03:00
- - disk size = 1
2019-05-20 14:43:34 +03:00
- - disk / iscsi - pool / diskvol1 , total_bytes_sec = 10 , total_iops_sec = 20 , bus = scsi , device = lun , sgio = unfiltered , rawio = yes
2019-05-15 23:26:23 +03:00
- - disk / dev / default - pool / iso - vol , seclabel . model = dac , seclabel1 . model = selinux , seclabel1 . relabel = no , seclabel0 . label = foo , bar , baz , iotune . read_bytes_sec = 1 , iotune . read_iops_sec = 2 , iotune . write_bytes_sec = 5 , iotune . write_iops_sec = 6
- - disk / dev / default - pool / iso - vol , format = qcow2 , startup_policy = optional , iotune . total_bytes_sec = 10 , iotune . total_iops_sec = 20 ,
2022-02-18 17:39:19 +03:00
- - disk source_pool = rbd - ceph , source_volume = some - rbd - vol , size = .1 , driver_type = raw , driver_name = qemu
2019-05-15 23:26:23 +03:00
- - disk pool = rbd - ceph , size = .1 , driver . name = qemu , driver . type = raw , driver . discard = unmap , driver . detect_zeroes = unmap , driver . io = native , driver . error_policy = stop
2019-05-14 18:25:52 +03:00
- - disk source_protocol = http , source_host_name = example . com , source_host_port = 8000 , source_name = / path / to / my / file
2019-05-15 23:26:23 +03:00
- - disk source . protocol = http , source . host0 . name = exampl2 . com , source . host . port = 8000 , source . name = / path / to / my / file
2022-02-11 22:22:48 +03:00
- - disk source . protocol = nbd , source . host . transport = unix , source . host . socket = / tmp / socket , snapshot_policy = no
2021-05-20 09:48:27 +03:00
- - disk source . protocol = nbd , source_host_transport = unix , source_host_socket = / tmp / socket , bus = scsi , logical_block_size = 512 , physical_block_size = 512 , blockio . logical_block_size = 512 , blockio . physical_block_size = 512 , target . dev = sdz , rotation_rate = 5000
2019-05-14 18:25:52 +03:00
- - disk gluster : / / 192.168 .1 .100 / test - volume / some / dir / test - gluster . qcow2
2019-05-16 00:30:21 +03:00
- - disk nbd + unix : / / / var / foo / bar / socket , bus = usb , removable = on , address . type = usb , address . bus = 0 , address . port = 2
2019-05-14 18:25:52 +03:00
- - disk path = http : / / [ 1 : 2 : 3 : 4 : 1 : 2 : 3 : 4 ] : 5522 / my / path ? query = foo
- - disk vol = gluster - pool / test - gluster . raw
2019-07-02 21:07:16 +03:00
- - disk / var , device = floppy , snapshot = no , perms = rw
2019-05-15 23:26:23 +03:00
- - disk % ( NEWIMG2 ) s , size = 1 , backing_store = / tmp / foo . img , backing_format = vmdk , bus = usb , target . removable = yes
2019-05-14 19:33:07 +03:00
- - disk / tmp / brand - new . img , size = 1 , backing_store = / dev / default - pool / iso - vol , boot . order = 10 , boot . loadparm = 5
2019-05-15 23:26:23 +03:00
- - disk path = / dev / disk - pool / diskvol7 , device = lun , bus = scsi , reservations . managed = no , reservations . source . type = unix , reservations . source . path = / var / run / test / pr - helper0 . sock , reservations . source . mode = client , \
2021-05-20 09:48:27 +03:00
source . reservations . managed = no , source . reservations . source . type = unix , source . reservations . source . path = / var / run / test / pr - helper0 . sock , source . reservations . source . mode = client , target . rotation_rate = 6000
2019-06-15 03:35:41 +03:00
- - disk vol = iscsi - direct / unit : 0 : 0 : 1
2021-05-26 04:22:11 +03:00
- - disk size = .0001 , format = raw , transient = on , transient . shareBacking = yes
2020-01-29 15:30:51 +03:00
- - disk size = .0001 , pool = disk - pool
2020-01-30 03:17:54 +03:00
- - disk path = % ( EXISTIMG1 ) s , type = dir
2021-05-26 04:22:10 +03:00
- - disk path = / fooroot . img , size = .0001 , transient = on
2020-09-13 16:38:06 +03:00
- - disk source . dir = /
2020-09-13 16:52:56 +03:00
- - disk type = nvme , source . type = pci , source . managed = no , source . namespace = 2 , source . address . domain = 0x0001 , source . address . bus = 0x02 , source . address . slot = 0x00 , source . address . function = 0x0
2019-05-14 18:25:52 +03:00
2022-02-18 17:39:19 +03:00
2019-05-14 18:25:52 +03:00
- - network user , mac = 12 : 34 : 56 : 78 : 11 : 22 , portgroup = foo , link_state = down , rom_bar = on , rom_file = / tmp / foo
2019-05-15 23:51:46 +03:00
- - network bridge = foobar , model = virtio , driver_name = qemu , driver_queues = 3 , filterref = foobar , rom . bar = off , rom . file = / some / rom , source . portgroup = foo
- - network bridge = ovsbr , virtualport . type = openvswitch , virtualport_profileid = demo , virtualport_interfaceid = 09 b11c53 - 8 b5c - 4 eeb - 8 f00 - d84eaa0aaa3b , link . state = yes , driver . name = qemu , driver . queues = 3 , filterref . filter = filterbar , target . dev = mytargetname , virtualport . parameters . profileid = demo , virtualport . parameters . interfaceid = 09 b11c53 - 8 b5c - 4 eeb - 8 f00 - d84eaa0aaa3b
- - network type = direct , source = eth5 , source_mode = vepa , source . mode = vepa , target = mytap12 , virtualport_type = 802.1 Qbg , virtualport_managerid = 12 , virtualport_typeid = 1193046 , virtualport_typeidversion = 1 , virtualport_instanceid = 09 b11c53 - 8 b5c - 4 eeb - 8 f00 - d84eaa0aaa3b , boot_order = 1 , trustGuestRxFilters = yes , mtu . size = 1500 , virtualport . parameters . managerid = 12 , virtualport . parameters . typeid = 1193046 , virtualport . parameters . typeidversion = 1 , virtualport . parameters . instanceid = 09 b11c53 - 8 b5c - 4 eeb - 8 f00 - d84eaa0aaa3b , boot_order = 1 , trustGuestRxFilters = yes , mtu . size = 1500
2019-07-02 21:07:16 +03:00
- - network user , model = virtio , address . type = spapr - vio , address . reg = 0x500 , link . state = no
2019-05-16 00:30:21 +03:00
- - network vhostuser , source_type = unix , source_path = / tmp / vhost1 . sock , source_mode = server , model = virtio , source . type = unix , source . path = / tmp / vhost1 . sock , address . type = pci , address . bus = 0x00 , address . slot = 0x10 , address . function = 0x0 , address . domain = 0x0000
2019-05-14 19:33:07 +03:00
- - network user , address . type = ccw , address . cssid = 0xfe , address . ssid = 0 , address . devno = 01 , boot . order = 15 , boot . loadparm = SYSTEM1
2020-09-18 23:06:39 +03:00
- - network model = vmxnet3
2019-05-14 18:25:52 +03:00
2022-02-18 17:39:19 +03:00
2019-05-14 18:25:52 +03:00
- - graphics sdl
- - graphics spice , keymap = none
- - graphics vnc , port = 5950 , listen = 1.2 .3 .4 , keymap = ja , password = foo
2020-07-16 15:55:17 +03:00
- - graphics vnc , port = 5950 , listen = 1.2 .3 .4 , keymap = ja , password = foo , websocket = 15950
- - graphics vnc , port = 5950 , listen = 1.2 .3 .4 , keymap = ja , password = foo , websocket = - 1
2019-05-14 18:25:52 +03:00
- - graphics spice , port = 5950 , tlsport = 5950 , listen = 1.2 .3 .4 , keymap = ja
2019-05-16 17:21:19 +03:00
- - graphics spice , image_compression = glz , streaming_mode = filter , clipboard_copypaste = yes , mouse_mode = client , filetransfer_enable = on , zlib . compression = always
2019-05-15 23:37:50 +03:00
- - graphics spice , gl = yes , listen = socket , image . compression = glz , streaming . mode = filter , clipboard . copypaste = yes , mouse . mode = client , filetransfer . enable = on , tlsPort = 6000 , passwd = testpass , passwdValidTo = 2010 - 04 - 09 T15 : 51 : 00 , passwordValidTo = 2010 - 04 - 09 T15 : 51 : 01 , defaultMode = insecure
2019-05-14 18:25:52 +03:00
- - graphics spice , gl = yes , listen = none
2019-05-15 23:37:50 +03:00
- - graphics spice , gl . enable = yes , listen = none , rendernode = / dev / dri / foo , gl . rendernode = / dev / dri / foo2
- - graphics spice , listens0 . type = address , listens0 . address = 1.2 .3 .4 , connected = disconnect
2019-05-14 18:25:52 +03:00
- - graphics spice , listens0 . type = network , listens0 . network = default
- - graphics spice , listens0 . type = socket , listens0 . socket = / tmp / foobar
2022-02-18 17:39:19 +03:00
2019-05-14 18:25:52 +03:00
- - controller usb , model = ich9 - ehci1 , address = 0 : 0 : 4.7 , index = 0
- - controller usb , model = ich9 - uhci1 , address = 0 : 0 : 4.0 , index = 0 , master = 0 , address . multifunction = on
2019-05-15 23:13:38 +03:00
- - controller usb , model = ich9 - uhci2 , address = 0 : 0 : 4.1 , index = 0 , master . startport = 2
2019-05-14 18:25:52 +03:00
- - controller usb , model = ich9 - uhci3 , address = 0 : 0 : 4.2 , index = 0 , master = 4
2020-09-18 21:09:38 +03:00
- - controller scsi , , model = virtio - scsi , driver_queues = 4 , driver . queues = 4 , driver . iothread = 2 , vectors = 15
2019-05-14 18:25:52 +03:00
- - controller xenbus , maxGrantFrames = 64
2020-11-21 00:59:54 +03:00
- - controller pci , index = 0 , model = pcie - root - port , target . chassis = 1 , target . port = 1 , target . hotplug = off
- - controller pci , index = 1 , model = pci - root , target . index = 1
- - controller pci , index = 2 , model = pci - bridge , target . chassisNr = 1
- - controller pci , index = 3 , model = pci - expander - bus , target . busNr = 252 , target . node = 1
2022-02-18 17:39:19 +03:00
- - controller usb3
- - controller scsi , model = virtio - scsi
- - controller usb2
2019-05-14 18:25:52 +03:00
- - input type = keyboard , bus = usb
- - input tablet
2019-06-09 23:39:15 +03:00
- - input mouse
2021-07-27 21:21:46 +03:00
- - input mouse , bus = virtio , model = virtio - non - transitional
- - input passthrough , source . evdev = / dev / input / event1 , bus = virtio
- - input evdev , source . dev = / dev / input / event1234 , source . repeat = on , source . grab = all , source . grabToggle = ctrl - ctrl
2019-05-14 18:25:52 +03:00
2022-02-18 17:39:19 +03:00
2019-12-24 20:02:53 +03:00
- - serial char_type = tcp , host = : 2222 , mode = bind , protocol = telnet , log . file = / tmp / foo . log , log . append = yes , , target . model . name = pci - serial
2019-05-14 19:25:00 +03:00
- - serial nmdm , source . master = / dev / foo1 , source . slave = / dev / foo2 , alias . name = testalias7
2022-02-18 17:39:19 +03:00
2019-12-24 20:02:53 +03:00
- - parallel type = udp , host = 0.0 .0 .0 : 1234 , bind_host = 127.0 .0 .1 : 1234
2019-05-16 00:24:58 +03:00
- - parallel udp , source . connect_host = 127.0 .0 .2 , source . connect_service = 8888 , source . bind_host = 127.0 .0 .1 , source . bind_service = 7777
2019-05-14 18:25:52 +03:00
- - parallel unix , path = / tmp / foo - socket , source . seclabel0 . model = none , source . seclabel1 . model = dac , source . seclabel1 . relabel = yes , source . seclabel1 . label = foobar , source . seclabel . relabel = no
2022-02-18 17:39:19 +03:00
2019-05-14 18:25:52 +03:00
- - channel pty , target_type = guestfwd , target_address = 127.0 .0 .1 : 10000
2019-05-16 00:24:58 +03:00
- - channel pty , target_type = guestfwd , target . address = 127.0 .0 .1 , target . port = 1234
2019-05-14 18:25:52 +03:00
- - channel pty , target_type = virtio , name = org . linux - kvm . port1
2019-05-16 00:24:58 +03:00
- - channel pty , target . type = virtio , target . name = org . linux - kvm . port2
2019-05-14 18:25:52 +03:00
- - channel spicevmc
2022-02-18 17:39:19 +03:00
- - console pty , target_type = virtio
2019-05-14 18:25:52 +03:00
- - hostdev net_00_1c_25_10_b1_e4 , boot_order = 4 , rom_bar = off
- - host - device usb_device_781_5151_2004453082054CA1BEEE
- - host - device 001.003
- - hostdev 15 : 0.1
- - host - device 2 : 15 : 0.2
2019-05-14 19:20:53 +03:00
- - hostdev 0 : 15 : 0.3 , address . type = pci , address . zpci . uid = 0xffff , address . zpci . fid = 0xffffffff
2021-10-29 14:18:54 +03:00
- - host - device 0x062a : 0x0001 , driver_name = vfio
- - host - device 0483 : 2016
2019-05-15 23:03:26 +03:00
- - host - device pci_8086_2829_scsi_host_scsi_device_lun0 , rom . bar = on
2019-05-14 18:25:52 +03:00
- - hostdev usb_5_20 - - hostdev usb_5_21
2019-07-02 20:01:12 +03:00
- - hostdev wlan0 , type = net
- - hostdev / dev / vdz , type = storage
- - hostdev / dev / pty7 , type = misc
2021-04-14 18:18:55 +03:00
- - hostdev mdev_8e37ee90_2b51_45e3_9b25_bf8283c03110 , address . type = ccw , address . cssid = 0xfe , address . ssid = 0x1 , address . devno = 0x0008
- - hostdev mdev_11f92c9d_b0b0_4016_b306_a8071277f8b9
- - hostdev mdev_4b20d080_1b54_4048_85b3_a6a62d165c01 , address . type = pci , address . domain = 0x0000 , address . bus = 0x01 , address . slot = 0x01 , address . function = 0x0 , address . zpci . uid = 0x0001 , address . zpci . fid = 0x00000001
2019-05-14 18:25:52 +03:00
2022-01-27 01:11:56 +03:00
- - filesystem / source , / target , alias . name = testfsalias , driver . ats = on , driver . iommu = off , driver . packed = on , driver . page_per_vq = off
2019-05-14 18:25:52 +03:00
- - filesystem template_name , / , type = template , mode = passthrough
2020-09-10 20:06:41 +03:00
- - filesystem type = file , source = / tmp / somefile . img , target = / mount / point , accessmode = squash , driver . format = qcow2 , driver . type = path , driver . wrpolicy = immediate
- - filesystem type - mount , source . dir = / , target = /
- - filesystem type = template , source . name = foo , target = /
- - filesystem type = file , source . file = foo . img , target = /
2021-07-30 20:15:29 +03:00
- - filesystem type = volume , model = virtio , multidevs = remap , readonly = on , space_hard_limit = 1234 , space_soft_limit = 500 , source . pool = pool1 , source . volume = vol , driver . name = virtiofs , driver . queue = 3 , binary . path = / foo / virtiofsd , binary . xattr = off , binary . cache . mode = always , binary . lock . posix = off , binary . lock . flock = on , target . dir = / foo , binary . sandbox . mode = chroot , source . socket = / tmp / foo . sock
2020-09-10 20:06:41 +03:00
- - filesystem type = block , source . dev = / dev / foo , target . dir = /
- - filesystem type = ram , source . usage = 1024 , source . units = MiB , target = /
2022-02-18 17:39:19 +03:00
- - filesystem / foo / source , / bar / target , fmode = 0123 , dmode = 0345
2022-02-19 17:23:47 +03:00
- - filesystem / foo1 , / bar1 , driver . type = virtiofs
2022-02-18 17:39:19 +03:00
2019-05-14 18:25:52 +03:00
- - soundhw default
- - sound ac97
2021-04-07 00:06:15 +03:00
- - sound codec0 . type = micro , codec1 . type = duplex , codec2 . type = output
2019-05-14 18:25:52 +03:00
2022-02-18 17:39:19 +03:00
2019-05-14 18:25:52 +03:00
- - video cirrus
- - video model = qxl , vgamem = 1 , ram = 2 , vram = 3 , heads = 4 , accel3d = yes , vram64 = 65
2019-05-15 23:53:55 +03:00
- - video model = qxl , model . vgamem = 1 , model . ram = 2 , model . vram = 3 , model . heads = 4 , model . acceleration . accel3d = yes , model . vram64 = 65
2019-05-14 18:25:52 +03:00
2022-02-18 17:39:19 +03:00
2019-05-14 18:25:52 +03:00
- - smartcard passthrough , type = spicevmc
- - smartcard mode = host
- - smartcard default
2019-05-13 23:17:08 +03:00
- - smartcard passthrough , type = tcp , source . mode = bind , source . host = 1.2 .3 .4 , source . service = 5678 , protocol . type = telnet
2019-05-14 18:25:52 +03:00
- - smartcard host - certificates , type = spicevmc , database = / fake / path / to / database , certificate0 = / path / to / fake / cert0 , certificate1 = / path / to / fake / cert1 , certificate2 = / path / to / fake / cert2
2022-02-18 17:39:19 +03:00
2019-05-14 18:25:52 +03:00
- - redirdev usb , type = spicevmc
- - redirdev usb , type = tcp , server = localhost : 4000
- - redirdev usb , type = tcp , server = 127.0 .0 .1 : 4002 , boot_order = 3
- - redirdev default
2019-05-13 23:17:08 +03:00
- - redirdev type = unix , source . path = / tmp / foo . socket , log . file = / tmp / 123. log
2019-05-14 18:25:52 +03:00
2022-02-18 17:39:19 +03:00
- - rng / dev / random
2019-05-16 00:21:26 +03:00
- - rng device = / dev / urandom , backend . protocol . type = , backend . log . file = , backend . log . append =
2022-02-18 17:39:19 +03:00
- - rng type = egd , backend . type = nmdm , backend . source . master = / dev / foo1 , backend . source . slave = / dev / foo2
- - rng egd , backend_host = 127.0 .0 .1 , backend_service = 8000 , backend_type = udp , backend_mode = bind , backend_connect_host = foo , backend_connect_service = 708 , rate . bytes = 1234 , rate . period = 1000 , model = virtio
- - panic iobase = 507 , , address . type = isa , address . iobase = 0x500 , address . irq = 5
2019-05-14 18:25:52 +03:00
2022-02-18 17:39:19 +03:00
- - shmem shmem0 , role = master , model . type = ivshmem - plain , size = 8 , size . unit = M
2021-07-26 23:14:30 +03:00
- - shmem name = my_shmem0 , role = peer , model . type = ivshmem - plain , size = 4 , size . unit = M
- - shmem name = shmem_server , model . type = ivshmem - doorbell , size = 2 , size . unit = M , server . path = / tmp / socket - shmemm , msi . vectors = 32 , msi . ioeventfd = on
2022-02-18 17:39:19 +03:00
2019-05-14 18:25:52 +03:00
- - vsock cid = 17
2022-02-18 17:39:19 +03:00
- - tpm passthrough , model = tpm - crb , path = / dev / tpm0 , backend . encryption . secret = 11111111 - 2222 - 3333 - 4444 - 5555555555 , backend . persistent_state = yes , active_pcr_banks . sha1 = on , active_pcr_banks . sha256 = yes , active_pcr_banks . sha384 = yes , active_pcr_banks . sha512 = yes , version = 2.0
- - watchdog ib700 , action = pause
- - memballoon virtio , autodeflate = on , stats . period = 10 , freePageReporting = on
- - iommu model = intel , driver . aw_bits = 48 , driver . caching_mode = on , driver . eim = off , driver . intremap = off , driver . iotlb = off
- - seclabel type = static , label = ' system_u:object_r:svirt_image_t:s0:c100,c200 ' , relabel = yes , baselabel = baselabel
- - seclabel type = dynamic , label = 012 : 345
2019-05-14 18:25:52 +03:00
- - qemu - commandline env = DISPLAY = : 0.1
- - qemu - commandline = " -display gtk,gl=on "
- - qemu - commandline = " -device vfio-pci,addr=05.0,sysfsdev=/sys/class/mdev_bus/0000:00:02.0/f321853c-c584-4a6b-b99a-3eee22a3919c "
- - qemu - commandline = " -set device.video0.driver=virtio-vga "
2019-07-02 21:07:16 +03:00
- - qemu - commandline args = " -foo bar "
2020-09-10 20:52:07 +03:00
2022-02-18 17:39:19 +03:00
2020-09-10 20:52:07 +03:00
- - xml / domain / @foo = bar
- - xml xpath . set = . / baz , xpath . value = wib
- - xml . / deleteme / deleteme2 / deleteme3 = foo
- - xml . / t1 / t2 / @foo = 123
- - xml . / devices / graphics [ 1 ] / ab = cd
- - xml . / devices / graphics [ 2 ] / @ef = hg
- - xml xpath . create = . / barenode
- - xml xpath . delete = . / deleteme / deleteme2
2022-02-18 17:39:19 +03:00
2021-07-27 21:21:46 +03:00
""" , " many-devices " , predefine_check= " 7.4.0 " )
2013-08-17 17:44:11 +04:00
2016-03-04 14:31:53 +03:00
2022-02-18 17:39:19 +03:00
# Specific XML test cases #1
c . add_compare (
" --memory 512,maxmemory=1024 " # special --memory XXX,maxmemory= handling
" --description \" foobar & baz \" " # compat --description handling
" --uuid 12345678-12F4-1234-1234-123456789AFA " # compat --uuid handling
" --vcpus sockets=2,threads=2,dies=1,sockets=2 " # --vcpus determine count from topology
" --cpuset 1,3-5 " # setting compat --cpuset when --vcpus is present
" --seclabel relabel=yes " # lets libvirt fill in type and model
" --sysinfo host " # special `--sysinfo host` handling
" --noapic --noacpi " # feature backcompat
" --boot uefi,cdrom,fd,hd,network,menu=on " # uefi for default devices, + old style bootorder
# Disabling all the default device setup
"""
- - cpu none
- - disk none
- - console none
- - channel none
- - network none
- - sound none
- - redirdev none
- - memballoon none
- - smartcard none
- - tpm none
- - rng none
""" , " singleton-config-1 " )
2016-03-04 14:31:53 +03:00
2017-01-26 17:08:36 +03:00
2022-02-18 17:39:19 +03:00
# Specific XML test cases #2
c . add_compare ( " --pxe "
" --ram 4000000 " # Ram overcommit
" --cpu host-copy " # test host-copy back compat
" --seclabel type=dynamic " # test a fallback case when guessing model=
" --sysinfo emulate " # special `--sysinfo emulate` handling
" --cpuset 1,3-5 " # setting compat --cpuset when --vcpus is not present
# 'default' handling for solo devices
"""
- - tpm default
- - panic default
- - memballoon default
- - watchdog default
- - vsock default
""" , " singleton-config-2 " , predefine_check= " 7.2.0 " )
2017-01-26 18:11:31 +03:00
2022-02-18 17:39:19 +03:00
# Specific XML test cases #3
c . add_compare ( " "
" --cpu qemu64,secure=off " # disable security features that are added by default
" --sysinfo type=fwcfg,entry0.name=foo,entry0.file=bar,entry0=baz " # --sysinfo type=fwcfg options
" --boot smbios.mode=emulate,boot1.dev=hd,boot.dev=network,initarg1=bar=baz,initarg=foo " # --boot option conflicts
" --memory currentMemory=100,memory=200,maxmemory=300,maxMemory=400,maxMemory.slots=1 " # --memory option backcompat handling
" --graphics spice,gl=yes " # gl=on enables --video virtio 3d accel
" --cpuset auto " # confirm `--cpuset auto` works
" --vcpus vcpu.current=2,maxvcpus=4 " # special current + max handling
" --vsock auto_cid=on " # --vsock auto cid must be specified on its own
" --tpm /dev/tpm0 " # --tpm PATH compat handling
" " , " singleton-config-3 " , predefine_check = " 5.7.0 " )
2017-01-26 18:11:31 +03:00
2017-05-04 14:08:14 +03:00
2013-08-17 17:44:11 +04:00
2022-02-18 17:39:19 +03:00
# --memdev setup has a lot of interconnected validation, it's easier to keep this separate
c . add_compare ( " --pxe "
" --memory hotplugmemorymax=2048,hotplugmemoryslots=3 "
" --cpu cell0.cpus=0,cell0.memory=1048576 "
" --memdev dimm,access=private,target_size=256,target_node=0, "
" source_pagesize=4,source_nodemask=1-2,discard=on "
" --memdev dimm,access=private,target_size=256,target_node=0, "
" source.pagesize=4,source.nodemask=1-2,discard=on "
" --memdev nvdimm,source_path=/path/to/nvdimm, "
" target_size=512,target_node=0,target_label_size=128,alias.name=mymemdev3, "
" target.block=2048,target.requested=1048576,target.current=524288, "
" address.type=dimm,address.base=0x100000000,address.slot=1, "
" source.pmem=on,source.alignsize=2048,target.readonly=on "
" " , " memory-hotplug " , precompare_check = " 5.3.0 " )
# Hitting test driver specific output
c . add_compare ( " --connect " + utils . URIs . test_suite + " "
" --cpu host-passthrough,migratable=on " # migratable=on is only accepted with host-passthrough
" --seclabel label=foobar.label,a1,z2,b3,relabel=yes,type=dynamic " # fills in default model=testModel
" --tpm default " # --tpm default when domcaps missing
" " ,
" testdriver-edgecases " )
# Test various storage corner cases
c . add_compare (
" --disk path= %(EXISTIMG1)s " # Existing disk, no extra options
" --disk pool=default-pool,size=.0001 --disk pool=default-pool,size=.0001 " # Create 2 volumes in a pool
" --disk path= %(EXISTIMG1)s ,bus=ide --disk path= %(EXISTIMG1)s ,bus=ide --disk path= %(EXISTIMG1)s ,bus=ide --disk path= %(EXISTIMG1)s ,device=cdrom,bus=ide " # 3 IDE and CD
" --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi --disk path= %(EXISTIMG1)s ,bus=scsi " # > 16 scsi disks
" --disk path= %(NEWIMG1)s ,format=raw,size=.0000001 " # Managed file using format raw
" --disk %(NEWIMG2)s ,format=qcow2,size=.0000001 " # Managed file using format qcow2
" --disk /dev/zero " # Referencing a local unmanaged /dev node
" --disk pool=default,size=.00001 " # Building 'default' pool
" --disk /some/new/pool/dir/new,size=.1 " # autocreate the pool
" --disk /dev/default-pool/sharevol.img,perms=sh " # Colliding shareable storage
" " , " storage-creation " )
2013-08-17 17:44:11 +04:00
2014-12-10 17:33:02 +03:00
########################
# Storage provisioning #
########################
2013-08-17 17:44:11 +04:00
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c = vinst . add_category ( " storage " , " --pxe --nographics --noautoconsole --hvm --osinfo detect=yes,require=no " )
2015-04-12 02:25:46 +03:00
c . add_valid ( " --disk %(COLLIDE)s --check path_in_use=off " ) # Colliding storage with --check
2013-08-17 17:44:11 +04:00
c . add_valid ( " --disk %(COLLIDE)s --force " ) # Colliding storage with --force
2015-04-12 02:25:46 +03:00
c . add_valid ( " --disk %(NEWIMG1)s ,sparse=true,size=100000000 --check disk_size=off " ) # Don't warn about fully allocated file exceeding disk space
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --disk /dev/zero --nodisks " , grep = " Cannot specify storage and use --nodisks " )
c . add_invalid ( " --file %(NEWIMG1)s --file-size 100000 --nonsparse " , grep = " There is not enough free space " ) # Nonexisting file, size too big
c . add_invalid ( " --file %(NEWIMG1)s --file-size 100000 " , grep = " The requested volume capacity will exceed the " ) # Huge file, sparse, but no prompting
c . add_invalid ( " --file %(EXISTIMG1)s --file %(EXISTIMG1)s --file %(EXISTIMG1)s --file %(EXISTIMG1)s --file %(EXISTIMG1)s " , grep = " Only 4 disks " ) # Too many IDE
2020-01-29 03:03:44 +03:00
c . add_invalid ( " --disk device=disk " , grep = " requires a path " ) # --disk device=disk, but no path
c . add_invalid ( " --disk pool=disk-pool,size=1,format=qcow2 " , grep = " Format attribute not supported " ) # format= invalid for disk pool
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --disk pool=foopool,size=.0001 " , grep = " no storage pool with matching name " ) # Specify a nonexistent pool
c . add_invalid ( " --disk vol=default-pool/foovol " , grep = " no storage vol with matching " ) # Specify a nonexistent volume
c . add_invalid ( " --disk vol=default-pool-no-slash " , grep = " Storage volume must be specified as vol=poolname/volname " ) # Wrong vol= format
c . add_invalid ( " --disk perms=badformat " , grep = " Unknown ' perms ' value " ) # Wrong perms= format
c . add_invalid ( " --disk size=badformat " , grep = " could not convert string " ) # Wrong size= format
c . add_invalid ( " --disk pool=default-pool " , grep = " Size must be specified for non existent " ) # Specify a pool with no size
c . add_invalid ( " --disk path=/dev/foo/bar/baz,format=qcow2,size=.0000001 " , grep = " Use libvirt APIs to manage the parent " ) # Unmanaged file using non-raw format
c . add_invalid ( " --disk path=/dev/disk-pool/newvol1.img,format=raw,size=.0000001 " , grep = " Format attribute not supported for this volume type " ) # Managed disk using any format
c . add_invalid ( " --disk %(NEWIMG1)s " , grep = " Size must be specified " ) # Not specifying path= and non existent storage w/ no size
c . add_invalid ( " --disk %(NEWIMG1)s ,sparse=true,size=100000000000 " , grep = " The requested volume capacity will exceed " ) # Fail if fully allocated file would exceed disk space
c . add_invalid ( " --connect % (URI-TEST-FULL)s --disk %(COLLIDE)s --prompt " , grep = " already in use by other guests " ) # Colliding storage with --prompt should still fail
c . add_invalid ( " --connect % (URI-TEST-FULL)s --disk /dev/default-pool/backingl3.img " , grep = " already in use by other guests " ) # Colliding storage via backing store
c . add_invalid ( " --connect % (URI-TEST-FULL)s --disk source_pool=rbd-ceph,source_volume=vol1 " , grep = " already in use by other guests " ) # Collision with existing VM, via source pool/volume
c . add_invalid ( " --disk source.pool=default-pool,source.volume=idontexist " , grep = " no storage vol with matching name ' idontexist ' " ) # trying to lookup non-existent volume, hit specific error code
2022-02-18 17:39:19 +03:00
c . add_invalid ( " --disk size=1 --seclabel model=foo,type=bar " , grep = " not appear to have been successful " ) # Libvirt will error on the invalid security params, which should trigger the code path to clean up the disk images we created.
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --disk size=1 --file foobar " , grep = " Cannot mix --file " ) # --disk and --file collision
2013-08-17 17:44:11 +04:00
2014-12-10 17:33:02 +03:00
################################################
# Invalid devices that hit virtinst code paths #
################################################
2013-08-17 17:44:11 +04:00
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c = vinst . add_category ( " invalid-devices " , " --noautoconsole --nodisks --pxe --osinfo require=no " )
2022-02-18 17:39:19 +03:00
c . add_invalid ( " --clock foo_tickpolicy=merge " , grep = " Unknown --clock options: [ ' foo_tickpolicy ' ] " ) # Bad suboption
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --connect % (URI-TEST-FULL)s --host-device 1d6b:2 " , grep = " corresponds to multiple node devices " )
c . add_invalid ( " --connect % (URI-TEST-FULL)s --host-device pci_8086_2850_scsi_host_scsi_host " , grep = " Unsupported node device type ' scsi_host ' " ) # Unsupported hostdev type
c . add_invalid ( " --host-device foobarhostdev " , grep = " Unknown hostdev address string format " ) # Unknown hostdev
c . add_invalid ( " --host-device 300:400 " , grep = " Did not find a matching node device " ) # Parseable hostdev, but unknown digits
c . add_invalid ( " --controller address=foobar " , grep = " Expected PCI format string for ' foobar ' " ) # Invalid address= value
c . add_invalid ( " --graphics vnc,port=-50 " , grep = " above 5900 " ) # Invalid port
c . add_invalid ( " --graphics spice,tlsport=5 " , grep = " TLS Port must be " ) # Invalid port
c . add_invalid ( " --vnc --sdl " , grep = " Can ' t specify more than one of VNC, SDL " ) # Multi graphics option collision
c . add_invalid ( " --boot uefi " , grep = " Libvirt version does not support UEFI " ) # URI doesn't support UEFI bits
2019-07-02 21:07:16 +03:00
c . add_invalid ( " --graphics type=vnc,keymap " , grep = " Option ' keymap ' had no value set. " )
2020-09-10 20:52:07 +03:00
c . add_invalid ( " --xml FOOXPATH " , grep = " form of XPATH=VALUE " ) # failure parsing xpath value
c . add_invalid ( " --xml /@foo=bar " , grep = " /@foo xmlXPathEval " ) # failure processing xpath
2021-07-27 23:03:43 +03:00
c . add_invalid ( " --memdev nvdimm,source.path=/path/to/nvdimm,target.size=2,target.node=0,target.label_size=1,alias.name=mymemdev3,uuid=11111111-2222-aaaa-bbbb-ccccddddeeee " , grep = " UUID is not supported " , prerun_check = " 7.5.0 " ) # hit a specific libvirt code path that proves --memdev uuid=XXX works
2013-08-17 17:44:11 +04:00
2014-12-10 17:33:02 +03:00
########################
# Install option tests #
########################
c = vinst . add_category ( " nodisk-install " , " --nographics --noautoconsole --nodisks " )
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_valid ( " --os-variant generic --pxe --ram 16 " , grep = " Requested memory 16 MiB is abnormally low " ) # catch low memory error
2019-06-14 18:24:10 +03:00
c . add_valid ( " --os-variant winxp --ram 32 --cdrom %(EXISTIMG1)s " , grep = " 32 MiB is less than the recommended 64 MiB " ) # Windows. Catch memory warning
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_valid ( " --osinfo generic --pxe --autostart " ) # --autostart flag
2022-02-18 17:39:19 +03:00
c . add_valid ( " --cdrom %(EXISTIMG2)s --os-variant win2k3 --print-step 2 " ) # HVM windows install, print 3rd stage XML
c . add_compare ( " --location location= %(TREEDIR)s --initrd-inject virt-install --extra-args ks=file:/virt-install " , " initrd-inject " ) # initrd-inject
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_compare ( " --cdrom http://example.com/path/to/some.iso --os-variant detect=yes,require=no " , " cdrom-url " )
2020-09-15 02:05:58 +03:00
c . add_compare ( " --pxe --print-step all --os-variant none " , " simple-pxe " ) # Diskless PXE install
c . add_compare ( " --location ftp://example.com --os-variant auto " , " fake-ftp " ) # fake ftp:// install using urlfetcher.py mocking
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_compare ( " --location https://foobar.com --os-variant detect=no,require=no " , " fake-http " ) # fake https:// install using urlfetcher.py mocking, but also hit --os-variant detect=no
2020-09-15 03:28:02 +03:00
c . add_compare ( " --location https://foobar.com --os-variant detect=yes,name=win7 " , " os-detect-success-fallback " ) # os detection succeeds, so fallback should be ignored
c . add_compare ( " --pxe --os-variant detect=yes,name=win7 " , " os-detect-fail-fallback " ) # os detection succeeds, so fallback should be ignored
2022-01-24 21:37:40 +03:00
c . add_compare ( " --connect % (URI-KVM-X86)s --install fedora26 " , " osinfo-url " ) # getting URL from osinfo
2022-02-11 23:46:38 +03:00
c . add_invalid ( " --pxe --os-variant detect=yes,require=yes " , grep = " --os-variant/--osinfo OS name is required " ) # No os-variant detected, but require=yes
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --pxe --virt-type foobar " , grep = " Host does not support domain type " )
2022-02-11 23:46:38 +03:00
c . add_invalid ( " --pxe --os-variant farrrrrrrge " , grep = " Unknown OS name " )
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --pxe --boot menu=foobar " , grep = " menu must be ' yes ' or ' no ' " )
c . add_invalid ( " --cdrom %(EXISTIMG1)s --extra-args console=ttyS0 " , grep = " Kernel arguments are only supported with " ) # cdrom fail w/ extra-args
c . add_invalid ( " --hvm --boot kernel= %(TREEDIR)s /pxeboot/vmlinuz,initrd= %(TREEDIR)s /pxeboot/initrd.img,kernel_args= ' foo bar ' --initrd-inject virt-install " , grep = " Install method does not support initrd inject " )
2019-06-14 03:26:26 +03:00
c . add_invalid ( " --install winxp " , grep = " does not have a URL location " ) # no URL for winxp
2022-01-26 19:59:51 +03:00
c . add_invalid ( " --boot arch=i686 --install fedora26 " , grep = " does not have a URL location for the architecture ' i686 " ) # there's no URL for i686
2020-09-17 09:44:02 +03:00
c . add_invalid ( " -c foo --cdrom bar " , grep = " Cannot use -c " ) # check for ambiguous -c and --cdrom collision
2019-06-13 21:47:08 +03:00
c . add_invalid ( " -c qemu:///system " , grep = " looks like a libvirt URI " ) # error for the ambiguous -c vs --connect
2019-06-14 03:26:26 +03:00
c . add_invalid ( " --location / " , grep = " Error validating install location " ) # detect_distro failure
2020-09-15 02:05:58 +03:00
c . add_invalid ( " --os-variant id=foo://bar " , grep = " Unknown libosinfo ID " ) # bad full id
2020-01-27 18:44:09 +03:00
c . add_invalid ( " --location http://testsuitefail.com " , grep = " installable distribution " ) # will trigger a particular mock failure
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_invalid ( " --cdrom %(EXISTIMG2)s " , grep = " expected virt-install to detect " ) # hits the missing --osinfo error
c . add_invalid ( " --pxe " , grep = " linux2018, linux2016 " , nogrep = " expected virt-install to detect " ) # hits missing --osinfo error but doesn't trigger the bit about detectable media
2020-01-27 18:44:09 +03:00
2013-04-24 00:16:30 +04:00
2014-12-10 17:33:02 +03:00
c = vinst . add_category ( " single-disk-install " , " --nographics --noautoconsole --disk %(EXISTIMG1)s " )
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_valid ( " --osinfo generic --hvm --install no_install=yes " ) # import install equivalent
c . add_valid ( " --osinfo generic --hvm --import --prompt --force " ) # Working scenario w/ prompt shouldn't ask anything
2014-12-10 17:33:02 +03:00
c . add_valid ( " --paravirt --import " ) # PV Import install
2019-06-13 21:47:08 +03:00
c . add_valid ( " --paravirt --print-xml 1 " ) # print single XML, implied import install
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_valid ( " --osinfo generic --hvm --import --wait 0 " , grep = " Treating --wait 0 as --noautoconsole " ) # --wait 0 is the same as --noautoconsole
2020-09-15 01:12:41 +03:00
c . add_compare ( " -c %(EXISTIMG2)s --osinfo win2k3 --vcpus cores=4 --controller usb,model=none " , " w2k3-cdrom " ) # HVM windows install with disk
2022-01-24 21:37:40 +03:00
c . add_compare ( " --connect % (URI-KVM-X86)s --install fedora26 --os-variant fedora27 --disk size=20 " , " osinfo-url-with-disk " ) # filling in defaults, but with disk specified, and making sure we don't overwrite --os-variant
c . add_compare ( " --connect % (URI-KVM-X86)s --pxe --os-variant short-id=debianbuster --disk none " , " osinfo-multiple-short-id " , prerun_check = lambda : not OSDB . lookup_os ( " debianbuster " ) ) # test plumbing for multiple short ids
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_invalid ( " --osinfo generic --hvm --import --wait 2 " , grep = " exceeded specified time limit " ) # --wait positive number, but test suite hack
c . add_invalid ( " --osinfo generic --hvm --import --wait -1 " , grep = " exceeded specified time limit " ) # --wait -1, but test suite hack
c . add_invalid ( " --osinfo generic --hvm --import --wait " , grep = " exceeded specified time limit " ) # --wait aka --wait -1, but test suite hack
c . add_invalid ( " --connect test:///default --name foo --ram 64 --disk none --sdl --osinfo generic --hvm --import " , use_default_args = False , grep = " exceeded specified time limit " ) # --sdl doesn't have a console callback, triggers implicit --wait -1
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --paravirt --import --print-xml 2 " , grep = " does not have XML step 2 " ) # PV Import install, no second XML step
c . add_invalid ( " --paravirt --import --print-xml 7 " , grep = " Unknown XML step request ' 7 ' " ) # Invalid --print-xml arg
c . add_invalid ( " --location kernel=foo,initrd=bar " , grep = " location kernel/initrd may only be specified with a location URL/path " )
c . add_invalid ( " --location http://example.com,kernel=foo " , grep = " location kernel/initrd must be be specified as a pair " )
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_valid ( " --pxe --os-variant generic --os-type linux " , grep = " --os-type is deprecated " )
2022-01-17 22:40:03 +03:00
c . add_invalid ( " --os-variant solaris10 --unattended " , grep = " not support unattended " )
2014-12-10 17:33:02 +03:00
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
2014-12-10 17:33:02 +03:00
c = vinst . add_category ( " misc-install " , " --nographics --noautoconsole " )
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_compare ( " --connect %s --os-variant generic " % ( utils . URIs . test_suite ) , " noargs-fail " , use_default_args = False ) # No arguments
2019-06-11 19:15:35 +03:00
c . add_compare ( " --connect %s --os-variant fedora26 " % ( utils . URIs . test_suite ) , " osvariant-noargs-fail " , use_default_args = False ) # No arguments
c . add_compare ( " --connect %s --os-variant fedora26 --pxe --print-xml " % ( utils . URIs . test_suite ) , " osvariant-defaults-pxe " , use_default_args = False ) # No arguments
2019-07-16 15:45:16 +03:00
c . add_compare ( " --disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init " , " cloud-init-default " ) # default --cloud-init behavior is root-password-generate=yes,disable=yes
2019-11-21 01:37:36 +03:00
c . add_compare ( " --disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init root-password-generate=yes,disable=no " , " cloud-init-options " ) # --cloud-init root-password-generate
c . add_compare ( " --disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init root-password-file= % (ADMIN-PASSWORD-FILE)s,disable=no " , " cloud-init-options " ) # --cloud-init root-password-file
2019-11-22 01:38:46 +03:00
c . add_compare ( " --disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init ssh-key= %(XMLDIR)s /cloudinit/ssh-key.txt " , " cloud-init-options " ) # --cloud-init ssh-key
c . add_compare ( " --disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init user-data= %(XMLDIR)s /cloudinit/user-data.txt,meta-data= %(XMLDIR)s /cloudinit/meta-data.txt " , " cloud-init-options " ) # --cloud-init user-data=,meta-data=
2021-09-29 18:50:52 +03:00
c . add_compare ( " --disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init user-data= %(XMLDIR)s /cloudinit/user-data.txt,meta-data= %(XMLDIR)s /cloudinit/meta-data.txt,network-config= %(XMLDIR)s /cloudinit/network-config.txt " , " cloud-init-options " ) # --cloud-init user-data=,meta-data=,network-config=
2019-05-11 00:22:23 +03:00
c . add_valid ( " --panic help --disk=? --check=help " , grep = " path_in_use " ) # Make sure introspection doesn't blow up
2019-06-13 21:47:08 +03:00
c . add_valid ( " --connect test:///default --test-stub-command " , use_default_args = False ) # --test-stub-command
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_valid ( " --nodisks --pxe --osinfo generic " , grep = " VM performance may suffer " ) # os variant warning
c . add_valid ( " --nodisks --pxe " , env = { " VIRTINSTALL_OSINFO_DISABLE_REQUIRE " : " 1 " } , grep = " Skipping fatal error " )
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --hvm --nodisks --pxe foobar " , grep = " unrecognized arguments: foobar " ) # Positional arguments error
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_invalid ( " --nodisks --pxe --name test --osinfo require=no " , grep = " Guest name ' test ' is already " ) # Colliding name
c . add_compare ( " --osinfo generic --cdrom %(EXISTIMG1)s --disk size=1 --disk %(EXISTIMG2)s ,device=cdrom " , " cdrom-double " ) # ensure --disk device=cdrom is ordered after --cdrom, this is important for virtio-win installs with a driver ISO
c . add_valid ( " --connect %s --pxe --disk size=1 --osinfo generic " % utils . URIs . test_defaultpool_collision ) # testdriver already has a pool using the 'default' path, make sure we don't error
c . add_compare ( " --connect % (URI-KVM-X86)s --reinstall test-clone-simple --pxe --osinfo generic " , " reinstall-pxe " ) # compare --reinstall with --pxe
2022-01-24 21:37:40 +03:00
c . add_compare ( " --connect % (URI-KVM-X86)s --reinstall test-clone-simple --location http://example.com " , " reinstall-location " ) # compare --reinstall with --location
2020-02-03 15:23:05 +03:00
c . add_compare ( " --reinstall test-cdrom --cdrom % (ISO-WIN7)s --unattended " , " reinstall-cdrom " ) # compare --reinstall with --cdrom handling
c . add_invalid ( " --reinstall test --cdrom % (ISO-WIN7)s " , grep = " already active " ) # trying to reinstall an active VM should fail
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_invalid ( " --reinstall test --osinfo none " , grep = " install method must be specified " ) # missing install method
2022-02-11 19:50:13 +03:00
c . add_valid ( " --osinfo list " , grep = " osinfo-query os " ) # --osinfo list
2014-12-10 17:33:02 +03:00
2019-06-11 22:18:47 +03:00
####################
# Unattended tests #
####################
2022-01-24 21:37:40 +03:00
c = vinst . add_category ( " unattended-install " , " --connect % (URI-KVM-X86)s --nographics --noautoconsole --disk none " , prerun_check = no_osinfo_unattend_cb )
2020-01-24 19:34:48 +03:00
c . add_compare ( " --install fedora26 --unattended profile=desktop,admin-password-file= % (ADMIN-PASSWORD-FILE)s,user-password-file= % (USER-PASSWORD-FILE)s,product-key=1234,user-login=foobar,reg-login=regtest " , " osinfo-url-unattended " , prerun_check = lambda : not unattended . OSInstallScript . have_libosinfo_installation_url ( ) ) # unattended install for fedora, using initrd injection
2020-01-27 18:13:03 +03:00
c . add_compare ( " --location %(TREEDIR)s --unattended " , " osinfo-unattended-treeapis " , prerun_check = lambda : not LIBOSINFO_SUPPORT_LOCAL_TREE ) # unattended install using treeobj libosinfo APIs
2019-10-03 13:57:42 +03:00
c . add_compare ( " --cdrom % (ISO-WIN7)s --unattended profile=desktop,admin-password-file= % (ADMIN-PASSWORD-FILE)s " , " osinfo-win7-unattended " , prerun_check = no_osinfo_unattended_win_drivers_cb ) # unattended install for win7
2019-07-03 17:01:28 +03:00
c . add_compare ( " --os-variant fedora26 --unattended profile=jeos,admin-password-file= % (ADMIN-PASSWORD-FILE)s --location % (ISO-F26-NETINST)s " , " osinfo-netinst-unattended " ) # triggering the special netinst checking code
2019-06-11 22:18:47 +03:00
c . add_compare ( " --os-variant silverblue29 --location http://example.com " , " network-install-resources " ) # triggering network-install resources override
2020-09-09 01:41:41 +03:00
c . add_compare ( " --connect % (URI-TEST-REMOTE)s --os-variant win7 --cdrom %(EXISTIMG1)s --unattended " , " unattended-remote-cdrom " )
2019-06-14 03:26:26 +03:00
c . add_valid ( " --pxe --os-variant fedora26 --unattended " , grep = " Using unattended profile ' desktop ' " ) # filling in default 'desktop' profile
2022-02-11 22:22:48 +03:00
2020-09-09 01:41:41 +03:00
c . add_invalid ( " --os-variant fedora26 --unattended profile=jeos --location http://example.foo " , grep = " admin-password " ) # will trigger admin-password required error
2019-07-03 17:01:28 +03:00
c . add_invalid ( " --os-variant debian9 --unattended profile=desktop,admin-password-file= % (ADMIN-PASSWORD-FILE)s --location http://example.foo " , grep = " user-password " ) # will trigger user-password required error
c . add_invalid ( " --os-variant debian9 --unattended profile=FRIBBER,admin-password-file= % (ADMIN-PASSWORD-FILE)s --location http://example.foo " , grep = " Available profiles " ) # will trigger unknown profile error
c . add_invalid ( " --os-variant fedora29 --unattended profile=desktop,admin-password-file= % (ADMIN-PASSWORD-FILE)s --cdrom % (ISO-F29-LIVE)s " , grep = " media does not support " ) # live media doesn't support installscript
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --os-variant winxp --unattended profile=desktop --cdrom % (ISO-WIN7)s " , grep = " OS ' winxp ' does not support required injection method ' cdrom ' " )
2019-10-17 19:08:28 +03:00
c . add_invalid ( " --install fedora29 --unattended user-login=root " , grep = " as user-login " ) # will trigger an invalid user-login error
2019-06-11 22:18:47 +03:00
2014-12-10 17:33:02 +03:00
#############################
# Remote URI specific tests #
#############################
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c = vinst . add_category ( " remote " , " --connect % (URI-TEST-REMOTE)s --nographics --noautoconsole --osinfo generic " )
2014-12-10 17:33:02 +03:00
c . add_valid ( " --nodisks --pxe " ) # Simple pxe nodisks
2019-06-12 00:19:01 +03:00
c . add_valid ( " --cdrom %(EXISTIMG1)s --disk none --livecd --dry " ) # remote cdrom install
2020-01-30 03:06:12 +03:00
c . add_compare ( " --pxe "
" --pxe --disk /foo/bar/baz,size=.01 " # Creating any random path on the remote host
" --disk /dev/zde " , " remote-storage " ) # /dev file that we just pass through to the remote VM
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --nodisks --location /tmp " , grep = " Cannot access install tree on remote connection: /tmp " )
c . add_invalid ( " --file /foo/bar/baz --pxe " , grep = " Size must be specified for non existent volume ' baz ' " )
2014-12-10 17:33:02 +03:00
###########################
# QEMU/KVM specific tests #
###########################
2022-01-24 21:37:40 +03:00
c = vinst . add_category ( " kvm-generic " , " --connect % (URI-KVM-X86)s --autoconsole none " )
2019-06-12 02:06:08 +03:00
c . add_compare ( " --os-variant fedora-unknown --file %(EXISTIMG1)s --location %(TREEDIR)s --extra-args console=ttyS0 --cpu host --channel none --console none --sound none --redirdev none --boot cmdline= ' foo bar baz ' " , " kvm-fedoralatest-url " , prerun_check = has_old_osinfo ) # Fedora Directory tree URL install with extra-args
2019-06-13 21:47:08 +03:00
c . add_compare ( " --test-media-detection %(TREEDIR)s --arch x86_64 --hvm " , " test-url-detection " ) # --test-media-detection
2019-06-14 03:56:16 +03:00
c . add_compare ( " --os-variant http://fedoraproject.org/fedora/20 --disk %(EXISTIMG1)s ,device=floppy --disk %(NEWIMG1)s ,size=.01,format=vmdk --location %(TREEDIR)s --extra-args console=ttyS0 --quiet " , " quiet-url " , prerun_check = has_old_osinfo ) # Quiet URL install should make no noise
2019-06-13 23:02:58 +03:00
c . add_compare ( " --cdrom %(EXISTIMG2)s --file %(EXISTIMG1)s --os-variant win2k3 --sound --controller usb " , " kvm-win2k3-cdrom " ) # HVM windows install with disk
2020-09-15 02:05:58 +03:00
c . add_compare ( " --os-variant name=ubuntusaucy --nodisks --boot cdrom --virt-type qemu --cpu Penryn --input tablet --boot uefi --graphics vnc " , " qemu-plain " ) # plain qemu
2019-07-02 20:01:12 +03:00
c . add_compare ( " --os-variant fedora20 --nodisks --boot network --graphics default --arch i686 --rng none " , " qemu-32-on-64 " , prerun_check = has_old_osinfo ) # 32 on 64
2022-02-12 20:55:34 +03:00
c . add_compare ( " --osinfo linux2020 --pxe " , " linux2020 " , prerun_check = lambda : not OSDB . lookup_os ( " linux2020 " ) )
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_compare ( " --osinfo generic --disk none --location % (ISO-NO-OS)s,kernel=frib.img,initrd=/frob.img " , " location-manual-kernel " , prerun_check = missing_xorriso ) # --location with an unknown ISO but manually specified kernel paths
2021-04-07 18:45:00 +03:00
c . add_compare ( " --disk %(EXISTIMG1)s --location %(ISOTREE)s --nonetworks " , " location-iso " , prerun_check = missing_xorriso ) # Using --location iso mounting
2018-10-13 00:15:20 +03:00
c . add_compare ( " --disk %(EXISTIMG1)s --cdrom %(ISOLABEL)s " , " cdrom-centos-label " ) # Using --cdrom with centos CD label, should use virtio etc.
2019-11-25 22:19:09 +03:00
c . add_compare ( " --disk %(EXISTIMG1)s --install bootdev=network --os-variant rhel5.4 --cloud-init none " , " kvm-rhel5 " ) # RHEL5 defaults
c . add_compare ( " --disk %(EXISTIMG1)s --install kernel= % (ISO-WIN7)s,initrd= %(ISOLABEL)s ,kernel_args= ' foo bar ' --os-variant rhel6.4 --unattended none " , " kvm-rhel6 " ) # RHEL6 defaults. ISO paths are just to point at existing files
2019-06-14 04:27:31 +03:00
c . add_compare ( " --disk %(EXISTIMG1)s --location https://example.com --install kernel_args= ' test overwrite ' ,kernel_args_overwrite=yes --os-variant rhel7.0 " , " kvm-rhel7 " , precompare_check = no_osinfo_unattend_cb ) # RHEL7 defaults
2022-01-24 21:37:40 +03:00
c . add_compare ( " --connect " + utils . URIs . kvm_x86_nodomcaps + " --disk %(EXISTIMG1)s --pxe --os-variant rhel7.0 " , " kvm-cpu-default-fallback " , prerun_check = has_old_osinfo ) # No domcaps, so mode=host-model isn't safe, so we fallback to host-model-only
2022-02-16 21:54:41 +03:00
c . add_compare ( " --disk %(EXISTIMG1)s --pxe --os-variant centos7.0 --controller q35_pcie_root_ports=0 " , " kvm-centos7 " , prerun_check = has_old_osinfo ) # Centos 7 defaults
c . add_compare ( " --disk %(EXISTIMG1)s --cdrom %(EXISTIMG2)s --os-variant win10 --controller q35_pcie_root_ports=2 " , " kvm-win10 " , prerun_check = has_old_osinfo ) # win10 defaults
2019-05-16 20:18:12 +03:00
c . add_compare ( " --os-variant win7 --cdrom %(EXISTIMG2)s --boot loader_type=pflash,loader=CODE.fd,nvram_template=VARS.fd --disk %(EXISTIMG1)s " , " win7-uefi " , prerun_check = has_old_osinfo ) # no HYPER-V with UEFI
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_compare ( " --osinfo generic --arch i686 --boot uefi --install kernel=http://example.com/httpkernel,initrd=ftp://example.com/ftpinitrd --disk none " , " kvm-i686-uefi " ) # i686 uefi. piggy back it for --install testing too
c . add_compare ( " --osinfo generic --machine q35 --cdrom %(EXISTIMG2)s --disk %(EXISTIMG1)s " , " q35-defaults " ) # proper q35 disk defaults
2018-10-13 19:40:22 +03:00
c . add_compare ( " --disk size=1 --os-variant openbsd4.9 " , " openbsd-defaults " ) # triggers net fallback scenario
2022-01-24 21:37:40 +03:00
c . add_compare ( " --connect " + utils . URIs . kvm_x86_remote + " --import --disk %(EXISTIMG1)s --os-variant fedora21 --pm suspend_to_disk=yes " , " f21-kvm-remote " , prerun_check = has_old_osinfo )
c . add_compare ( " --connect % (URI-KVM-X86)s --os-variant fedora26 --graphics spice --controller usb,model=none " , " graphics-usb-disable " )
2022-02-16 19:21:18 +03:00
c . add_compare ( " --osinfo generic --boot uefi --disk size=1 " , " boot-uefi " )
c . add_compare ( " --osinfo generic --boot uefi --disk size=1 --tpm none --connect " + utils . URIs . kvm_x86_oldfirmware , " boot-uefi-oldcaps " )
2015-11-03 19:15:26 +03:00
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --disk none --location nfs:example.com/fake --nonetworks " , grep = " NFS URL installs are no longer supported " )
c . add_invalid ( " --disk none --boot network --machine foobar " , grep = " domain type None with machine ' foobar ' " )
c . add_invalid ( " --nodisks --boot network --arch mips --virt-type kvm " , grep = " any virtualization options for architecture ' mips ' " )
c . add_invalid ( " --nodisks --boot network --paravirt --arch mips " , grep = " ' xen ' for architecture ' mips ' " )
2014-12-10 17:33:02 +03:00
2019-06-11 18:41:57 +03:00
2022-02-16 20:02:32 +03:00
#########################
# qemu:///session tests #
#########################
c . add_compare ( " --connect " + utils . URIs . kvm_x86_session + " --disk size=8 --os-variant fedora21 --cdrom %(EXISTIMG1)s " , " kvm-session-defaults " , prerun_check = has_old_osinfo )
c . add_valid ( " --connect " + utils . URIs . kvm_x86_session + " --install fedora21 " , prerun_check = has_old_osinfo ) # hits some get_search_paths and media_upload code paths
2022-02-20 19:28:22 +03:00
2022-02-16 20:02:32 +03:00
###############
# ppc64 tests #
###############
c . add_compare ( " --machine pseries --boot arch=ppc64,network --disk %(EXISTIMG1)s --disk device=cdrom --os-variant fedora20 --network none " , " ppc64-pseries-f20 " )
2022-02-20 19:28:22 +03:00
c . add_compare ( " --arch ppc64 --boot network --disk %(EXISTIMG1)s --os-variant fedora20 --network none --graphics vnc " , " ppc64-machdefault-f20 " )
c . add_compare ( " --connect % (URI-KVM-PPC64LE)s --import --disk %(EXISTIMG1)s --os-variant fedora20 --panic default --tpm default --graphics none " , " ppc64le-kvm-import " )
2022-02-16 20:02:32 +03:00
###############
# s390x tests #
###############
2022-02-20 19:28:22 +03:00
c . add_compare ( " --arch s390x --machine s390-ccw-virtio --connect % (URI-KVM-S390X)s --boot kernel=/kernel.img,initrd=/initrd.img --disk %(EXISTIMG1)s --disk %(EXISTIMG3)s ,device=cdrom --os-variant fedora30 --panic default --graphics vnc " , " s390x-cdrom " , prerun_check = has_old_osinfo )
c . add_compare ( " --connect % (URI-KVM-S390X)s --arch s390x --nographics --import --disk %(EXISTIMG1)s --os-variant fedora30 " , " s390x-headless " )
###############
# riscv tests #
###############
c . add_compare ( " --connect % (URI-QEMU-RISCV64)s --arch riscv64 --os-variant fedora29 --import --disk %(EXISTIMG1)s --network default --graphics none " , " riscv64-headless " , precompare_check = " 5.3.0 " )
c . add_compare ( " --connect % (URI-QEMU-RISCV64)s --arch riscv64 --os-variant fedora29 --import --disk %(EXISTIMG1)s --network default --graphics vnc " , " riscv64-graphics " , precompare_check = " 5.3.0 " , )
2019-06-11 18:41:57 +03:00
2017-02-06 15:46:06 +03:00
2022-02-16 20:02:32 +03:00
################
# armv7l tests #
################
2014-12-10 17:33:02 +03:00
2022-02-20 19:28:22 +03:00
c . add_compare ( " --arch armv7l --osinfo generic --machine vexpress-a9 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,dtb=/f19-arm.dtb,extra_args= \" console=ttyAMA0 rw root=/dev/mmcblk0p3 \" --disk %(EXISTIMG1)s --nographics " , " arm-vexpress-plain " )
c . add_compare ( " --arch armv7l --machine virt --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args= \" console=ttyAMA0,1234 rw root=/dev/vda3 \" --disk %(EXISTIMG1)s --graphics vnc --os-variant fedora20 " , " arm-virt-f20 " )
2018-09-01 01:28:08 +03:00
c . add_compare ( " --arch armv7l --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args= \" console=ttyAMA0,1234 rw root=/dev/vda3 \" ,extra_args=foo --disk %(EXISTIMG1)s --os-variant fedora20 " , " arm-defaultmach-f20 " )
c . add_compare ( " --connect % (URI-KVM-ARMV7L)s --disk %(EXISTIMG1)s --import --os-variant fedora20 " , " arm-kvm-import " )
2022-02-16 20:02:32 +03:00
2022-02-20 19:28:22 +03:00
2022-02-16 20:02:32 +03:00
#################
# aarch64 tests #
#################
2022-02-20 19:28:22 +03:00
c . add_valid ( " --arch aarch64 --osinfo fedora19 --nodisks --pxe --connect " + utils . URIs . kvm_x86_nodomcaps , grep = " Libvirt version does not support UEFI " ) # attempt to default to aarch64 UEFI, but it fails, but should only print warnings
c . add_compare ( " --arch aarch64 --osinfo fedora19 --machine virt --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args= \" console=ttyAMA0,1234 rw root=/dev/vda3 \" --disk %(EXISTIMG1)s " , " aarch64-machvirt " )
c . add_compare ( " --arch aarch64 --osinfo fedora19 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args= \" console=ttyAMA0,1234 rw root=/dev/vda3 \" --disk %(EXISTIMG1)s " , " aarch64-machdefault " )
c . add_compare ( " --arch aarch64 --cdrom % (ISO-F26-NETINST)s --boot loader=CODE.fd,nvram.template=VARS.fd --disk %(EXISTIMG1)s --cpu none --events on_crash=preserve,on_reboot=destroy,on_poweroff=restart " , " aarch64-cdrom " ) # cdrom test, but also --cpu none override, --events override, and headless
c . add_compare ( " --connect % (URI-KVM-AARCH64)s --disk %(EXISTIMG1)s --import --os-variant fedora21 --panic default --graphics vnc " , " aarch64-kvm-import " ) # --import test, but also test --panic no-op, and --graphics
2018-09-01 01:28:08 +03:00
c . add_compare ( " --connect % (URI-KVM-AARCH64)s --disk size=1 --os-variant fedora22 --features gic_version=host --network network=default,address.type=pci --controller type=scsi,model=virtio-scsi,address.type=pci " , " aarch64-kvm-gic " )
2022-02-20 19:28:22 +03:00
c . add_compare ( " --connect % (URI-KVM-AARCH64)s --osinfo fedora30 --arch aarch64 --disk none --pxe --boot firmware=efi " , " aarch64-firmware-no-override " )
2018-09-01 01:28:08 +03:00
2022-02-16 20:02:32 +03:00
#################
# AMD sev tests #
#################
c = vinst . add_category ( " kvm-x86_64-launch-security " , " --disk none --noautoconsole --osinfo generic " )
c . add_compare ( " --boot uefi --machine q35 --launchSecurity type=sev,reducedPhysBits=1,policy=0x0001,cbitpos=47,dhCert=BASE64CERT,session=BASE64SESSION,kernelHashes=yes --connect " + utils . URIs . kvm_amd_sev , " x86_64-launch-security-sev-full " ) # Full cmdline
c . add_compare ( " --boot uefi --machine q35 --launchSecurity sev --connect " + utils . URIs . kvm_amd_sev , " x86_64-launch-security-sev " ) # Fill in platform data from domcaps
c . add_valid ( " --boot uefi --machine q35 --launchSecurity sev,reducedPhysBits=1,cbitpos=47 --connect " + utils . URIs . kvm_amd_sev ) # Default policy == 0x0003 will be used
c . add_valid ( " --boot firmware=efi --machine q35 --launchSecurity sev,reducedPhysBits=1,cbitpos=47 --connect " + utils . URIs . kvm_amd_sev ) # Default policy == 0x0003 will be used
c . add_invalid ( " --launchSecurity policy=0x0001 --connect " + utils . URIs . kvm_amd_sev , grep = " Missing mandatory attribute ' type ' " )
c . add_invalid ( " --boot uefi --launchSecurity sev --connect " + utils . URIs . kvm_amd_sev , grep = " SEV launch security requires a Q35 UEFI machine " )
c . add_invalid ( " --boot uefi --machine q35 --launchSecurity sev,policy=0x0001 --connect " + utils . URIs . kvm_x86 , grep = " SEV launch security is not supported " ) # Fail with no SEV capabilities
2019-03-20 18:52:32 +03:00
2018-09-01 01:28:08 +03:00
2014-12-10 17:33:02 +03:00
######################
# LXC specific tests #
######################
2020-01-14 21:07:38 +03:00
c = vinst . add_category ( " lxc " , " --name foolxc --noautoconsole --connect " + utils . URIs . lxc )
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --filesystem /,not/abs " , grep = " must be an absolute path " )
2014-12-10 17:33:02 +03:00
c . add_compare ( " " , " default " )
2019-02-03 23:38:48 +03:00
c . add_compare ( " --os-variant fedora27 " , " default-f27 " )
2020-01-14 21:07:38 +03:00
c . add_compare ( " --filesystem /source,/ --memory 128 " , " fs-default " )
2014-12-10 17:33:02 +03:00
c . add_compare ( " --init /usr/bin/httpd " , " manual-init " )
######################
# Xen specific tests #
######################
2018-06-12 19:26:13 +03:00
c = vinst . add_category ( " xen " , " --noautoconsole --connect " + utils . URIs . xen )
2015-09-22 18:26:13 +03:00
c . add_valid ( " --disk %(EXISTIMG1)s --location %(TREEDIR)s --paravirt --graphics none " ) # Xen PV install headless
2014-12-10 17:33:02 +03:00
c . add_compare ( " --disk %(EXISTIMG1)s --import " , " xen-default " ) # Xen default
2019-06-09 23:39:15 +03:00
c . add_compare ( " --disk %(EXISTIMG1)s --location %(TREEDIR)s --paravirt --controller xenbus,maxGrantFrames=64 --input default " , " xen-pv " , precompare_check = " 5.3.0 " ) # Xen PV
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_compare ( " --osinfo generic --disk /iscsi-pool/diskvol1 --cdrom %(EXISTIMG1)s --livecd --hvm " , " xen-hvm " ) # Xen HVM
c . add_compare ( " --osinfo generic --disk /iscsi-pool/diskvol1 --cdrom %(EXISTIMG1)s --install no_install=yes --hvm " , " xen-hvm " ) # Ensure --livecd and --install no_install are essentially identical
2014-12-10 17:33:02 +03:00
2013-04-24 00:16:30 +04:00
2017-02-21 17:28:00 +03:00
#####################
# VZ specific tests #
#####################
2018-06-12 19:26:13 +03:00
c = vinst . add_category ( " vz " , " --noautoconsole --connect " + utils . URIs . vz )
2017-04-27 20:11:13 +03:00
c . add_valid ( " --container " ) # validate the special define+start logic
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_valid ( " --osinfo generic --hvm --cdrom %(EXISTIMG1)s --disk none " ) # hit more install vz logic
c . add_valid ( " --osinfo generic --hvm --import --disk %(EXISTIMG1)s --noreboot " ) # hit more install vz logic
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --container --transient " , grep = " Domain type ' vz ' doesn ' t support transient installs. " )
2019-05-14 18:25:52 +03:00
c . add_compare ( """
- - container
- - filesystem type = template , source = centos - 7 - x86_64 , target = " / "
- - network network = " Bridged "
2017-02-21 17:28:00 +03:00
""" , " vz-ct-template " )
2021-02-11 18:41:10 +03:00
########################
# bhyve specific tests #
########################
c = vinst . add_category ( " bhyve " , " --name foobhyve --noautoconsole --connect " + utils . URIs . bhyve )
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_compare ( " --osinfo generic --boot uefi --disk none --ram 256 --pxe " , " bhyve-uefi " )
2021-02-15 21:36:40 +03:00
c . add_compare ( " --os-variant fedora27 " , " bhyve-default-f27 " )
2021-02-11 18:41:10 +03:00
2017-02-21 17:28:00 +03:00
2014-12-10 17:33:02 +03:00
#####################################
# Device option back compat testing #
#####################################
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c = vinst . add_category ( " device-back-compat " , " --nodisks --pxe --noautoconsole --paravirt " )
2014-12-10 17:33:02 +03:00
c . add_valid ( " --sdl " ) # SDL
c . add_valid ( " --vnc --keymap ja --vncport 5950 --vnclisten 1.2.3.4 " ) # VNC w/ lots of options
c . add_valid ( " --sound " ) # --sound with no option back compat
c . add_valid ( " --mac 22:22:33:44:55:AF " ) # Just a macaddr
c . add_valid ( " --bridge mybr0 --mac 22:22:33:44:55:AF " ) # Old bridge w/ mac
c . add_valid ( " --network bridge:mybr0,model=e1000 " ) # --network bridge:
c . add_valid ( " --network network:default --mac RANDOM " ) # VirtualNetwork with a random macaddr
c . add_valid ( " --vnc --keymap=local " ) # --keymap local
2017-09-04 19:40:34 +03:00
c . add_valid ( " --panic 0x505 " ) # ISA panic with iobase specified
2020-07-06 01:39:15 +03:00
c . add_valid ( " --mac 22:11:11:11:11:11 --check mac_in_use=off " ) # colliding mac, but check is skipped
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --mac 22:11:11:11:11:11 " , grep = " in use by another virtual machine " ) # Colliding macaddr will error
c . add_invalid ( " --graphics vnc --vnclisten 1.2.3.4 " , grep = " Cannot mix --graphics and old style graphical options " )
c . add_invalid ( " --network user --bridge foo0 " , grep = " Cannot use --bridge and --network at the same time " )
2014-12-10 17:33:02 +03:00
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c = vinst . add_category ( " storage-back-compat " , " --pxe --noautoconsole --osinfo generic " )
2014-12-10 17:33:02 +03:00
c . add_valid ( " --file %(EXISTIMG1)s --nonsparse --file-size 4 " ) # Existing file, other opts
c . add_valid ( " --file %(EXISTIMG1)s " ) # Existing file, no opts
2015-04-12 02:25:46 +03:00
c . add_valid ( " --file %(EXISTIMG1)s --file %(EXISTIMG1)s " ) # Multiple existing files
2014-12-10 17:33:02 +03:00
c . add_valid ( " --file %(NEWIMG1)s --file-size .00001 --nonsparse " ) # Nonexistent file
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c = vinst . add_category ( " console-tests " , " --nodisks --os-variant generic " )
2020-02-02 16:49:06 +03:00
c . add_valid ( " --pxe " , grep = " graphical console command: virt-viewer " ) # mock default graphics+virt-viewer usage
2019-07-02 21:07:16 +03:00
c . add_valid ( " --pxe --graphics spice,gl=on " , grep = " --attach " ) # using virt-viewer --attach option for gl
2020-09-18 22:16:26 +03:00
c . add_valid ( " --pxe --graphics listen=none " , grep = " --attach " ) # using virt-viewer --attach option for listen 'none'
2018-10-13 18:50:49 +03:00
c . add_valid ( " --pxe --destroy-on-exit " , grep = " Restarting guest. \n " ) # destroy-on-exit
c . add_valid ( " --pxe --transient --destroy-on-exit " , grep = " Domain creation completed. " ) # destroy-on-exit + transient
2020-02-02 16:49:06 +03:00
c . add_valid ( " --pxe --graphics vnc --noreboot " , grep = " graphical console command: virt-viewer " ) # mock virt-viewer waiting, with noreboot magic
2018-10-13 18:50:49 +03:00
c . add_valid ( " --nographics --cdrom %(EXISTIMG1)s " ) # console warning about cdrom + nographics
2019-06-17 07:07:29 +03:00
c . add_valid ( " --nographics --console none --location %(TREEDIR)s " , grep = " Directory tree installs typically " ) # warning about directory trees not working well
2020-02-02 16:49:06 +03:00
c . add_valid ( " --pxe --nographics --transient " , grep = " text console command: virsh " ) # --transient handling
c . add_valid ( " --pxe --nographics --autoconsole graphical " , grep = " graphical console command: virt-viewer " ) # force --autoconsole graphical
c . add_valid ( " --pxe --autoconsole text " , grep = " text console command: virsh " ) # force --autoconsole text
2020-09-11 15:57:08 +03:00
c . add_valid ( " --pxe " , grep = " User stopped the VM " , env = { " VIRTINST_TESTSUITE_HACK_DESTROY " : " 1 " } ) # fake the user destroying the VM, we should print a specific message and not reboot the VM
virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html
For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:
```
--os-variant/--osinfo OS name is required, but no value was
set or detected.
This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.
If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:
--osinfo detect=on,name=OSNAME
You can see a full list of possible OS name values with:
virt-install --osinfo list
If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016
If you just need to get the old behavior back, you can use:
--osinfo detect=on,require=off
Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```
The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.
Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.
This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-11 23:54:01 +03:00
c . add_valid ( " --connect % (URI-KVM-X86)s --install fedora28 --cloud-init " , grep = " Password for first root login " ) # make sure we print the root login password
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --pxe --autoconsole badval " , grep = " Unknown autoconsole type ' badval ' " )
2020-09-11 02:45:37 +03:00
c . add_invalid ( " --pxe --autoconsole text --wait -1 " , grep = " exceeded specified time limit " ) # hits a specific code path where we skip console waitpid
2014-12-10 17:33:02 +03:00
##################
# virt-xml tests #
##################
2013-04-24 00:16:30 +04:00
2020-09-09 00:39:38 +03:00
_VIRTXMLDIR = XMLDIR + " /virtxml/ "
2019-05-16 20:18:12 +03:00
vixml = App ( " virt-xml " )
2014-01-19 19:37:14 +04:00
c = vixml . add_category ( " misc " , " " )
c . add_valid ( " --help " ) # basic --help test
2014-02-05 21:32:53 +04:00
c . add_valid ( " --sound=? --tpm=? " ) # basic introspection test
2022-02-11 23:46:38 +03:00
c . add_valid ( " --os-variant list " , grep = " ubuntu10.10, ubuntumaverick " )
2019-06-16 23:00:17 +03:00
c . add_valid ( " test-state-shutoff --edit --update --boot menu=on " , grep = " The VM is not running " ) # --update with inactive VM, should work but warn
2019-06-17 00:01:32 +03:00
c . add_valid ( " test-state-shutoff --edit --boot menu=on " , grep = " XML did not change after domain define " ) # menu=on is discarded because <bootloader> is specified
2019-06-14 19:10:00 +03:00
c . add_valid ( " test-for-virtxml --edit --graphics password=foo --update --confirm " , input_text = " no \n no \n " ) # prompt exiting
c . add_valid ( " test-for-virtxml --edit --cpu host-passthrough --no-define --start --confirm " , input_text = " no " ) # transient prompt exiting
2019-06-16 22:13:54 +03:00
c . add_valid ( " test-for-virtxml --edit --metadata name=test-for-virtxml " , grep = " requested changes will have no effect " )
2022-01-25 21:43:58 +03:00
c . add_valid ( " --print-diff test-for-virtxml --remove-device --disk boot.order=5 " , grep = " boot order= \" 5 " )
2019-06-14 19:10:00 +03:00
c . add_invalid ( " test --edit 2 --events on_poweroff=destroy " , grep = " ' --edit 2 ' doesn ' t make sense with --events " )
2022-02-11 23:46:38 +03:00
c . add_invalid ( " test --os-variant fedora26 --edit --cpu host-passthrough " , grep = " --os-variant/--osinfo is not supported " )
c . add_invalid ( " test-for-virtxml --os-variant fedora26 --remove-device --disk 1 " , grep = " --os-variant/--osinfo is not supported " )
c . add_invalid ( " --build-xml --os-variant fedora26 --disk path=foo " , grep = " --os-variant/--osinfo is not supported " )
2019-06-16 23:00:17 +03:00
c . add_invalid ( " domain-idontexist --edit --cpu host-passthrough --start " , grep = " Could not find domain " )
2020-09-17 09:44:02 +03:00
c . add_invalid ( " test-state-shutoff --edit --update --boot menu=on --start " , grep = " Cannot use --update " )
2019-06-14 19:10:00 +03:00
c . add_invalid ( " test --edit --update --events on_poweroff=destroy " , grep = " Don ' t know how to --update for --events " )
2020-09-09 00:39:38 +03:00
c . add_invalid ( " --edit --cpu host-passthrough --confirm " , input_file = ( _VIRTXMLDIR + " virtxml-stdin-edit.xml " ) , grep = " Can ' t use --confirm with stdin " )
c . add_invalid ( " --edit --cpu host-passthrough --update " , input_file = ( _VIRTXMLDIR + " virtxml-stdin-edit.xml " ) , grep = " Can ' t use --update with stdin " )
2019-06-14 19:10:00 +03:00
c . add_invalid ( " --edit --cpu host-passthrough " , grep = " A domain must be specified " )
2021-02-10 18:27:35 +03:00
c . add_invalid ( " test-state-shutoff --cpu mode=idontexist --start --edit --no-define --confirm " , grep = " Failed starting domain ' test-state-shutoff ' " , input_text = " yes " )
2019-06-14 19:10:00 +03:00
c . add_invalid ( " test --cpu host-passthrough " , grep = " One of --edit, " ) # conflicting --edit options
c . add_invalid ( " test --edit --add-device --disk path=foo " , grep = " Conflicting options --edit, --add-device " )
c . add_invalid ( " test --edit 0 --disk path= " , grep = " Invalid --edit option ' 0 ' " )
2022-02-11 22:22:48 +03:00
c . add_invalid ( " test --edit --hostdev driver_name=vfio " , grep = ' No --hostdev objects found in the XML ' )
c . add_invalid ( " test --edit --cpu host-passthrough --boot hd,network " , grep = " Only one change operation may be specified " )
c . add_invalid ( " test --edit " , grep = " No change specified. " )
c . add_invalid ( " test --edit 2 --cpu host-passthrough " , grep = " ' --edit 2 ' requested but there ' s only 1 --cpu object in the XML " )
c . add_invalid ( " test-for-virtxml --edit 5 --tpm /dev/tpm " , grep = " ' --edit 5 ' requested but there ' s only 1 --tpm object in the XML " )
c . add_invalid ( " test-for-virtxml --add-device --host-device 0x04b3:0x4485 --update --confirm " , input_text = " yes " , grep = " not supported by the connection driver: virDomainAttachDevice " )
c . add_invalid ( " test-for-virtxml --remove-device --host-device 1 --update --confirm " , input_text = " foo \n yes \n " , grep = " not supported by the connection driver: virDomainDetachDevice " )
c . add_invalid ( " test-for-virtxml --edit --graphics password=foo,keymap= --update --confirm " , input_text = " yes " , grep = " not supported by the connection driver: virDomainUpdateDeviceFlags " )
c . add_invalid ( " --build-xml --memory 10,maxmemory=20 " , grep = " --build-xml not supported for --memory " )
2019-07-02 21:07:16 +03:00
c . add_invalid ( " test-state-shutoff --edit sparse=no --disk path=blah " , grep = " Don ' t know how to match device type ' disk ' property ' sparse ' " )
2020-09-10 20:52:07 +03:00
c . add_invalid ( " test --add-device --xml ./@foo=bar " , grep = " --xml can only be used with --edit " )
2014-02-06 04:09:26 +04:00
c . add_compare ( " test --print-xml --edit --vcpus 7 " , " print-xml " ) # test --print-xml
2020-09-09 00:39:38 +03:00
c . add_compare ( " --edit --cpu host-passthrough " , " stdin-edit " , input_file = ( _VIRTXMLDIR + " virtxml-stdin-edit.xml " ) ) # stdin test
2014-02-06 04:09:26 +04:00
c . add_compare ( " --build-xml --cpu pentium3,+x2apic " , " build-cpu " )
2019-05-15 22:52:16 +03:00
c . add_compare ( " --build-xml --tpm path=/dev/tpm " , " build-tpm " )
2019-07-25 13:15:57 +03:00
c . add_compare ( " --build-xml --blkiotune weight=100,device0.path=/dev/sdf,device.weight=200,device0.read_bytes_sec=10000,device0.write_bytes_sec=10000,device0.read_iops_sec=20000,device0.write_iops_sec=20000 " , " build-blkiotune " )
2019-07-02 21:07:16 +03:00
c . add_compare ( " --build-xml --idmap clearxml=no,uid.start=0,uid.target=1000,uid.count=10,gid.start=0,gid.target=1000,gid.count=10 " , " build-idmap " )
2022-01-24 21:37:40 +03:00
c . add_compare ( " --connect % (URI-KVM-X86)s --build-xml --disk %(EXISTIMG1)s " , " build-disk-plain " )
c . add_compare ( " --connect % (URI-KVM-X86)s test-many-devices --build-xml --disk %(EXISTIMG1)s " , " build-disk-domain " )
2021-04-07 00:06:15 +03:00
c . add_compare ( " --build-xml --sound hda,audio.id=2 " , " build-sound " )
2019-03-21 20:34:52 +03:00
c . add_compare ( " 4a64cc71-19c4-2fd0-2323-3050941ea3c3 --edit --boot network,cdrom " , " edit-bootorder " ) # basic bootorder test, also using UUID lookup
2019-06-14 19:10:00 +03:00
c . add_compare ( " --confirm 1 --edit --cpu host-passthrough " , " prompt-response " , input_text = " yes " ) # prompt response, also using domid lookup
2020-09-09 00:39:38 +03:00
c . add_compare ( " --edit --print-diff --qemu-commandline clearxml=yes " , " edit-clearxml-qemu-commandline " , input_file = ( _VIRTXMLDIR + " virtxml-qemu-commandline-clear.xml " ) )
2020-09-09 00:55:09 +03:00
c . add_compare ( " --print-diff --remove-device --serial 1 " , " remove-console-dup " , input_file = ( _VIRTXMLDIR + " virtxml-console-dup.xml " ) )
2022-01-25 18:19:40 +03:00
c . add_compare ( " --print-diff --define --connect % (URI-KVM-X86)s test-many-devices --edit --boot uefi " , " edit-boot-uefi " )
2022-01-24 22:06:06 +03:00
c . add_compare ( " --print-diff --define --connect % (URI-KVM-X86)s test-many-devices --edit --cpu host-copy " , " edit-cpu-host-copy " )
2022-01-24 21:37:40 +03:00
c . add_compare ( " --connect % (URI-KVM-X86)s test-many-devices --build-xml --disk source.pool=pool-disk,source.volume=sdfg1 " , " build-disk-pool-disk " )
2021-10-12 20:56:51 +03:00
c . add_compare ( " test --add-device --network default --update --confirm " , " update-succeed " , env = { " VIRTXML_TESTSUITE_UPDATE_IGNORE_FAIL " : " 1 " , " VIRTINST_TEST_SUITE_INCREMENT_MACADDR " : " 1 " } , input_text = " yes \n yes \n " ) # test hotplug success
2021-10-12 19:58:21 +03:00
c . add_compare ( " test --add-device --network default --update --confirm --no-define " , " update-nodefine-succeed " , env = { " VIRTXML_TESTSUITE_UPDATE_IGNORE_FAIL " : " 1 " } , input_text = " yes \n " ) # test hotplug success without define
2014-01-26 03:16:16 +04:00
2018-02-20 23:00:46 +03:00
c = vixml . add_category ( " simple edit diff " , " test-for-virtxml --edit --print-diff --define " )
2020-09-10 20:52:07 +03:00
c . add_compare ( """ --xml ./@foo=bar --xml xpath.delete=./currentMemory --xml ./new/element/test=1 """ , " edit-xpaths " )
2018-10-01 02:12:19 +03:00
c . add_compare ( """ --metadata name=foo-my-new-name,os_name=fedora13,uuid=12345678-12F4-1234-1234-123456789AFA,description= " hey this is my
2014-01-25 05:03:30 +04:00
new
2014-02-06 04:09:26 +04:00
very , very = new desc \\\' " ,title= " This is my,funky=new title " " " " , " edit-simple-metadata " )
2018-10-01 02:12:19 +03:00
c . add_compare ( """ --metadata os_full_id=http://fedoraproject.org/fedora/23 """ , " edit-metadata-full-os " )
2014-05-29 05:46:24 +04:00
c . add_compare ( " --events on_poweroff=destroy,on_reboot=restart,on_crash=preserve " , " edit-simple-events " )
2017-03-06 04:45:33 +03:00
c . add_compare ( " --qemu-commandline= ' -foo bar,baz= \" wib wob \" ' " , " edit-simple-qemu-commandline " )
2014-02-06 04:09:26 +04:00
c . add_compare ( " --memory 500,maxmemory=1000,hugepages=off " , " edit-simple-memory " )
2022-02-18 17:39:19 +03:00
c . add_compare ( " --memorybacking hugepages=on,access.mode=shared,source.type=file " , " edit-simple-memorybacking " )
c . add_compare ( " --vcpus 10,maxvcpus=20,cores=5,sockets=4,threads=1,placement=auto " , " edit-simple-vcpus " )
2014-02-06 04:09:26 +04:00
c . add_compare ( " --cpu model=pentium2,+x2apic,forbid=pbe " , " edit-simple-cpu " )
2019-06-09 11:48:08 +03:00
c . add_compare ( " --numatune memory.nodeset=1-5,7,memory.mode=strict,memory.placement=auto " , " edit-simple-numatune " )
2014-02-06 04:09:26 +04:00
c . add_compare ( " --blkiotune weight=500,device_path=/dev/sdf,device_weight=600 " , " edit-simple-blkiotune " )
2018-09-01 01:28:08 +03:00
c . add_compare ( " --idmap uid_start=0,uid_target=2000,uid_count=30,gid_start=0,gid_target=3000,gid_count=40 " , " edit-simple-idmap " )
2022-02-18 17:39:19 +03:00
c . add_compare ( " --boot loader=foo.bar,useserial=on,init=/bin/bash,nvram=/test/nvram.img,os_type=hvm,domain_type=test,loader.readonly=on,loader.secure=no,machine=,smbios_mode=emulate " , " edit-simple-boot " )
c . add_compare ( " --seclabel label=foo,bar,baz,UNKNOWN=val,relabel=on " , " edit-simple-security " )
2022-01-17 21:54:45 +03:00
c . add_compare ( " --features eoi=on,hyperv_relaxed=off,acpi= " , " edit-simple-features " , precompare_check = " 8.0.0 " )
2019-05-13 02:00:47 +03:00
c . add_compare ( " --clock offset=localtime,hpet_present=yes,kvmclock_present=no,kvmclock_tickpolicy=foo,rtc_tickpolicy=merge " , " edit-simple-clock " )
2019-05-15 22:51:54 +03:00
c . add_compare ( " --pm suspend_to_mem.enabled=yes,suspend_to_disk.enabled=no " , " edit-simple-pm " )
2019-05-15 23:26:23 +03:00
c . add_compare ( " --disk /dev/zero,perms=ro,source.startupPolicy=optional " , " edit-simple-disk " )
2014-02-06 04:09:26 +04:00
c . add_compare ( " --disk path= " , " edit-simple-disk-remove-path " )
c . add_compare ( " --network source=br0,type=bridge,model=virtio,mac= " , " edit-simple-network " )
2019-05-16 20:18:12 +03:00
c . add_compare ( " --graphics tlsport=5902,keymap=ja " , " edit-simple-graphics " )
c . add_compare ( " --graphics listen=none " , " edit-graphics-listen-none " )
2016-06-11 23:44:54 +03:00
c . add_compare ( " --controller index=15,model=lsilogic " , " edit-simple-controller " )
2015-04-05 03:01:03 +03:00
c . add_compare ( " --controller index=15,model=lsilogic " , " edit-simple-controller " )
2014-02-06 04:09:26 +04:00
c . add_compare ( " --smartcard type=spicevmc " , " edit-simple-smartcard " )
c . add_compare ( " --redirdev type=spicevmc,server=example.com:12345 " , " edit-simple-redirdev " )
2019-05-16 20:18:12 +03:00
c . add_compare ( " --tpm backend.device.path=,backend.type=emulator,backend.version=2.0 " , " edit-simple-tpm " )
2019-05-15 22:54:28 +03:00
c . add_compare ( " --vsock model=virtio,cid.address=,cid.auto=on " , " edit-simple-vsock " )
2019-05-16 00:21:26 +03:00
c . add_compare ( " --rng rate_bytes=3333,rate_period=4444,backend.source.connect_host=,backend.source.connect_service=,backend.source.host=,backend.source.service=,backend.source.bind_host=,backend.source.bind_service=,backend.source.mode=,backend.type=unix,backend.source.mode=connect,backend.source.path=/tmp/unix,backend.source.seclabel.model=dac,backend.source.seclabel.label=foo,backend.source.seclabel.relabel=yes " , " edit-simple-rng " )
2014-02-06 04:09:26 +04:00
c . add_compare ( " --watchdog action=reset " , " edit-simple-watchdog " )
c . add_compare ( " --memballoon model=none " , " edit-simple-memballoon " )
c . add_compare ( " --serial pty " , " edit-simple-serial " )
c . add_compare ( " --parallel unix,path=/some/other/log " , " edit-simple-parallel " )
c . add_compare ( " --channel null " , " edit-simple-channel " )
2015-06-09 00:22:58 +03:00
c . add_compare ( " --console name=foo.bar.baz " , " edit-simple-console " )
2014-02-06 04:09:26 +04:00
c . add_compare ( " --filesystem /1/2/3,/4/5/6,mode=mapped " , " edit-simple-filesystem " )
2019-05-16 20:18:12 +03:00
c . add_compare ( " --video cirrus " , " edit-simple-video " )
c . add_compare ( " --sound pcspk " , " edit-simple-soundhw " )
2019-05-15 23:03:26 +03:00
c . add_compare ( " --host-device 0x04b3:0x4485,driver_name=vfio,type=usb " , " edit-simple-host-device " )
2014-01-19 19:37:14 +04:00
2018-02-20 23:00:46 +03:00
c = vixml . add_category ( " edit selection " , " test-for-virtxml --print-diff --define " )
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --edit target=vvv --disk /dev/null " , grep = " No matching objects found for --edit target=vvv " )
c . add_invalid ( " --edit seclabel2.model=dac --disk /dev/null " , grep = " No matching objects found for --edit seclabel2.model=dac " )
2019-05-16 20:18:12 +03:00
c . add_compare ( " --edit 3 --sound pcspk " , " edit-pos-num " )
c . add_compare ( " --edit -1 --video qxl " , " edit-neg-num " )
2019-05-15 23:03:26 +03:00
c . add_compare ( " --edit all --host-device driver.name=vfio " , " edit-all " )
2019-05-16 20:18:12 +03:00
c . add_compare ( " --edit ich6 --sound pcspk " , " edit-select-sound-model " )
2014-02-06 04:09:26 +04:00
c . add_compare ( " --edit target=hda --disk /dev/null " , " edit-select-disk-target " )
c . add_compare ( " --edit /tmp/foobar2 --disk shareable=off,readonly=on " , " edit-select-disk-path " )
c . add_compare ( " --edit mac=00:11:7f:33:44:55 --network target=nic55 " , " edit-select-network-mac " )
2019-02-26 12:56:40 +03:00
c . add_compare ( " --edit target=hda --disk boot_order=1 " , " edit-select-disk-bootorder " )
2019-05-11 00:57:04 +03:00
c . add_compare ( " --edit path=/dev/null --disk path=,target=fdb,boot_order=12 " , " edit-disk-unset " ) # --disk matching, using empty value to unset path
2019-06-13 13:55:07 +03:00
c . add_compare ( " --edit --memballoon none " , " edit-disable-memballoon " )
2021-05-31 22:54:28 +03:00
c . add_compare ( " --edit address.devno=0x0002 --hostdev address.devno=0x0008 " , " edit-hostdev-mdev " )
2019-02-26 12:56:40 +03:00
2019-02-26 12:56:44 +03:00
c = vixml . add_category ( " edit and start selection " , " test-state-shutoff --print-diff --start " )
c . add_compare ( " --define --edit target=vda --disk boot_order=1 " , " start-select-disk-bootorder " )
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --define --no-define --edit target=vda --disk boot_order=1 " , grep = " argument --no-define: not allowed with argument --define " )
2019-02-26 12:56:44 +03:00
c . add_compare ( " --edit target=vda --disk boot_order=1 " , " start-select-disk-bootorder2 " )
c . add_compare ( " --no-define --edit target=vda --disk boot_order=1 " , " start-select-disk-bootorder2 " )
2019-02-26 12:56:40 +03:00
c = vixml . add_category ( " edit selection 2 " , " test-collide --print-diff --define " )
c . add_compare ( " --edit target=hda --disk boot_order=1 " , " edit-select-disk-bootorder2 " )
2014-01-19 19:37:14 +04:00
2018-02-20 23:00:46 +03:00
c = vixml . add_category ( " edit clear " , " test-for-virtxml --print-diff --define " )
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --edit --memory 200,clearxml=yes " , grep = " Don ' t know how to clearxml for --memory " )
2017-01-17 19:47:46 +03:00
c . add_compare ( " --edit --disk path=/foo/bar,size=2,target=fda,bus=fdc,device=floppy,clearxml=yes " , " edit-clear-disk " )
2014-02-06 04:09:26 +04:00
c . add_compare ( " --edit --cpu host-passthrough,clearxml=yes " , " edit-clear-cpu " )
c . add_compare ( " --edit --clock offset=utc,clearxml=yes " , " edit-clear-clock " )
2016-05-20 21:45:24 +03:00
c . add_compare ( " --edit --video clearxml=yes,model=virtio,accel3d=yes " , " edit-video-virtio " )
2019-05-16 20:18:12 +03:00
c . add_compare ( " --edit --graphics clearxml=yes,type=spice,gl=on,listen=none " , " edit-graphics-spice-gl " )
2014-01-26 00:44:14 +04:00
2018-02-20 23:00:46 +03:00
c = vixml . add_category ( " add/rm devices " , " test-for-virtxml --print-diff --define " )
2022-02-18 17:39:19 +03:00
c . add_compare ( " --add-device --seclabel model=dac " , " add-seclabel " )
2021-10-29 14:04:49 +03:00
c . add_compare ( " --add-device --host-device usb_device_483_2016_noserial " , " add-host-device " )
2014-02-06 04:09:26 +04:00
c . add_compare ( " --add-device --sound pcspk " , " add-sound " )
c . add_compare ( " --add-device --disk %(EXISTIMG1)s ,bus=virtio,target=vdf " , " add-disk-basic " )
c . add_compare ( " --add-device --disk %(EXISTIMG1)s " , " add-disk-notarget " ) # filling in acceptable target
c . add_compare ( " --add-device --disk %(NEWIMG1)s ,size=.01 " , " add-disk-create-storage " )
2019-01-22 18:28:38 +03:00
c . add_compare ( " --add-device --disk size=.01 " , " add-disk-default-storage " )
2019-05-16 20:18:12 +03:00
c . add_compare ( " --remove-device --sound ich6 " , " remove-sound-model " )
2015-04-22 02:37:01 +03:00
c . add_compare ( " --remove-device --disk 3 " , " remove-disk-index " )
2014-02-06 04:09:26 +04:00
c . add_compare ( " --remove-device --disk /dev/null " , " remove-disk-path " )
2019-05-16 20:18:12 +03:00
c . add_compare ( " --remove-device --video all " , " remove-video-all " )
c . add_compare ( " --remove-device --host-device 0x04b3:0x4485 " , " remove-hostdev-name " )
2019-06-13 13:55:07 +03:00
c . add_compare ( " --remove-device --memballoon all " , " remove-memballoon " )
2021-05-31 22:54:28 +03:00
c . add_compare ( " --add-device --hostdev mdev_8e37ee90_2b51_45e3_9b25_bf8283c03110 " , " add-hostdev-mdev " )
c . add_compare ( " --remove-device --hostdev mdev_b1ae8bf6_38b0_4c81_9d44_78ce3f520496 " , " remove-hostdev-mdev " )
2014-01-26 00:44:14 +04:00
2019-02-26 12:56:44 +03:00
c = vixml . add_category ( " add/rm devices and start " , " test-state-shutoff --print-diff --start " )
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --add-device --pm suspend_to_disk=yes " , grep = " Cannot use --add-device with --pm " ) # --add-device without a device
c . add_invalid ( " --remove-device --clock utc " , grep = " Cannot use --remove-device with --clock " ) # --remove-device without a dev
2019-02-26 12:56:44 +03:00
# one test in combination with --define
c . add_compare ( " --define --add-device --host-device usb_device_4b3_4485_noserial " , " add-host-device-start " )
# all other test cases without
c . add_compare ( " --add-device --disk %(EXISTIMG1)s ,bus=virtio,target=vdf " , " add-disk-basic-start " )
c . add_compare ( " --add-device --disk %(NEWIMG1)s ,size=.01 " , " add-disk-create-storage-start " )
c . add_compare ( " --remove-device --disk /dev/null " , " remove-disk-path-start " )
2021-05-31 22:54:28 +03:00
c . add_compare ( " --add-device --hostdev mdev_8e37ee90_2b51_45e3_9b25_bf8283c03110 " , " add-hostdev-mdev-start " )
2019-02-26 12:56:44 +03:00
2022-01-24 21:37:40 +03:00
c = vixml . add_category ( " add/rm devices OS KVM " , " --connect % (URI-KVM-X86)s test --print-diff --define " )
2019-01-08 20:24:50 +03:00
c . add_compare ( " --add-device --disk %(EXISTIMG1)s " , " kvm-add-disk-os-from-xml " ) # Guest OS (none) from XML
c . add_compare ( " --add-device --disk %(EXISTIMG1)s --os-variant fedora28 " , " kvm-add-disk-os-from-cmdline " ) # Guest OS (fedora) provided on command line
c . add_compare ( " --add-device --network default " , " kvm-add-network-os-from-xml " ) # Guest OS information taken from the guest XML
2019-06-14 03:56:16 +03:00
c . add_compare ( " --add-device --network default --os-variant http://fedoraproject.org/fedora/28 " , " kvm-add-network-os-from-cmdline " ) # Guest OS information provided on the command line
2014-01-19 19:37:14 +04:00
2013-04-24 00:16:30 +04:00
2014-12-10 17:33:02 +03:00
####################
# virt-clone tests #
####################
2013-04-24 00:16:30 +04:00
2020-09-09 00:48:40 +03:00
_CLONEXMLDIR = XMLDIR + " /virtclone "
2020-09-03 19:03:38 +03:00
_CLONE_UNMANAGED = " --original-xml %s /clone-disk.xml " % _CLONEXMLDIR
_CLONE_MANAGED = " --original-xml %s /clone-disk-managed.xml " % _CLONEXMLDIR
_CLONE_NOEXIST = " --original-xml %s /clone-disk-noexist.xml " % _CLONEXMLDIR
_CLONE_NVRAM = " --original-xml %s /clone-nvram-auto.xml " % _CLONEXMLDIR
_CLONE_NVRAM_NEWPOOL = " --original-xml %s /clone-nvram-newpool.xml " % _CLONEXMLDIR
_CLONE_NVRAM_MISSING = " --original-xml %s /clone-nvram-missing.xml " % _CLONEXMLDIR
_CLONE_EMPTY = " --original-xml %s /clone-empty.xml " % _CLONEXMLDIR
2020-11-11 00:10:35 +03:00
_CLONE_NET_RBD = " --original-xml %s /clone-net-rbd.xml " % _CLONEXMLDIR
_CLONE_NET_HTTP = " --original-xml %s /clone-net-http.xml " % _CLONEXMLDIR
2020-11-03 20:53:25 +03:00
2018-06-12 19:26:13 +03:00
2013-04-24 00:16:30 +04:00
vclon = App ( " virt-clone " )
2015-04-23 00:06:35 +03:00
c = vclon . add_category ( " remote " , " --connect % (URI-TEST-REMOTE)s " )
2020-09-03 22:43:16 +03:00
c . add_valid ( _CLONE_EMPTY + " --auto-clone " ) # Auto flag, no storage
2020-09-03 22:40:51 +03:00
c . add_valid ( _CLONE_MANAGED + " --auto-clone " ) # Auto flag w/ managed storage
2022-02-11 22:22:48 +03:00
c . add_invalid ( _CLONE_UNMANAGED + " --auto-clone " , grep = " does not exist " ) # Auto flag w/ local storage, which is invalid for remote connection
2013-08-17 17:44:11 +04:00
c = vclon . add_category ( " misc " , " " )
2022-01-24 21:37:40 +03:00
c . add_compare ( " --connect % (URI-KVM-X86)s -o test-clone --auto-clone " , " clone-auto1 " )
2020-09-03 22:43:16 +03:00
c . add_compare ( " --connect % (URI-TEST-FULL)s -o test-clone-simple --name newvm --auto-clone " , " clone-auto2 " )
2022-01-24 21:37:40 +03:00
c . add_compare ( " --connect % (URI-KVM-X86)s " + _CLONE_NVRAM + " --auto-clone " , " clone-nvram " ) # hits a particular nvram code path
c . add_compare ( " --connect % (URI-KVM-X86)s " + _CLONE_NVRAM + " --auto-clone --nvram /nvram/my-custom-path " , " clone-nvram-path " ) # hits a particular nvram code path
c . add_compare ( " --connect % (URI-KVM-X86)s " + _CLONE_NVRAM_NEWPOOL + " --auto-clone " , " nvram-newpool " ) # hits a particular nvram code path
c . add_compare ( " --connect % (URI-KVM-X86)s " + _CLONE_NVRAM_MISSING + " --auto-clone " , " nvram-missing " ) # hits a particular nvram code path
c . add_compare ( " --connect % (URI-KVM-X86)s " + _CLONE_NVRAM_MISSING + " --auto-clone --preserve " , " nvram-missing-preserve " ) # hits a particular nvram code path
c . add_compare ( " --connect % (URI-KVM-X86)s -o test-clone -n test-newclone --mac 12:34:56:1A:B2:C3 --mac 12:34:56:1A:B7:C3 --uuid 12345678-12F4-1234-1234-123456789AFA --file /dev/disk-pool/newclone1.img --file /dev/default-pool/newclone2.img --skip-copy=hdb --force-copy=sdb --file /dev/default-pool/newclone3.img " , " clone-manual " )
c . add_compare ( " --connect % (URI-KVM-X86)s -o test-clone -n test-newclone --mac 12:34:56:1A:B2:C3 --mac 12:34:56:1A:B7:C3 --uuid 12345678-12F4-1234-1234-123456789AFA --file /dev/disk-pool/newclone1.img --file /dev/default-pool/newclone2.img --skip-copy=hdb --force-copy=sdb --file /dev/default-pool/newclone3.img " , " clone-manual " )
2020-09-03 22:59:59 +03:00
c . add_compare ( _CLONE_EMPTY + " --auto-clone --print-xml " , " empty " ) # Auto flag, no storage
2022-01-24 21:37:40 +03:00
c . add_compare ( " --connect % (URI-KVM-X86)s -o test-clone-simple --auto -f /foo.img --print-xml " , " cross-pool " ) # cross pool cloning which fails with test driver but let's confirm the XML
2020-09-03 22:59:59 +03:00
c . add_compare ( _CLONE_MANAGED + " --auto-clone " , " auto-managed " ) # Auto flag w/ managed storage
c . add_compare ( _CLONE_UNMANAGED + " --auto-clone " , " auto-unmanaged " ) # Auto flag w/ local storage
2020-09-03 22:43:16 +03:00
c . add_valid ( " --connect % (URI-TEST-FULL)s -o test-clone --auto-clone --nonsparse " ) # Auto flag, actual VM, skip state check
2018-02-20 23:00:46 +03:00
c . add_valid ( " --connect % (URI-TEST-FULL)s -o test-clone-simple -n newvm --preserve-data --file %(EXISTIMG1)s " ) # Preserve data shouldn't complain about existing volume
2020-09-03 22:40:51 +03:00
c . add_valid ( " -n clonetest " + _CLONE_UNMANAGED + " --file %(EXISTIMG3)s --file %(EXISTIMG4)s --check path_exists=off " ) # Skip existing file check
c . add_valid ( " -n clonetest " + _CLONE_UNMANAGED + " --auto-clone --mac 22:11:11:11:11:11 --check all=off " ) # Colliding mac but we skip the check
c . add_invalid ( " -n clonetest " + _CLONE_UNMANAGED + " --auto-clone --mac 22:11:11:11:11:11 " , grep = " --check mac_in_use=off " ) # Colliding mac should fail
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --auto-clone " , grep = " An original machine name is required " ) # No clone VM specified
c . add_invalid ( _CLONE_EMPTY + " --file foo " , grep = " use ' --name NEW_VM_NAME ' " ) # Didn't specify new name
c . add_invalid ( _CLONE_EMPTY + " --auto-clone -n test " , grep = " Invalid name for new guest " ) # new name raises error, already in use
2020-09-03 19:03:38 +03:00
c . add_invalid ( " -o test --auto-clone " , grep = " shutoff " ) # VM is running
2022-02-11 22:22:48 +03:00
c . add_invalid ( " --connect % (URI-TEST-FULL)s -o test-clone-simple -n newvm --file %(EXISTIMG1)s " , grep = " Clone onto existing storage volume is not currently supported " ) # Should complain about overwriting existing file
2019-06-15 23:15:01 +03:00
c . add_invalid ( " --connect % (URI-TEST-REMOTE)s -o test-clone-simple --auto-clone --file /dev/default-pool/testvol9.img --check all=off " , grep = " Clone onto existing storage volume " ) # hit a specific error message
2020-09-03 22:59:59 +03:00
c . add_invalid ( " --connect % (URI-TEST-FULL)s -o test-clone-full --auto-clone " , grep = " not enough free space " ) # catch failure of clone path setting
2020-11-11 00:10:35 +03:00
c . add_invalid ( _CLONE_NET_HTTP + " --auto-clone " , grep = " ' http ' is not cloneable " )
c . add_invalid ( _CLONE_NET_RBD + " --connect % (URI-TEST-FULL)s --auto-clone " , grep = " Cloning rbd volumes is not yet supported " )
2013-08-17 17:44:11 +04:00
c = vclon . add_category ( " general " , " -n clonetest " )
2020-09-03 19:03:38 +03:00
c . add_valid ( _CLONE_EMPTY + " --auto-clone --replace " ) # --replace but it doesn't matter, should be safely ignored
2020-09-03 22:43:16 +03:00
c . add_valid ( _CLONE_EMPTY + " --file %(NEWCLONEIMG1)s --file %(NEWCLONEIMG2)s " ) # Nodisk, but with spurious files passed
c . add_valid ( _CLONE_EMPTY + " --file %(NEWCLONEIMG1)s --file %(NEWCLONEIMG2)s --prompt " ) # Working scenario w/ prompt shouldn't ask anything
2020-09-03 22:40:51 +03:00
c . add_valid ( _CLONE_UNMANAGED + " --file %(NEWCLONEIMG1)s --file %(NEWCLONEIMG2)s " ) # XML File with 2 disks
c . add_valid ( _CLONE_UNMANAGED + " --file %(NEWCLONEIMG1)s --skip-copy=hda " ) # XML w/ disks, skipping one disk target
2020-09-04 21:13:52 +03:00
c . add_compare ( _CLONE_UNMANAGED + " --file virt-install --file %(EXISTIMG1)s --preserve " , " unmanaged-preserve " ) # XML w/ disks, overwriting existing files with --preserve
2020-09-03 22:40:51 +03:00
c . add_valid ( _CLONE_UNMANAGED + " --file %(NEWCLONEIMG1)s --file %(NEWCLONEIMG2)s --file %(NEWCLONEIMG3)s --force-copy=hdc " ) # XML w/ disks, force copy a readonly target
c . add_valid ( _CLONE_UNMANAGED + " --file %(NEWCLONEIMG1)s --file %(NEWCLONEIMG2)s --force-copy=fda " ) # XML w/ disks, force copy a target with no media
c . add_valid ( _CLONE_MANAGED + " --file %(NEWIMG1)s " ) # XML w/ managed storage, specify managed path
2020-09-03 22:59:59 +03:00
c . add_valid ( _CLONE_MANAGED + " --file %(NEWIMG1)s --reflink " ) # XML w/ managed storage, specify managed path, use --reflink option
2020-09-03 19:03:38 +03:00
c . add_valid ( _CLONE_NOEXIST + " --file %(EXISTIMG1)s --preserve " ) # XML w/ managed storage, specify managed path across pools
c . add_compare ( " --connect % (URI-TEST-FULL)s -o test-clone -n test --auto-clone --replace " , " replace " ) # Overwriting existing running VM
c . add_valid ( _CLONE_MANAGED + " --auto-clone --force-copy fda " ) # force copy empty floppy drive
2022-02-11 22:22:48 +03:00
c . add_invalid ( " -o idontexist --auto-clone " , grep = " Domain ' idontexist ' was not found " ) # Non-existent vm name
c . add_invalid ( _CLONE_UNMANAGED , grep = " Either --auto-clone or --file " ) # XML file with several disks, but non specified
2020-09-03 19:03:38 +03:00
c . add_invalid ( _CLONE_UNMANAGED + " --file virt-install " , grep = " overwrite the existing path ' virt-install ' " ) # XML w/ disks, overwriting existing files with no --preserve
c . add_invalid ( _CLONE_MANAGED + " --file /tmp/clonevol " , grep = " matching name ' default-vol ' " ) # will attempt to clone across pools, which test driver doesn't support
c . add_invalid ( _CLONE_NOEXIST + " --auto-clone " , grep = " ' /i/really/dont/exist ' does not exist. " ) # XML w/ non-existent storage, WITHOUT --preserve
2013-04-24 00:16:30 +04:00
2018-12-18 22:20:57 +03:00
#################################
# argparse/autocomplete testing #
#################################
ARGCOMPLETE_CMDS = [ ]
def _add_argcomplete_cmd ( line , grep , nogrep = None ) :
env = {
" _ARGCOMPLETE " : " 1 " ,
" COMP_TYPE " : " 9 " ,
" COMP_POINT " : str ( len ( line ) ) ,
" COMP_LINE " : line ,
" _ARGCOMPLETE_COMP_WORDBREAKS " : " \" ' ><;|&(: " ,
}
2019-05-16 20:18:12 +03:00
2019-01-30 19:55:40 +03:00
def have_argcomplete ( ) :
if not argcomplete :
return " argcomplete not installed "
2019-05-16 20:18:12 +03:00
cmd = Command ( line , grep = grep , nogrep = nogrep , env = env , need_conn = False ,
prerun_check = have_argcomplete )
2018-12-18 22:20:57 +03:00
ARGCOMPLETE_CMDS . append ( cmd )
2019-05-16 20:18:12 +03:00
2018-12-18 22:20:57 +03:00
_add_argcomplete_cmd ( " virt-install --di " , " --disk " )
_add_argcomplete_cmd ( " virt-install --disk " , " driver.copy_on_read= " ) # will list all --disk subprops
_add_argcomplete_cmd ( " virt-install --disk a " , " address.base " )
_add_argcomplete_cmd ( " virt-install --disk address.u " , " address.unit " )
_add_argcomplete_cmd ( " virt-install --disk address.unit=foo,sg " , " sgio " )
2019-05-15 20:06:29 +03:00
_add_argcomplete_cmd ( " virt-install --disk path=fooo, " , " driver.cache " ) # will list all --disk subprops
_add_argcomplete_cmd ( " virt-install --disk source.seclab " , " source.seclabel.relabel " ) # completer should strip out regexes from results
2019-01-07 03:01:35 +03:00
_add_argcomplete_cmd ( " virt-install --check d " , " disk_size " )
2019-02-08 00:26:04 +03:00
_add_argcomplete_cmd ( " virt-install --location k " , " kernel " )
2019-06-12 23:56:37 +03:00
_add_argcomplete_cmd ( " virt-install --install i " , " initrd " )
2018-12-18 22:20:57 +03:00
_add_argcomplete_cmd ( " virt-install --test-stub " , None ,
nogrep = " --test-stub-command " )
2019-02-22 11:40:08 +03:00
_add_argcomplete_cmd ( " virt-install --unattended " , " profile= " ) # will list all --unattended subprops
2019-07-03 17:01:28 +03:00
_add_argcomplete_cmd ( " virt-install --unattended a " , " admin-password-file= " )
2018-12-18 22:20:57 +03:00
_add_argcomplete_cmd ( " virt-clone --preserve " , " --preserve-data " )
_add_argcomplete_cmd ( " virt-xml --sound mode " , " model " )
2013-04-24 00:16:30 +04:00
2019-07-02 19:55:53 +03:00
##############
# Misc tests #
##############
2020-09-18 23:26:28 +03:00
@utils.run_without_testsuite_hacks
def test_virtinstall_no_testsuite ( ) :
"""
Run virt - install stub command without the testsuite hacks , to test
some code paths like proper logging etc .
"""
cmd = Command (
" virt-install --connect %s "
" --test-stub-command --noautoconsole " %
( utils . URIs . test_suite ) )
cmd . run ( )
2019-07-02 19:55:53 +03:00
2013-03-18 01:06:52 +04:00
#########################
# Test runner functions #
#########################
2020-09-18 23:26:28 +03:00
_CURTEST = 0
2013-03-18 01:06:52 +04:00
2013-04-13 22:34:52 +04:00
2013-03-18 01:06:52 +04:00
def setup ( ) :
"""
Create initial test files / dirs
"""
2020-09-18 23:26:28 +03:00
global _CURTEST
_CURTEST + = 1
if _CURTEST != 1 :
return
2020-07-17 23:33:18 +03:00
for i in EXIST_FILES :
2018-10-13 00:15:20 +03:00
open ( i , " a " )
2013-03-18 01:06:52 +04:00
2020-07-17 23:33:18 +03:00
def cleanup ( clean_all = True ) :
2013-03-18 01:06:52 +04:00
"""
Cleanup temporary files used for testing
"""
2020-07-17 23:33:18 +03:00
clean_files = NEW_FILES
if clean_all :
clean_files + = EXIST_FILES
2013-03-18 01:06:52 +04:00
for i in clean_files :
2020-07-17 23:33:18 +03:00
if not os . path . exists ( i ) :
continue
if os . path . isdir ( i ) :
shutil . rmtree ( i )
else :
2019-07-17 23:54:59 +03:00
os . unlink ( i )
2013-03-18 01:06:52 +04:00
2013-04-13 22:34:52 +04:00
2020-09-18 23:26:28 +03:00
def _create_testfunc ( cmd , do_setup ) :
def cmdtemplate ( ) :
if do_setup :
2013-03-18 01:06:52 +04:00
setup ( )
2020-09-18 23:26:28 +03:00
cmd . run ( )
return cmdtemplate
def _make_testcases ( ) :
"""
Turn all the registered cli strings into test functions that
the test runner can scoop up
"""
cmdlist = [ ]
cmdlist + = vinst . cmds
cmdlist + = vixml . cmds
2022-02-11 22:22:48 +03:00
cmdlist + = vclon . cmds
2020-09-18 23:26:28 +03:00
cmdlist + = ARGCOMPLETE_CMDS
newidx = 0
for cmd in cmdlist :
newidx + = 1
# Generate numbered names like testCLI%d
name = " testCLI %.4d " % newidx
if cmd . compare_file :
base = os . path . splitext ( os . path . basename ( cmd . compare_file ) ) [ 0 ]
name + = base . replace ( " - " , " _ " )
else :
name + = os . path . basename ( cmd . app . replace ( " - " , " _ " ) )
do_setup = newidx == 1
testfunc = _create_testfunc ( cmd , do_setup )
globals ( ) [ name ] = testfunc
2013-03-18 01:06:52 +04:00
2020-09-18 23:26:28 +03:00
_make_testcases ( )
2013-03-18 01:06:52 +04:00
atexit . register ( cleanup )