---
lib/python/rats.py | 3 +++
lib/python/virtguest.py | 11 ++++++++++-
tests/rats_install/install.py | 23 +++++++++++++++++++----
3 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/lib/python/rats.py b/lib/python/rats.py
index ec72e43..3adda31 100644
--- a/lib/python/rats.py
+++ b/lib/python/rats.py
@@ -82,6 +82,9 @@ def parse_args():
parser.add_option("-x", "--extra-args",
action="store",
default="",
help="Additional arguments to pass to the kernel booted from the specified
TREEURL")
+ parser.add_option("-r", "--ram", action="store",
type="int", dest="memory",
+ default=768,
+ help="Memory to allocate for guest instance in megabytes (default:
%default)")
(opt, args) = parser.parse_args()
# Validate arguments
diff --git a/lib/python/virtguest.py b/lib/python/virtguest.py
index a916dea..e2200ee 100644
--- a/lib/python/virtguest.py
+++ b/lib/python/virtguest.py
@@ -159,7 +159,16 @@ class VirtGuest(object):
return data
self.dot(':/\n')
- def create(self, location, ram=512, disksize=8, extra_args='', serial=True):
+ def create(self, location, ram=768, disksize=8, extra_args='', serial=True):
+ '''
+ Create a virtual guest by calling `virt-install` with appropriate arguments
+
+ @param location: A directory containing install images
+ @param ram: Size of memory (in megabytes) to allocate for guest
+ @param disksize: Size of disk (in gigabytes) to allocate for guest
+ @param extra_args: Additional boot arguments for the guest
+ @raises RuntimeError: If the return value from `virt-install` is non-zero
+ '''
if serial:
extra_args += ' serial console=ttyS0'
virt_args = [
diff --git a/tests/rats_install/install.py b/tests/rats_install/install.py
index a6d7394..c596239 100755
--- a/tests/rats_install/install.py
+++ b/tests/rats_install/install.py
@@ -91,8 +91,23 @@ def get_initrd(treeinfo):
initrd = c.get('images-%s' % arch,'initrd')
return initrd
-def create_guest(imgdir, name="RATS", kickstart=None, minimon=None, url=None,
extra_args=""):
- '''Attempt to create a new virt guest using the given
data'''
+def create_guest(imgdir, name="RATS", memory=768, kickstart=None, minimon=None,
url=None, extra_args=""):
+ '''
+ Attempt to create a new virt guest using the given data
+
+ @param imgdir: A directory containing install images
+ @param name: Preferred guest name. If a guest with matching name already
+ exists, a new name will be selected by appending a unique number.
+ @param memory: Size of memory (in megabytes) to allocate for guest.
+ @param kickstart: Path to local kickstart file to use for install.
+ @param minimon: Path to local minimon script to monitor install progress.
+ Script will be placed inside initrd.img and initiated during %pre
+ kickstart.
+ @param url: URL of remote install source added to kickstart file.
+ @param extra_args: Additional boot arguments for the guest.
+ @return: Object of type autoqa.virtguest.VirtGuest
+ '''
+
if kickstart is None:
kickstart = os.path.join(config.bindir, "ks.cfg")
if minimon is None:
@@ -150,7 +165,7 @@ def create_guest(imgdir, name="RATS", kickstart=None,
minimon=None, url=None, ex
guest = VirtGuest(name="%s_%u" % (name, counter))
print " new guest name: %s" % guest.name
print "starting virt guest"
- guest.create(location=imgdir, extra_args=extra_args)
+ guest.create(location=imgdir, ram=memory, extra_args=extra_args)
guest.minimon = minimon_server # save MinimonServer object
guest.steplist = [] # A place to save the list of anaconda steps
return guest
@@ -329,7 +344,7 @@ if __name__ == '__main__':
if opt.image_url:
opt.extra_args = opt.extra_args + " stage2=%s/images/install.img" %
opt.image_url
- guest = create_guest(config.scratchdir, url=baseuri, extra_args=opt.extra_args)
+ guest = create_guest(config.scratchdir, url=baseuri, memory=opt.memory,
extra_args=opt.extra_args)
try:
print "\n== kernel boot test =="
--
1.6.6