From nobody Thu Mar 28 17:00:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15237824785981007.8485066284278; Sun, 15 Apr 2018 01:54:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 59906312C025; Sun, 15 Apr 2018 08:54:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 318F4611DF; Sun, 15 Apr 2018 08:54:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E0984181BA09; Sun, 15 Apr 2018 08:54:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3DJRWIL010324 for ; Fri, 13 Apr 2018 15:27:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9F3C95F7F0; Fri, 13 Apr 2018 19:27:32 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 964565F7F5 for ; Fri, 13 Apr 2018 19:27:28 +0000 (UTC) Received: from mail.physik.tu-berlin.de (mail.physik-pool.tu-berlin.de [130.149.50.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E4BD03135530 for ; Fri, 13 Apr 2018 19:27:24 +0000 (UTC) Received: from lagerkiste2.physik-pool.tu-berlin.de (lagerkiste2.physik-pool.tu-berlin.de [130.149.50.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.physik.tu-berlin.de (Postfix) with ESMTPSA id B00DC61F9E; Fri, 13 Apr 2018 19:27:23 +0000 (UTC) From: Fabian Freyer To: libvir-list@redhat.com Date: Fri, 13 Apr 2018 21:27:19 +0200 Message-Id: <20180413192719.15872-1-fabian.freyer@physik.tu-berlin.de> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 13 Apr 2018 19:27:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 13 Apr 2018 19:27:26 +0000 (UTC) for IP:'130.149.50.25' DOMAIN:'mail.physik-pool.tu-berlin.de' HELO:'mail.physik.tu-berlin.de' FROM:'fabian.freyer@physik.tu-berlin.de' RCPT:'' X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED) 130.149.50.25 mail.physik-pool.tu-berlin.de 130.149.50.25 mail.physik-pool.tu-berlin.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Fabian Freyer Subject: [libvirt] [PATCH] bhyve: add support for passing stdin to loader X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Sun, 15 Apr 2018 08:54:37 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This commit adds the node to the domain definition, with the following semantics: To pass standard input verbatim to the bootloader, set some stdin Multiline standard input can be set using a CDATA tag: Standard input can be read from a file as follows: Signed-off-by: Fabian Freyer --- docs/formatdomain.html.in | 19 ++++++ docs/schemas/domaincommon.rng | 10 ++++ src/bhyve/bhyve_driver.c | 10 ++++ src/bhyve/bhyve_parse_command.c | 70 ++++++++++++++++++= ++++ src/bhyve/bhyve_process.c | 22 +++++++ src/conf/domain_conf.c | 41 +++++++++++++ src/conf/domain_conf.h | 11 ++++ .../bhyveargv2xml-loader-stdin-file.args | 9 +++ .../bhyveargv2xml-loader-stdin-file.xml | 19 ++++++ .../bhyveargv2xml-loader-stdin-multiline.args | 13 ++++ .../bhyveargv2xml-loader-stdin-multiline.xml | 21 +++++++ .../bhyveargv2xml-loader-stdin-oneline.args | 11 ++++ .../bhyveargv2xml-loader-stdin-oneline.xml | 19 ++++++ tests/bhyveargv2xmltest.c | 3 + .../bhyvexml2argv-grub-stdin-file.args | 9 +++ .../bhyvexml2argv-grub-stdin-file.devmap | 1 + .../bhyvexml2argv-grub-stdin-file.ldargs | 4 ++ .../bhyvexml2argv-grub-stdin-file.xml | 25 ++++++++ .../bhyvexml2argv-grub-stdin-multiline.args | 9 +++ .../bhyvexml2argv-grub-stdin-multiline.devmap | 1 + .../bhyvexml2argv-grub-stdin-multiline.ldargs | 4 ++ .../bhyvexml2argv-grub-stdin-multiline.xml | 30 ++++++++++ .../bhyvexml2argv-grub-stdin-oneline.args | 9 +++ .../bhyvexml2argv-grub-stdin-oneline.devmap | 1 + .../bhyvexml2argv-grub-stdin-oneline.ldargs | 4 ++ .../bhyvexml2argv-grub-stdin-oneline.xml | 25 ++++++++ tests/bhyvexml2argvtest.c | 3 + .../bhyvexml2xmlout-grub-stdin-file.xml | 34 +++++++++++ .../bhyvexml2xmlout-grub-stdin-multiline.xml | 39 ++++++++++++ .../bhyvexml2xmlout-grub-stdin-oneline.xml | 34 +++++++++++ tests/bhyvexml2xmltest.c | 3 + 31 files changed, 513 insertions(+) create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-file= .args create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-file= .xml create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-mult= iline.args create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-mult= iline.xml create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-onel= ine.args create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-onel= ine.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.a= rgs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.d= evmap create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.l= dargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.x= ml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multil= ine.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multil= ine.devmap create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multil= ine.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multil= ine.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-onelin= e.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-onelin= e.devmap create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-onelin= e.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-onelin= e.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-stdin-fi= le.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-stdin-mu= ltiline.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-stdin-on= eline.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 5e99884dc..cea024235 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -245,6 +245,11 @@ ... <bootloader>/usr/bin/pygrub</bootloader> <bootloader_args>--append single</bootloader_args> +<bootloader_stdin><![CDATA[ +kernel (hd)/path/to/kernel +initrd (host)/path/to/initrd +boot +]]> ... =20
@@ -259,6 +264,20 @@ command line arguments to be passed to the bootloader. Since 0.2.3 +
bootloader_stdin
+
The optional bootloader_stdin element specifies + standard input to be passed to the bootloader. To pass multiple + lines of standard input to the bootloader, wrap the content in + a CDATA tag. Instead of specifying the standard input in the + domain XML, the path to a file to be read may be given using the + file attribute: +
+...
+<bootloader_stdin file=3D"/path/to/some/file"/>
+...
+
+ Since 4.3.0 (bhyve only) +
=20
=20 diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 4cab55f05..a44d88ef3 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1211,6 +1211,16 @@ + + + + + + + + + + diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 24c4a9c80..7ac3ad3f0 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -743,6 +743,16 @@ bhyveConnectDomainXMLToNative(virConnectPtr conn, goto cleanup; =20 virBufferAdd(&buf, virCommandToString(loadcmd), -1); + + if (def->os.bootloaderStdinSource =3D=3D VIR_DOMAIN_BOOTLOADER_STD= IN_FILE) + virBufferEscapeString(&buf, " < %s", def->os.bootloaderStdin); + else if (def->os.bootloaderStdinSource + =3D=3D VIR_DOMAIN_BOOTLOADER_STDIN_LITERAL) { + virBufferEscapeString(&buf, " << END_LOADER_STDIN\n" + "%s\nEND_LOADER_STDIN", + def->os.bootloaderStdin); + } + virBufferAddChar(&buf, '\n'); } =20 diff --git a/src/bhyve/bhyve_parse_command.c b/src/bhyve/bhyve_parse_comman= d.c index fcaaed275..ef51a75f1 100644 --- a/src/bhyve/bhyve_parse_command.c +++ b/src/bhyve/bhyve_parse_command.c @@ -124,6 +124,8 @@ static int bhyveCommandLineToArgv(const char *nativeConfig, int *loader_argc, char ***loader_argv, + char **loader_stdin_buffer, + char **loader_stdin_file, int *bhyve_argc, char ***bhyve_argv) { @@ -139,6 +141,10 @@ bhyveCommandLineToArgv(const char *nativeConfig, char **_bhyve_argv =3D NULL; char **_loader_argv =3D NULL; =20 + virBuffer heredoc =3D VIR_BUFFER_INITIALIZER; + int in_heredoc =3D 0; + char *heredoc_delim =3D NULL; + nativeConfig_unescaped =3D bhyveParseCommandLineUnescape(nativeConfig); if (nativeConfig_unescaped =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -178,6 +184,52 @@ bhyveCommandLineToArgv(const char *nativeConfig, char **arglist =3D NULL; size_t args_count =3D 0; size_t args_alloc =3D 0; + char *stdin_redir =3D NULL; + + /* are we in a heredoc? */ + if ( in_heredoc ) { + if (STRPREFIX(curr, heredoc_delim)) { + in_heredoc =3D 0; + *loader_stdin_buffer =3D virBufferContentAndReset(&heredoc= ); + continue; + } + + if (in_heredoc++ =3D=3D 1) + virBufferAsprintf(&heredoc, "%s", curr); + else + virBufferAsprintf(&heredoc, "\n%s", curr); + + continue; + } + + /* check if this line contains standard input redirection. */ + if ( (stdin_redir =3D strchr(curr, '<')) ) { + if (STREQLEN(stdin_redir, "<<", 2)) { + *stdin_redir =3D '\0'; + in_heredoc =3D 1; + heredoc_delim =3D stdin_redir + 2; + + /* skip non-alphanumeric chars */ + while (*heredoc_delim && !c_isalnum(*heredoc_delim)) + heredoc_delim ++; + + if (!*heredoc_delim) + goto error; + + virBufferFreeAndReset(&heredoc); + } else { + /* file redirection */ + *stdin_redir =3D '\0'; + stdin_redir ++; + + /* skip non-alphanumeric chars */ + while (*stdin_redir && !c_isalnum(*stdin_redir)) + stdin_redir ++; + + if (VIR_STRDUP(*loader_stdin_file, stdin_redir) !=3D 1) + goto error; + } + } =20 /* iterate over each line, splitting on sequences of ' '. This cod= e is * adapted from qemu/qemu_parse_command.c. */ @@ -254,12 +306,16 @@ bhyveCommandLineToArgv(const char *nativeConfig, if (!(*bhyve_argv =3D _bhyve_argv)) goto error; =20 + if (in_heredoc) + goto error; + virStringListFree(lines); return 0; =20 error: VIR_FREE(_loader_argv); VIR_FREE(_bhyve_argv); + virBufferFreeAndReset(&heredoc); virStringListFree(lines); return -1; } @@ -869,6 +925,8 @@ bhyveParseCommandLineString(const char* nativeConfig, char **bhyve_argv =3D NULL; int loader_argc =3D 0; char **loader_argv =3D NULL; + char *loader_stdin_file =3D NULL; + char *loader_stdin_buffer =3D NULL; =20 if (!(def =3D virDomainDefNew())) goto cleanup; @@ -887,12 +945,21 @@ bhyveParseCommandLineString(const char* nativeConfig, =20 if (bhyveCommandLineToArgv(nativeConfig, &loader_argc, &loader_argv, + &loader_stdin_buffer, &loader_stdin_file, &bhyve_argc, &bhyve_argv)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to convert the command string to argv-lis= ts")); goto error; } =20 + if (loader_stdin_file && !loader_stdin_buffer) { + def->os.bootloaderStdinSource =3D VIR_DOMAIN_BOOTLOADER_STDIN_FILE; + def->os.bootloaderStdin =3D loader_stdin_file; + } else if (loader_stdin_buffer && !loader_stdin_file) { + def->os.bootloaderStdinSource =3D VIR_DOMAIN_BOOTLOADER_STDIN_LITE= RAL, + def->os.bootloaderStdin =3D loader_stdin_buffer; + } + if (bhyveParseBhyveCommandLine(def, xmlopt, caps, bhyve_argc, bhyve_ar= gv)) goto error; if (loader_argv && STREQ(loader_argv[0], "/usr/sbin/bhyveload")) { @@ -906,9 +973,12 @@ bhyveParseCommandLineString(const char* nativeConfig, cleanup: virStringListFree(loader_argv); virStringListFree(bhyve_argv); + return def; error: virDomainDefFree(def); + VIR_FREE(loader_stdin_buffer); + VIR_FREE(loader_stdin_file); def =3D NULL; goto cleanup; } diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 9276d7d36..1a6f783d7 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -113,6 +113,7 @@ virBhyveProcessStart(virConnectPtr conn, bhyveDomainObjPrivatePtr priv =3D vm->privateData; int ret =3D -1, rc; virCapsPtr caps =3D NULL; + int stdinfd =3D -1; =20 if (virAsprintf(&logfile, "%s/%s.log", BHYVE_LOG_DIR, vm->def->name) < 0) @@ -173,6 +174,26 @@ virBhyveProcessStart(virConnectPtr conn, if (!(load_cmd =3D virBhyveProcessBuildLoadCmd(conn, vm->def, devm= ap_file, &devicemap))) goto cleanup; + + switch (vm->def->os.bootloaderStdinSource) { + case VIR_DOMAIN_BOOTLOADER_STDIN_NONE: + break; + case VIR_DOMAIN_BOOTLOADER_STDIN_FILE: + if ((stdinfd =3D open(vm->def->os.bootloaderStdin, O_RDONLY)) = < 0) { + virReportSystemError(errno, _("Failed to open '%s'"), + vm->def->os.bootloaderStdin); + goto cleanup; + } + virCommandSetInputFD(load_cmd, stdinfd); + break; + case VIR_DOMAIN_BOOTLOADER_STDIN_LITERAL: + virCommandSetInputBuffer(load_cmd, vm->def->os.bootloaderStdin= ); + break; + /* coverity[dead_error_begin] */ + case VIR_DOMAIN_BOOTLOADER_STDIN_LAST: + break; + } + virCommandSetOutputFD(load_cmd, &logfd); virCommandSetErrorFD(load_cmd, &logfd); =20 @@ -252,6 +273,7 @@ virBhyveProcessStart(virConnectPtr conn, virCommandFree(load_cmd); virCommandFree(cmd); VIR_FREE(logfile); + VIR_FORCE_CLOSE(stdinfd); VIR_FORCE_CLOSE(logfd); return ret; } diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d23182f18..d99ecf9f7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3037,6 +3037,8 @@ void virDomainDefFree(virDomainDefPtr def) VIR_FREE(def->os.bootloader); VIR_FREE(def->os.bootloaderArgs); =20 + VIR_FREE(def->os.bootloaderStdin); + virDomainClockDefClear(&def->clock); =20 VIR_FREE(def->name); @@ -18700,6 +18702,16 @@ virDomainDefParseXML(xmlDocPtr xml, def->os.bootloader =3D virXPathString("string(./bootloader)", ctxt); def->os.bootloaderArgs =3D virXPathString("string(./bootloader_args)",= ctxt); =20 + if ((def->os.bootloaderStdin =3D virXPathString("string(./bootloader_s= tdin/" + "@file)", ctxt))) + def->os.bootloaderStdinSource =3D VIR_DOMAIN_BOOTLOADER_STDIN_FILE; + else if ((def->os.bootloaderStdin =3D virXPathString("string(" + "./bootloader_stdin)= ", + ctxt))) + def->os.bootloaderStdinSource =3D VIR_DOMAIN_BOOTLOADER_STDIN_LITE= RAL; + else + def->os.bootloaderStdinSource =3D VIR_DOMAIN_BOOTLOADER_STDIN_NONE; + tmp =3D virXPathString("string(./os/type[1])", ctxt); if (!tmp) { if (def->os.bootloader) { @@ -26717,6 +26729,35 @@ virDomainDefFormatInternal(virDomainDefPtr def, virBufferEscapeString(buf, "%s\n", def->os.bootloaderArgs); + + switch (def->os.bootloaderStdinSource) { + case VIR_DOMAIN_BOOTLOADER_STDIN_NONE: + break; + case VIR_DOMAIN_BOOTLOADER_STDIN_FILE: + virBufferEscapeString(buf, "\= n", + def->os.bootloaderStdin); + break; + case VIR_DOMAIN_BOOTLOADER_STDIN_LITERAL: + if (strchr(def->os.bootloaderStdin, '\n') + || strchr(def->os.bootloaderStdin, '<') + || strchr(def->os.bootloaderStdin, '>') + || strchr(def->os.bootloaderStdin, '&')) + { + virBufferEscapeString(buf, + "" + "\n", + def->os.bootloaderStdin); + } else { + virBufferEscapeString(buf, + "%s" + "\n", + def->os.bootloaderStdin); + } + break; + /* coverity[dead_error_begin] */ + case VIR_DOMAIN_BOOTLOADER_STDIN_LAST: + break; + } } =20 virBufferAddLit(buf, "\n"); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index bbaa24137..41af6cc8a 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1897,6 +1897,15 @@ struct _virDomainOSEnv { char *value; }; =20 +/* Bootloader standard input source */ +typedef enum { + VIR_DOMAIN_BOOTLOADER_STDIN_NONE =3D 0, + VIR_DOMAIN_BOOTLOADER_STDIN_FILE, + VIR_DOMAIN_BOOTLOADER_STDIN_LITERAL, + + VIR_DOMAIN_BOOTLOADER_STDIN_LAST +} virDomainBootloaderStdinSource; + typedef struct _virDomainOSDef virDomainOSDef; typedef virDomainOSDef *virDomainOSDefPtr; struct _virDomainOSDef { @@ -1923,6 +1932,8 @@ struct _virDomainOSDef { virDomainLoaderDefPtr loader; char *bootloader; char *bootloaderArgs; + virDomainBootloaderStdinSource bootloaderStdinSource; + char *bootloaderStdin; int smbios_mode; =20 virDomainBIOSDef bios; diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-file.args b= /tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-file.args new file mode 100644 index 000000000..ca51f2f04 --- /dev/null +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-file.args @@ -0,0 +1,9 @@ +/usr/bin/custom-loader \ +-s ome \ +--args < path/to/some/file +/usr/sbin/bhyve \ +-c 1 \ +-m 214 \ +-H \ +-P \ +-s 0:0,hostbridge bhyve diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-file.xml b/= tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-file.xml new file mode 100644 index 000000000..a56a4c451 --- /dev/null +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-file.xml @@ -0,0 +1,19 @@ + + bhyve + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + /usr/bin/custom-loader + -s ome --args + + + hvm + + + destroy + destroy + destroy + + + diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-multiline.a= rgs b/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-multiline.args new file mode 100644 index 000000000..050ddf442 --- /dev/null +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-multiline.args @@ -0,0 +1,13 @@ +/usr/bin/custom-loader \ +-s ome \ +--args << END_OF_THIS_HEREDOC +some +standard input +here +END_OF_THIS_HEREDOC +/usr/sbin/bhyve \ +-c 1 \ +-m 214 \ +-H \ +-P \ +-s 0:0,hostbridge bhyve diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-multiline.x= ml b/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-multiline.xml new file mode 100644 index 000000000..496b5ea87 --- /dev/null +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-multiline.xml @@ -0,0 +1,21 @@ + + bhyve + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + /usr/bin/custom-loader + -s ome --args + + + hvm + + + destroy + destroy + destroy + + + diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-oneline.arg= s b/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-oneline.args new file mode 100644 index 000000000..f8bcdcddd --- /dev/null +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-oneline.args @@ -0,0 +1,11 @@ +/usr/bin/custom-loader \ +-s ome \ +--args << END_OF_THIS_HEREDOC +some standard input here +END_OF_THIS_HEREDOC +/usr/sbin/bhyve \ +-c 1 \ +-m 214 \ +-H \ +-P \ +-s 0:0,hostbridge bhyve diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-oneline.xml= b/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-oneline.xml new file mode 100644 index 000000000..17c9da664 --- /dev/null +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-loader-stdin-oneline.xml @@ -0,0 +1,19 @@ + + bhyve + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + /usr/bin/custom-loader + -s ome --args + some standard input here + + hvm + + + destroy + destroy + destroy + + + diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c index e5d78530c..fef01d7da 100644 --- a/tests/bhyveargv2xmltest.c +++ b/tests/bhyveargv2xmltest.c @@ -187,6 +187,9 @@ mymain(void) DO_TEST("memsize-human"); DO_TEST_FAIL("memsize-fail"); DO_TEST("custom-loader"); + DO_TEST("loader-stdin-file"); + DO_TEST("loader-stdin-oneline"); + DO_TEST("loader-stdin-multiline"); DO_TEST("bhyveload-custom"); DO_TEST("bhyveload-vda"); DO_TEST_FAIL("bhyveload-name-mismatch"); diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.args b/t= ests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.args new file mode 100644 index 000000000..3ba5c1160 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.args @@ -0,0 +1,9 @@ +/usr/sbin/bhyve \ +-c 1 \ +-m 214 \ +-u \ +-H \ +-P \ +-s 0:0,hostbridge \ +-s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 3:0,virtio-net,faketapdev,mac=3D52:54:00:ee:f5:79 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.devmap b= /tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.devmap new file mode 100644 index 000000000..b312bfdaf --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.devmap @@ -0,0 +1 @@ +(hd0) /tmp/freebsd.img \ No newline at end of file diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.ldargs b= /tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.ldargs new file mode 100644 index 000000000..7d9a5155a --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.ldargs @@ -0,0 +1,4 @@ +/usr/local/sbin/grub-bhyve \ +--root hd0,msdos1 \ +--device-map '' \ +--memory 214 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.xml b/te= sts/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.xml new file mode 100644 index 000000000..f804da0db --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-file.xml @@ -0,0 +1,25 @@ + + bhyve + df3be7e7-a104-11e3-aeb0-50e5492bd3dc + 219136 + 1 + /usr/local/sbin/grub-bhyve + + + hvm + + + + + + +
+ + + + + +
+ + + diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multiline.arg= s b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multiline.args new file mode 100644 index 000000000..3ba5c1160 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multiline.args @@ -0,0 +1,9 @@ +/usr/sbin/bhyve \ +-c 1 \ +-m 214 \ +-u \ +-H \ +-P \ +-s 0:0,hostbridge \ +-s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 3:0,virtio-net,faketapdev,mac=3D52:54:00:ee:f5:79 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multiline.dev= map b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multiline.devmap new file mode 100644 index 000000000..b312bfdaf --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multiline.devmap @@ -0,0 +1 @@ +(hd0) /tmp/freebsd.img \ No newline at end of file diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multiline.lda= rgs b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multiline.ldargs new file mode 100644 index 000000000..7d9a5155a --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multiline.ldargs @@ -0,0 +1,4 @@ +/usr/local/sbin/grub-bhyve \ +--root hd0,msdos1 \ +--device-map '' \ +--memory 214 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multiline.xml= b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multiline.xml new file mode 100644 index 000000000..456ab0443 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-multiline.xml @@ -0,0 +1,30 @@ + + bhyve + df3be7e7-a104-11e3-aeb0-50e5492bd3dc + 219136 + 1 + /usr/local/sbin/grub-bhyve + + + hvm + + + + + + +
+ + + + + +
+ + + diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-oneline.args = b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-oneline.args new file mode 100644 index 000000000..3ba5c1160 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-oneline.args @@ -0,0 +1,9 @@ +/usr/sbin/bhyve \ +-c 1 \ +-m 214 \ +-u \ +-H \ +-P \ +-s 0:0,hostbridge \ +-s 2:0,ahci,hd:/tmp/freebsd.img \ +-s 3:0,virtio-net,faketapdev,mac=3D52:54:00:ee:f5:79 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-oneline.devma= p b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-oneline.devmap new file mode 100644 index 000000000..b312bfdaf --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-oneline.devmap @@ -0,0 +1 @@ +(hd0) /tmp/freebsd.img \ No newline at end of file diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-oneline.ldarg= s b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-oneline.ldargs new file mode 100644 index 000000000..7d9a5155a --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-oneline.ldargs @@ -0,0 +1,4 @@ +/usr/local/sbin/grub-bhyve \ +--root hd0,msdos1 \ +--device-map '' \ +--memory 214 bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-oneline.xml b= /tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-oneline.xml new file mode 100644 index 000000000..03b6987fd --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-grub-stdin-oneline.xml @@ -0,0 +1,25 @@ + + bhyve + df3be7e7-a104-11e3-aeb0-50e5492bd3dc + 219136 + 1 + /usr/local/sbin/grub-bhyve + some input commands + + hvm + + + + + + +
+ + + + + +
+ + + diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index 6f3b0c2eb..e4cb0592e 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -188,6 +188,9 @@ mymain(void) DO_TEST("grub-defaults"); DO_TEST("grub-bootorder"); DO_TEST("grub-bootorder2"); + DO_TEST("grub-stdin-file"); + DO_TEST("grub-stdin-oneline"); + DO_TEST("grub-stdin-multiline"); DO_TEST("bhyveload-bootorder"); DO_TEST("bhyveload-bootorder1"); DO_TEST_FAILURE("bhyveload-bootorder2"); diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-stdin-file.xml = b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-stdin-file.xml new file mode 100644 index 000000000..f07368d01 --- /dev/null +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-stdin-file.xml @@ -0,0 +1,34 @@ + + bhyve + df3be7e7-a104-11e3-aeb0-50e5492bd3dc + 219136 + 219136 + 1 + /usr/local/sbin/grub-bhyve + + + hvm + + + destroy + restart + destroy + + + + + +
+ + + +
+ + + + + +
+ + + diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-stdin-multiline= .xml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-stdin-multiline.xml new file mode 100644 index 000000000..eae6df4b4 --- /dev/null +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-stdin-multiline.xml @@ -0,0 +1,39 @@ + + bhyve + df3be7e7-a104-11e3-aeb0-50e5492bd3dc + 219136 + 219136 + 1 + /usr/local/sbin/grub-bhyve + + + hvm + + + destroy + restart + destroy + + + + + +
+ + + +
+ + + + + +
+ + + diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-stdin-oneline.x= ml b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-stdin-oneline.xml new file mode 100644 index 000000000..b038a9065 --- /dev/null +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-grub-stdin-oneline.xml @@ -0,0 +1,34 @@ + + bhyve + df3be7e7-a104-11e3-aeb0-50e5492bd3dc + 219136 + 219136 + 1 + /usr/local/sbin/grub-bhyve + some input commands + + hvm + + + destroy + restart + destroy + + + + + +
+ + + +
+ + + + + +
+ + + diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c index 4d9c1681d..fd386b504 100644 --- a/tests/bhyvexml2xmltest.c +++ b/tests/bhyvexml2xmltest.c @@ -98,6 +98,9 @@ mymain(void) DO_TEST_DIFFERENT("grub-bootorder"); DO_TEST_DIFFERENT("grub-bootorder2"); DO_TEST_DIFFERENT("grub-defaults"); + DO_TEST_DIFFERENT("grub-stdin-file"); + DO_TEST_DIFFERENT("grub-stdin-oneline"); + DO_TEST_DIFFERENT("grub-stdin-multiline"); DO_TEST_DIFFERENT("localtime"); DO_TEST_DIFFERENT("macaddr"); DO_TEST_DIFFERENT("metadata"); --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list