2014-04-12 23:37:53 +04:00
|
|
|
/*
|
|
|
|
* bhyve_domain.c: bhyve domain private state
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Roman Bogorodskiy
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2019-12-03 10:49:49 +00:00
|
|
|
#include "bhyve_driver.h"
|
2019-01-17 19:07:20 +04:00
|
|
|
#include "bhyve_conf.h"
|
2014-04-12 23:37:53 +04:00
|
|
|
#include "bhyve_device.h"
|
|
|
|
#include "bhyve_domain.h"
|
bhyve: fix SATA address allocation
As bhyve for a long time didn't have a notion of the explicit SATA
controller and created a controller for each drive, the bhyve driver
in libvirt acted in a similar way and didn't care about the SATA
controllers and assigned PCI addresses to drives directly, as
the generated command will look like this anyway:
2:0,ahci-hd,somedisk.img
This no longer makes sense because:
1. After commit c07d1c1c4f it's not possible to assign
PCI addresses to disks
2. Bhyve now supports multiple disk drives for a controller,
so it's going away from 1:1 controller:disk mapping, so
the controller object starts to make more sense now
So, this patch does the following:
- Assign PCI address to SATA controllers (previously we didn't do this)
- Assign disk addresses instead of PCI addresses for disks. Now, when
building a bhyve command, we take PCI address not from the disk
itself but from its controller
- Assign addresses at XML parsing time using the
assignAddressesCallback. This is done mainly for being able to
verify address allocation via xml2xml tests
- Adjust existing bhyvexml2{xml,argv} tests to chase the new
address allocation
This patch is largely based on work of Fabian Freyer.
2017-01-05 16:51:25 +04:00
|
|
|
#include "bhyve_capabilities.h"
|
2014-04-12 23:37:53 +04:00
|
|
|
#include "viralloc.h"
|
|
|
|
#include "virlog.h"
|
2020-02-16 22:59:28 +01:00
|
|
|
#include "virutil.h"
|
2014-04-12 23:37:53 +04:00
|
|
|
|
|
|
|
#define VIR_FROM_THIS VIR_FROM_BHYVE
|
|
|
|
|
|
|
|
VIR_LOG_INIT("bhyve.bhyve_domain");
|
|
|
|
|
|
|
|
static void *
|
2019-10-14 14:45:33 +02:00
|
|
|
bhyveDomainObjPrivateAlloc(void *opaque G_GNUC_UNUSED)
|
2014-04-12 23:37:53 +04:00
|
|
|
{
|
|
|
|
bhyveDomainObjPrivatePtr priv;
|
|
|
|
|
|
|
|
if (VIR_ALLOC(priv) < 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return priv;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
bhyveDomainObjPrivateFree(void *data)
|
|
|
|
{
|
|
|
|
bhyveDomainObjPrivatePtr priv = data;
|
|
|
|
|
|
|
|
virDomainPCIAddressSetFree(priv->pciaddrs);
|
|
|
|
|
|
|
|
VIR_FREE(priv);
|
|
|
|
}
|
|
|
|
|
|
|
|
virDomainXMLPrivateDataCallbacks virBhyveDriverPrivateDataCallbacks = {
|
|
|
|
.alloc = bhyveDomainObjPrivateAlloc,
|
|
|
|
.free = bhyveDomainObjPrivateFree,
|
|
|
|
};
|
|
|
|
|
2019-02-17 17:04:00 +04:00
|
|
|
static bool
|
2019-02-17 11:27:28 +04:00
|
|
|
bhyveDomainDefNeedsISAController(virDomainDefPtr def)
|
|
|
|
{
|
|
|
|
if (def->os.bootloader == NULL && def->os.loader)
|
|
|
|
return true;
|
|
|
|
|
2019-02-17 17:04:00 +04:00
|
|
|
if (def->nserials || def->nconsoles)
|
2019-02-17 11:27:28 +04:00
|
|
|
return true;
|
|
|
|
|
|
|
|
if (def->ngraphics && def->nvideos)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-04-12 23:37:53 +04:00
|
|
|
static int
|
|
|
|
bhyveDomainDefPostParse(virDomainDefPtr def,
|
2019-10-14 14:45:33 +02:00
|
|
|
unsigned int parseFlags G_GNUC_UNUSED,
|
2019-12-03 10:49:49 +00:00
|
|
|
void *opaque,
|
2019-10-14 14:45:33 +02:00
|
|
|
void *parseOpaque G_GNUC_UNUSED)
|
2014-04-12 23:37:53 +04:00
|
|
|
{
|
2019-12-03 10:49:49 +00:00
|
|
|
bhyveConnPtr driver = opaque;
|
|
|
|
g_autoptr(virCaps) caps = bhyveDriverGetCapabilities(driver);
|
|
|
|
if (!caps)
|
|
|
|
return -1;
|
|
|
|
|
2019-11-26 16:09:33 +00:00
|
|
|
if (!virCapabilitiesDomainSupported(caps, def->os.type,
|
|
|
|
def->os.arch,
|
|
|
|
def->virtType))
|
|
|
|
return -1;
|
|
|
|
|
2014-04-12 23:37:53 +04:00
|
|
|
/* Add an implicit PCI root controller */
|
|
|
|
if (virDomainDefMaybeAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0,
|
|
|
|
VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) < 0)
|
|
|
|
return -1;
|
|
|
|
|
2019-02-17 17:04:00 +04:00
|
|
|
if (bhyveDomainDefNeedsISAController(def))
|
|
|
|
if (virDomainDefMaybeAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_ISA, 0,
|
|
|
|
VIR_DOMAIN_CONTROLLER_MODEL_ISA_DEFAULT) < 0)
|
|
|
|
return -1;
|
|
|
|
|
2014-04-12 23:37:53 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-10-06 17:28:46 +02:00
|
|
|
static int
|
bhyve: fix SATA address allocation
As bhyve for a long time didn't have a notion of the explicit SATA
controller and created a controller for each drive, the bhyve driver
in libvirt acted in a similar way and didn't care about the SATA
controllers and assigned PCI addresses to drives directly, as
the generated command will look like this anyway:
2:0,ahci-hd,somedisk.img
This no longer makes sense because:
1. After commit c07d1c1c4f it's not possible to assign
PCI addresses to disks
2. Bhyve now supports multiple disk drives for a controller,
so it's going away from 1:1 controller:disk mapping, so
the controller object starts to make more sense now
So, this patch does the following:
- Assign PCI address to SATA controllers (previously we didn't do this)
- Assign disk addresses instead of PCI addresses for disks. Now, when
building a bhyve command, we take PCI address not from the disk
itself but from its controller
- Assign addresses at XML parsing time using the
assignAddressesCallback. This is done mainly for being able to
verify address allocation via xml2xml tests
- Adjust existing bhyvexml2{xml,argv} tests to chase the new
address allocation
This patch is largely based on work of Fabian Freyer.
2017-01-05 16:51:25 +04:00
|
|
|
bhyveDomainDiskDefAssignAddress(bhyveConnPtr driver,
|
|
|
|
virDomainDiskDefPtr def,
|
2019-10-14 14:45:33 +02:00
|
|
|
const virDomainDef *vmdef G_GNUC_UNUSED)
|
bhyve: fix SATA address allocation
As bhyve for a long time didn't have a notion of the explicit SATA
controller and created a controller for each drive, the bhyve driver
in libvirt acted in a similar way and didn't care about the SATA
controllers and assigned PCI addresses to drives directly, as
the generated command will look like this anyway:
2:0,ahci-hd,somedisk.img
This no longer makes sense because:
1. After commit c07d1c1c4f it's not possible to assign
PCI addresses to disks
2. Bhyve now supports multiple disk drives for a controller,
so it's going away from 1:1 controller:disk mapping, so
the controller object starts to make more sense now
So, this patch does the following:
- Assign PCI address to SATA controllers (previously we didn't do this)
- Assign disk addresses instead of PCI addresses for disks. Now, when
building a bhyve command, we take PCI address not from the disk
itself but from its controller
- Assign addresses at XML parsing time using the
assignAddressesCallback. This is done mainly for being able to
verify address allocation via xml2xml tests
- Adjust existing bhyvexml2{xml,argv} tests to chase the new
address allocation
This patch is largely based on work of Fabian Freyer.
2017-01-05 16:51:25 +04:00
|
|
|
{
|
|
|
|
int idx = virDiskNameToIndex(def->dst);
|
|
|
|
|
|
|
|
if (idx < 0) {
|
|
|
|
virReportError(VIR_ERR_XML_ERROR,
|
|
|
|
_("Unknown disk name '%s' and no address specified"),
|
|
|
|
def->dst);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (def->bus) {
|
|
|
|
case VIR_DOMAIN_DISK_BUS_SATA:
|
|
|
|
def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE;
|
|
|
|
|
|
|
|
if ((driver->bhyvecaps & BHYVE_CAP_AHCI32SLOT) != 0) {
|
|
|
|
def->info.addr.drive.controller = idx / 32;
|
|
|
|
def->info.addr.drive.unit = idx % 32;
|
|
|
|
} else {
|
|
|
|
def->info.addr.drive.controller = idx;
|
|
|
|
def->info.addr.drive.unit = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
def->info.addr.drive.bus = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
bhyveDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
|
|
|
const virDomainDef *def,
|
2019-10-14 14:45:33 +02:00
|
|
|
unsigned int parseFlags G_GNUC_UNUSED,
|
bhyve: fix SATA address allocation
As bhyve for a long time didn't have a notion of the explicit SATA
controller and created a controller for each drive, the bhyve driver
in libvirt acted in a similar way and didn't care about the SATA
controllers and assigned PCI addresses to drives directly, as
the generated command will look like this anyway:
2:0,ahci-hd,somedisk.img
This no longer makes sense because:
1. After commit c07d1c1c4f it's not possible to assign
PCI addresses to disks
2. Bhyve now supports multiple disk drives for a controller,
so it's going away from 1:1 controller:disk mapping, so
the controller object starts to make more sense now
So, this patch does the following:
- Assign PCI address to SATA controllers (previously we didn't do this)
- Assign disk addresses instead of PCI addresses for disks. Now, when
building a bhyve command, we take PCI address not from the disk
itself but from its controller
- Assign addresses at XML parsing time using the
assignAddressesCallback. This is done mainly for being able to
verify address allocation via xml2xml tests
- Adjust existing bhyvexml2{xml,argv} tests to chase the new
address allocation
This patch is largely based on work of Fabian Freyer.
2017-01-05 16:51:25 +04:00
|
|
|
void *opaque,
|
2019-10-14 14:45:33 +02:00
|
|
|
void *parseOpaque G_GNUC_UNUSED)
|
bhyve: fix SATA address allocation
As bhyve for a long time didn't have a notion of the explicit SATA
controller and created a controller for each drive, the bhyve driver
in libvirt acted in a similar way and didn't care about the SATA
controllers and assigned PCI addresses to drives directly, as
the generated command will look like this anyway:
2:0,ahci-hd,somedisk.img
This no longer makes sense because:
1. After commit c07d1c1c4f it's not possible to assign
PCI addresses to disks
2. Bhyve now supports multiple disk drives for a controller,
so it's going away from 1:1 controller:disk mapping, so
the controller object starts to make more sense now
So, this patch does the following:
- Assign PCI address to SATA controllers (previously we didn't do this)
- Assign disk addresses instead of PCI addresses for disks. Now, when
building a bhyve command, we take PCI address not from the disk
itself but from its controller
- Assign addresses at XML parsing time using the
assignAddressesCallback. This is done mainly for being able to
verify address allocation via xml2xml tests
- Adjust existing bhyvexml2{xml,argv} tests to chase the new
address allocation
This patch is largely based on work of Fabian Freyer.
2017-01-05 16:51:25 +04:00
|
|
|
{
|
|
|
|
bhyveConnPtr driver = opaque;
|
|
|
|
|
|
|
|
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
|
|
|
|
virDomainDiskDefPtr disk = dev->data.disk;
|
|
|
|
|
|
|
|
if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
|
|
|
|
bhyveDomainDiskDefAssignAddress(driver, disk, def) < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
2017-02-24 16:45:13 +01:00
|
|
|
|
|
|
|
if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER) {
|
|
|
|
virDomainControllerDefPtr cont = dev->data.controller;
|
|
|
|
|
|
|
|
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
|
|
|
|
(cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT ||
|
|
|
|
cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) &&
|
|
|
|
cont->idx != 0) {
|
|
|
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
|
|
|
_("pci-root and pcie-root controllers "
|
|
|
|
"should have index 0"));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-24 17:14:30 +01:00
|
|
|
if (dev->type == VIR_DOMAIN_DEVICE_VIDEO &&
|
2020-03-26 17:29:16 +00:00
|
|
|
dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_DEFAULT) {
|
|
|
|
dev->data.video->type = VIR_DOMAIN_VIDEO_TYPE_GOP;
|
2020-03-24 17:14:30 +01:00
|
|
|
}
|
|
|
|
|
bhyve: fix SATA address allocation
As bhyve for a long time didn't have a notion of the explicit SATA
controller and created a controller for each drive, the bhyve driver
in libvirt acted in a similar way and didn't care about the SATA
controllers and assigned PCI addresses to drives directly, as
the generated command will look like this anyway:
2:0,ahci-hd,somedisk.img
This no longer makes sense because:
1. After commit c07d1c1c4f it's not possible to assign
PCI addresses to disks
2. Bhyve now supports multiple disk drives for a controller,
so it's going away from 1:1 controller:disk mapping, so
the controller object starts to make more sense now
So, this patch does the following:
- Assign PCI address to SATA controllers (previously we didn't do this)
- Assign disk addresses instead of PCI addresses for disks. Now, when
building a bhyve command, we take PCI address not from the disk
itself but from its controller
- Assign addresses at XML parsing time using the
assignAddressesCallback. This is done mainly for being able to
verify address allocation via xml2xml tests
- Adjust existing bhyvexml2{xml,argv} tests to chase the new
address allocation
This patch is largely based on work of Fabian Freyer.
2017-01-05 16:51:25 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
bhyveDomainDefAssignAddresses(virDomainDef *def,
|
2019-10-14 14:45:33 +02:00
|
|
|
unsigned int parseFlags G_GNUC_UNUSED,
|
|
|
|
void *opaque G_GNUC_UNUSED,
|
|
|
|
void *parseOpaque G_GNUC_UNUSED)
|
2014-10-06 17:28:46 +02:00
|
|
|
{
|
bhyve: fix SATA address allocation
As bhyve for a long time didn't have a notion of the explicit SATA
controller and created a controller for each drive, the bhyve driver
in libvirt acted in a similar way and didn't care about the SATA
controllers and assigned PCI addresses to drives directly, as
the generated command will look like this anyway:
2:0,ahci-hd,somedisk.img
This no longer makes sense because:
1. After commit c07d1c1c4f it's not possible to assign
PCI addresses to disks
2. Bhyve now supports multiple disk drives for a controller,
so it's going away from 1:1 controller:disk mapping, so
the controller object starts to make more sense now
So, this patch does the following:
- Assign PCI address to SATA controllers (previously we didn't do this)
- Assign disk addresses instead of PCI addresses for disks. Now, when
building a bhyve command, we take PCI address not from the disk
itself but from its controller
- Assign addresses at XML parsing time using the
assignAddressesCallback. This is done mainly for being able to
verify address allocation via xml2xml tests
- Adjust existing bhyvexml2{xml,argv} tests to chase the new
address allocation
This patch is largely based on work of Fabian Freyer.
2017-01-05 16:51:25 +04:00
|
|
|
if (bhyveDomainAssignAddresses(def, NULL) < 0)
|
|
|
|
return -1;
|
|
|
|
|
2014-10-06 17:28:46 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-01-05 16:31:35 +04:00
|
|
|
virDomainXMLOptionPtr
|
|
|
|
virBhyveDriverCreateXMLConf(bhyveConnPtr driver)
|
|
|
|
{
|
|
|
|
virBhyveDriverDomainDefParserConfig.priv = driver;
|
|
|
|
return virDomainXMLOptionNew(&virBhyveDriverDomainDefParserConfig,
|
|
|
|
&virBhyveDriverPrivateDataCallbacks,
|
2019-01-17 19:07:20 +04:00
|
|
|
&virBhyveDriverDomainXMLNamespace,
|
|
|
|
NULL, NULL);
|
2017-01-05 16:31:35 +04:00
|
|
|
}
|
|
|
|
|
2019-02-17 17:04:00 +04:00
|
|
|
|
|
|
|
static int
|
|
|
|
bhyveDomainDeviceDefValidate(const virDomainDeviceDef *dev,
|
|
|
|
const virDomainDef *def G_GNUC_UNUSED,
|
|
|
|
void *opaque G_GNUC_UNUSED)
|
|
|
|
{
|
|
|
|
if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER &&
|
|
|
|
dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_ISA &&
|
|
|
|
dev->data.controller->idx != 0) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-04-12 23:37:53 +04:00
|
|
|
virDomainDefParserConfig virBhyveDriverDomainDefParserConfig = {
|
2014-10-06 17:28:46 +02:00
|
|
|
.devicesPostParseCallback = bhyveDomainDeviceDefPostParse,
|
2014-04-12 23:37:53 +04:00
|
|
|
.domainPostParseCallback = bhyveDomainDefPostParse,
|
bhyve: fix SATA address allocation
As bhyve for a long time didn't have a notion of the explicit SATA
controller and created a controller for each drive, the bhyve driver
in libvirt acted in a similar way and didn't care about the SATA
controllers and assigned PCI addresses to drives directly, as
the generated command will look like this anyway:
2:0,ahci-hd,somedisk.img
This no longer makes sense because:
1. After commit c07d1c1c4f it's not possible to assign
PCI addresses to disks
2. Bhyve now supports multiple disk drives for a controller,
so it's going away from 1:1 controller:disk mapping, so
the controller object starts to make more sense now
So, this patch does the following:
- Assign PCI address to SATA controllers (previously we didn't do this)
- Assign disk addresses instead of PCI addresses for disks. Now, when
building a bhyve command, we take PCI address not from the disk
itself but from its controller
- Assign addresses at XML parsing time using the
assignAddressesCallback. This is done mainly for being able to
verify address allocation via xml2xml tests
- Adjust existing bhyvexml2{xml,argv} tests to chase the new
address allocation
This patch is largely based on work of Fabian Freyer.
2017-01-05 16:51:25 +04:00
|
|
|
.assignAddressesCallback = bhyveDomainDefAssignAddresses,
|
2019-02-17 17:04:00 +04:00
|
|
|
.deviceValidateCallback = bhyveDomainDeviceDefValidate,
|
2014-04-12 23:37:53 +04:00
|
|
|
};
|
2019-01-17 19:07:20 +04:00
|
|
|
|
|
|
|
static void
|
|
|
|
bhyveDomainDefNamespaceFree(void *nsdata)
|
|
|
|
{
|
|
|
|
bhyveDomainCmdlineDefPtr cmd = nsdata;
|
|
|
|
|
|
|
|
bhyveDomainCmdlineDefFree(cmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2019-08-20 23:30:40 +02:00
|
|
|
bhyveDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
|
2019-01-17 19:07:20 +04:00
|
|
|
void **data)
|
|
|
|
{
|
|
|
|
bhyveDomainCmdlineDefPtr cmd = NULL;
|
|
|
|
xmlNodePtr *nodes = NULL;
|
|
|
|
int n;
|
|
|
|
size_t i;
|
|
|
|
int ret = -1;
|
|
|
|
|
|
|
|
if (VIR_ALLOC(cmd) < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
n = virXPathNodeSet("./bhyve:commandline/bhyve:arg", ctxt, &nodes);
|
|
|
|
if (n == 0)
|
|
|
|
ret = 0;
|
|
|
|
if (n <= 0)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
if (VIR_ALLOC_N(cmd->args, n) < 0)
|
|
|
|
goto cleanup;
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
cmd->args[cmd->num_args] = virXMLPropString(nodes[i], "value");
|
|
|
|
if (cmd->args[cmd->num_args] == NULL) {
|
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
|
"%s", _("No bhyve command-line argument specified"));
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
cmd->num_args++;
|
|
|
|
}
|
|
|
|
|
2019-10-16 13:45:15 +02:00
|
|
|
*data = g_steal_pointer(&cmd);
|
2019-01-17 19:07:20 +04:00
|
|
|
ret = 0;
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
VIR_FREE(nodes);
|
|
|
|
bhyveDomainDefNamespaceFree(cmd);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2019-01-31 16:05:17 +04:00
|
|
|
bhyveDomainDefNamespaceFormatXML(virBufferPtr buf,
|
|
|
|
void *nsdata)
|
2019-01-17 19:07:20 +04:00
|
|
|
{
|
|
|
|
bhyveDomainCmdlineDefPtr cmd = nsdata;
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
if (!cmd->num_args)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
virBufferAddLit(buf, "<bhyve:commandline>\n");
|
|
|
|
virBufferAdjustIndent(buf, 2);
|
|
|
|
|
|
|
|
for (i = 0; i < cmd->num_args; i++)
|
|
|
|
virBufferEscapeString(buf, "<bhyve:arg value='%s'/>\n",
|
|
|
|
cmd->args[i]);
|
|
|
|
|
|
|
|
virBufferAdjustIndent(buf, -2);
|
|
|
|
virBufferAddLit(buf, "</bhyve:commandline>\n");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-08-20 23:39:24 +02:00
|
|
|
virXMLNamespace virBhyveDriverDomainXMLNamespace = {
|
2019-01-17 19:07:20 +04:00
|
|
|
.parse = bhyveDomainDefNamespaceParse,
|
|
|
|
.free = bhyveDomainDefNamespaceFree,
|
|
|
|
.format = bhyveDomainDefNamespaceFormatXML,
|
2019-08-21 00:02:23 +02:00
|
|
|
.prefix = "bhyve",
|
2019-08-21 09:48:47 +02:00
|
|
|
.uri = "http://libvirt.org/schemas/domain/bhyve/1.0",
|
|
|
|
|
2019-01-17 19:07:20 +04:00
|
|
|
};
|