installer: Rework some test suite urlfetcher hacking
Rather than alter where we save the files, behave like normal but only change what we store in the XML
This commit is contained in:
parent
af12b32928
commit
e9dcb4056d
|
@ -11,8 +11,8 @@
|
|||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="i686">hvm</type>
|
||||
<kernel>/tmp/virtinst-vmlinuz.</kernel>
|
||||
<initrd>/tmp/virtinst-initrd.img.</initrd>
|
||||
<kernel>/TESTSUITE_KERNEL_PATH</kernel>
|
||||
<initrd>/TESTSUITE_INITRD_PATH</initrd>
|
||||
<cmdline>method=ftp://example.com</cmdline>
|
||||
</os>
|
||||
<features>
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="i686">hvm</type>
|
||||
<kernel>/tmp/virtinst-vmlinuz.</kernel>
|
||||
<initrd>/tmp/virtinst-initrd.img.</initrd>
|
||||
<kernel>/TESTSUITE_KERNEL_PATH</kernel>
|
||||
<initrd>/TESTSUITE_INITRD_PATH</initrd>
|
||||
<cmdline>method=https://foobar.com</cmdline>
|
||||
</os>
|
||||
<features>
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="q35">hvm</type>
|
||||
<kernel>/tmp/virtinst-vmlinuz.</kernel>
|
||||
<initrd>/tmp/virtinst-initrd.img.</initrd>
|
||||
<kernel>/TESTSUITE_KERNEL_PATH</kernel>
|
||||
<initrd>/TESTSUITE_INITRD_PATH</initrd>
|
||||
<cmdline>console=ttyS0 method=tests/cli-test-xml/fakefedoratree</cmdline>
|
||||
</os>
|
||||
<features>
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<kernel>/tmp/virtinst-vmlinuz.</kernel>
|
||||
<initrd>/tmp/virtinst-initrd.img.</initrd>
|
||||
<kernel>/TESTSUITE_KERNEL_PATH</kernel>
|
||||
<initrd>/TESTSUITE_INITRD_PATH</initrd>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="pc">hvm</type>
|
||||
<kernel>/tmp/virtinst-frib.img.</kernel>
|
||||
<initrd>/tmp/virtinst-frob.img.</initrd>
|
||||
<kernel>/TESTSUITE_KERNEL_PATH</kernel>
|
||||
<initrd>/TESTSUITE_INITRD_PATH</initrd>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64" machine="xenpv">xen</type>
|
||||
<kernel>/tmp/virtinst-vmlinuz.</kernel>
|
||||
<initrd>/tmp/virtinst-initrd.img.</initrd>
|
||||
<kernel>/TESTSUITE_KERNEL_PATH</kernel>
|
||||
<initrd>/TESTSUITE_INITRD_PATH</initrd>
|
||||
<cmdline>method=tests/cli-test-xml/fakefedoratree</cmdline>
|
||||
</os>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
|
|
|
@ -57,6 +57,10 @@ class VirtinstConnection(object):
|
|||
ret = os.path.expanduser("~/.cache")
|
||||
return os.path.join(ret, "virt-manager")
|
||||
|
||||
@staticmethod
|
||||
def in_testsuite():
|
||||
return "VIRTINST_TEST_SUITE" in os.environ
|
||||
|
||||
def __init__(self, uri):
|
||||
_initial_uri = uri or ""
|
||||
|
||||
|
|
|
@ -181,9 +181,11 @@ class Installer(object):
|
|||
guest.on_reboot = "destroy"
|
||||
|
||||
if self._install_kernel:
|
||||
guest.os.kernel = self._install_kernel
|
||||
guest.os.kernel = (self.conn.in_testsuite() and
|
||||
"/TESTSUITE_KERNEL_PATH" or self._install_kernel)
|
||||
if self._install_initrd:
|
||||
guest.os.initrd = self._install_initrd
|
||||
guest.os.initrd = (self.conn.in_testsuite() and
|
||||
"/TESTSUITE_INITRD_PATH" or self._install_initrd)
|
||||
if self.extra_args:
|
||||
guest.os.kernel_args = " ".join(self.extra_args)
|
||||
|
||||
|
|
|
@ -74,9 +74,7 @@ class InstallerTreeMedia(object):
|
|||
"""
|
||||
Return the tmpdir that's accessible by VMs on system libvirt URIs
|
||||
"""
|
||||
if guest.conn.is_test():
|
||||
return "/tmp"
|
||||
elif guest.conn.is_xen():
|
||||
if guest.conn.is_xen():
|
||||
return "/var/lib/xen"
|
||||
return "/var/lib/libvirt/boot"
|
||||
|
||||
|
|
|
@ -211,13 +211,9 @@ class _URLFetcher(object):
|
|||
prefix = "virtinst-" + os.path.basename(filename) + "."
|
||||
|
||||
# pylint: disable=redefined-variable-type
|
||||
if "VIRTINST_TEST_SUITE" in os.environ:
|
||||
fn = os.path.join("/tmp", prefix)
|
||||
fileobj = open(fn, "wb")
|
||||
else:
|
||||
fileobj = tempfile.NamedTemporaryFile(
|
||||
dir=self.scratchdir, prefix=prefix, delete=False)
|
||||
fn = fileobj.name
|
||||
fileobj = tempfile.NamedTemporaryFile(
|
||||
dir=self.scratchdir, prefix=prefix, delete=False)
|
||||
fn = fileobj.name
|
||||
|
||||
self._grabURL(filename, fileobj)
|
||||
logging.debug("Saved file to %s", fn)
|
||||
|
|
Loading…
Reference in New Issue