[libvirt] [PATCH 00/13] vCPU pinning and related refactors - Part 1.5
by Peter Krempa
Few more fixes to the Part 1 and related stuff. This is a continuation and fix
to stuff done in Part 1.
Peter Krempa (13):
conf: Fix virDomainObjGetDefs when getting persistent config on a live
vm
conf: Introduce helper to help getting correct def for getter
functions
qemu: Simplify qemuDomainGetInterfaceParameters by using
virDomainObjGetOneDef
qemu: Simplify qemuDomainGetNumaParameters by using
virDomainObjGetOneDef
qemu: Simplify qemuDomainGetVcpuPinInfo by using virDomainObjGetOneDef
qemu: Simplify qemuDomainGetEmulatorPinInfo by using
virDomainObjGetOneDef
qemu: Simplify qemuDomainGetVcpusFlags by using virDomainObjGetOneDef
qemu: Simplify qemuDomainSetInterfaceParameters by using
virDomainObjGetDefs
qemu: Refactor qemuDomainSetNumaParameters
qemu: Refactor qemuDomainGetMemoryParameters
qemu: Reuse virDomainObjGetDefs in qemuDomainGetMemoryParameters
qemu: 'privileged' flag is not really configuration
conf: Move vcpu info parsing code into a separate function
src/conf/domain_conf.c | 174 ++++++++++++++++---------
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_cgroup.c | 13 +-
src/qemu/qemu_command.c | 9 +-
src/qemu/qemu_conf.c | 7 +-
src/qemu/qemu_conf.h | 5 +-
src/qemu/qemu_domain.c | 4 +-
src/qemu/qemu_driver.c | 332 ++++++++++++++---------------------------------
tests/qemuxml2argvtest.c | 4 +-
10 files changed, 241 insertions(+), 309 deletions(-)
--
2.4.1
9 years, 5 months
Re: [libvirt] [Qemu-block] [Qemu-devel] [PATCH v7 00/11] Support streaming to an intermediate layer
by Eric Blake
[adding libvirt, to make sure I capture a design idea]
On 06/18/2015 06:36 AM, Eric Blake wrote:
> On 06/18/2015 06:07 AM, Alberto Garcia wrote:
>> On Thu 18 Jun 2015 01:47:20 PM CEST, Kevin Wolf wrote:
>>
>>>>> I believe our conclusion from an earlier version of the series was
>>>>> that we need QAPI introspection so that libvirt can detect the
>>>>> presence of the feature.
>
> Detecting the presence of a feature allows libvirt the luxury of giving
> its own error message, rather than relying on the qemu message. But
> that's not to say libvirt HAS to use its own error message, and
> therefore being unable to detect the feature may not be the end of the
> world.
>
>> That said, I would prefer a way to detect the feature that does not
>> involve testing commands for their error codes, but is there any? What
>> does libvirt generally do in order to detect new features that don't
>> depend on API changes?
>
> But libvirt has not yet set up node name management (I'm about to revive
> Jeff's patch for auto-node-naming simultaneously with a libvirt patch
> series that proves that it helps libvirt), and libvirt will need a new
> API to allow users a way to request streams to an intermediate image.
> So anything libvirt does to interact with the new stream-to-intermediate
> will have to be new code, and I can worry about whether the qemu error
> message is good enough, or whether I have to contrive some probing test
> to see if it even works; but my initial thought is that merely probing
> to see if auto-node-naming is in place is a good approximation filter
> (if libvirt isn't managing its own node names, then the only way to use
> stream-to-intermediate is via a node name automatically supplied by
> qemu, especially nice if both features land in 2.4).
Actually, in thinking more about it, libvirt won't need a new API; the
existing virDomainBlockPull() and virDomainBlockRebase() are sufficient,
if I allow libvirt to treat "vda[1]" as a destination (which is the
first backing image of disk vda; pretty much similar to how qemu is
adding node names rather than device names as a way to make the existing
block-stream now stream to intermediate). And that is consistent with
the way we have been retrofitting other existing libvirt API to refer to
specific backing images. On libvirt's front, I may want to add a new
flag (where the flag must be present to make it clear that
stream-to-intermediate is desired, so that upper level applications can
use the absence of the libvirt flag as their feature probe), but that
has no bearing on what qemu has to do to turn on the feature.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
9 years, 5 months
[libvirt] [PATCH] qemu: implement address for isa-serial
by James Cowgill
I needed to specify the iobase address for certain exotic mips configurations.
Signed-off-by: James Cowgill <james410(a)cowgill.org.uk>
---
src/qemu/qemu_command.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 61faa57..e1d53c2 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2693,6 +2693,10 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
info->addr.ccw.cssid,
info->addr.ccw.ssid,
info->addr.ccw.devno);
+ } else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA) {
+ virBufferAsprintf(buf, ",iobase=0x%x,irq=0x%x",
+ info->addr.isa.iobase,
+ info->addr.isa.irq);
}
ret = 0;
@@ -10950,11 +10954,15 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
break;
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA:
- if (serial->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
+ if (serial->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
+ serial->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("no addresses are supported for isa-serial"));
+ _("isa-serial requires address of isa type"));
goto error;
}
+
+ if (qemuBuildDeviceAddressStr(&cmd, def, &serial->info, qemuCaps) < 0)
+ goto error;
break;
case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI:
--
2.1.4
9 years, 5 months
[libvirt] [PATCH 0/2] Yet again a admin API fixup series.
by Peter Krempa
Fluffy bunny ears of shame will be administered to Martin.
Peter Krempa (2):
rpc: Actually increase reference count on @srv in
virNetDaemonAddServer
daemon: Add the admin service to the admin server only if it was
allocated
daemon/libvirtd.c | 6 +++---
src/rpc/virnetdaemon.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
--
2.4.1
9 years, 5 months
[libvirt] Overhead for a default cpu cg placement scheme
by Andrey Korolyov
Hi Daniel,
would it possible to adopt an optional tunable for a virCgroup
mechanism which targets to a disablement of a nested (per-thread)
cgroup creation? Those are bringing visible overhead for many-threaded
guest workloads, almost 5% in non-congested host CPU state, primarily
because the host scheduler should make a much more decisions with
those cgroups than without them. We also experienced a lot of host
lockups with currently exploited cgroup placement and disabled nested
behavior a couple of years ago. Though the current patch is simply
carves out the mentioned behavior, leaving only top-level per-machine
cgroups, it can serve for an upstream after some adaptation, that`s
why I`m asking about a chance of its acceptance. This message is a
kind of 'request of a feature', it either can be accepted/dropped from
our side or someone may give a hand and redo it from scratch. The
detailed benchmarks are related to a host 3.10.y, if anyone is
interested in the numbers for latest stable, I can update those.
Thanks!
9 years, 5 months
[libvirt] [RFC v2][remote]
by Nikolay Shirokovskiy
Hello.
I'll reword the previous letter.
In libvirt we have connection close callback for drivers that have persistent
internal connection to notify client that this connection is closed. Vz driver
has internal persistent connection so I wanted to add support of this callback
to vz driver. Now clients with connections urls like 'vz:///system' are
notified of connection close event. But if connection url is like
'vz+<transport>://system we have a remote driver between client and vz driver
and client is not notified as remote driver doesn't handle this event.
The problem is that remote driver can't just relay this event as domain one
as there is no means to do it in driver interface. The quick fix is to close
the connection between daemon and remote driver from daemon side is case of
close event. This will trigger connection close event in remote driver and
client finally will be notified. I doubt this is a good approach as it looks
like we forced to take specific action of closing connection to daemon only due
to lack of appropriate driver interface.
So the proposition is to move connection close event
registration/deregistration/notifying to driver level so remote driver could
relay them just like say domain events.
9 years, 5 months
[libvirt] [PATCH v2] virSysinfo: Introduce SMBIOS type 2 support
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1220527
This type of information defines attributes of a system
baseboard. With one caveat: in qemu they call it family, while
in the specification it's referred to as type. I'm sticking with
the latter.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
diff to v1:
-I've dropped the 'family' attribute. It's not implemented in qemu yet. We can
add it later.
docs/formatdomain.html.in | 37 ++++-
docs/schemas/domaincommon.rng | 23 +++
src/conf/domain_conf.c | 63 ++++++++
src/libvirt_private.syms | 1 +
src/qemu/qemu_command.c | 54 +++++++
src/util/virsysinfo.c | 170 ++++++++++++++++++++-
src/util/virsysinfo.h | 16 ++
.../qemuxml2argv-smbios-multiple-type2.xml | 58 +++++++
tests/qemuxml2argvdata/qemuxml2argv-smbios.args | 2 +
tests/qemuxml2argvdata/qemuxml2argv-smbios.xml | 8 +
tests/qemuxml2xmltest.c | 1 +
11 files changed, 427 insertions(+), 6 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smbios-multiple-type2.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0478cb2..977660e 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -375,6 +375,12 @@
<entry name='product'>Virt-Manager</entry>
<entry name='version'>0.9.4</entry>
</system>
+ <baseBoard>
+ <entry name='manufacturer'>LENOVO</entry>
+ <entry name='product'>20BE0061MC</entry>
+ <entry name='version'>0B98401 Pro</entry>
+ <entry name='serial'>W1KS427111E</entry>
+ </baseBoard>
</sysinfo>
...</pre>
@@ -435,11 +441,32 @@
<dt><code>family</code></dt>
<dd>Identify the family a particular computer belongs to.</dd>
</dl>
- NB: Incorrectly supplied entries in either the <code>bios</code>
- or <code>system</code> blocks will be ignored without error.
- Other than <code>uuid</code> validation and <code>date</code>
- format checking, all values are passed as strings to the
- hypervisor driver.
+ </dd>
+ <dt><code>baseBoard</code></dt>
+ <dd>
+ This is block 2 of SMBIOS. This element can be repeated multiple
+ times, to describe all the base boards. However, not all
+ hypervisors support the repetition necessarily. The element can
+ have the following children:
+ <dl>
+ <dt><code>manufacturer</code></dt>
+ <dd>Manufacturer of BIOS</dd>
+ <dt><code>product</code></dt>
+ <dd>Product Name</dd>
+ <dt><code>version</code></dt>
+ <dd>Version of the product</dd>
+ <dt><code>serial</code></dt>
+ <dd>Serial number</dd>
+ <dt><code>asset</code></dt>
+ <dd>Asset tag</dd>
+ <dt><code>location</code></dt>
+ <dd>Location in chassis</dd>
+ </dl>
+ NB: Incorrectly supplied entries for the
+ <code>bios</code>, <code>system</code> or <code>baseBoard</code>
+ blocks will be ignored without error. Other than <code>uuid</code>
+ validation and <code>date</code> format checking, all values are
+ passed as strings to the hypervisor driver.
</dd>
</dl>
</dd>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index e38b927..32d28cd 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4248,6 +4248,18 @@
</oneOrMore>
</element>
</optional>
+ <zeroOrMore>
+ <element name="baseBoard">
+ <oneOrMore>
+ <element name="entry">
+ <attribute name="name">
+ <ref name="sysinfo-baseBoard-name"/>
+ </attribute>
+ <ref name="sysinfo-value"/>
+ </element>
+ </oneOrMore>
+ </element>
+ </zeroOrMore>
</interleave>
</element>
</define>
@@ -4273,6 +4285,17 @@
</choice>
</define>
+ <define name="sysinfo-baseBoard-name">
+ <choice>
+ <value>manufacturer</value>
+ <value>product</value>
+ <value>version</value>
+ <value>serial</value>
+ <value>asset</value>
+ <value>location</value>
+ </choice>
+ </define>
+
<define name="sysinfo-value">
<data type="string">
<param name='pattern'>[a-zA-Z0-9/\-_\. \(\)]+</param>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bf7eeb2..c2174d9 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11227,6 +11227,65 @@ virSysinfoSystemParseXML(xmlNodePtr node,
return ret;
}
+static int
+virSysinfoBaseBoardParseXML(xmlXPathContextPtr ctxt,
+ virSysinfoBaseBoardDefPtr *baseBoard,
+ size_t *nbaseBoard)
+{
+ int ret = -1;
+ virSysinfoBaseBoardDefPtr boards = NULL;
+ size_t i, nboards = 0;
+ char *board_type = NULL;
+ xmlNodePtr *nodes = NULL, oldnode = ctxt->node;
+ int n;
+
+ if ((n = virXPathNodeSet("./baseBoard", ctxt, &nodes)) < 0)
+ return ret;
+
+ if (n && VIR_ALLOC_N(boards, n) < 0)
+ goto cleanup;
+
+ for (i = 0; i < n; i++) {
+ virSysinfoBaseBoardDefPtr def = boards + nboards;
+
+ ctxt->node = nodes[i];
+
+ def->manufacturer =
+ virXPathString("string(entry[@name='manufacturer'])", ctxt);
+ def->product =
+ virXPathString("string(entry[@name='product'])", ctxt);
+ def->version =
+ virXPathString("string(entry[@name='version'])", ctxt);
+ def->serial =
+ virXPathString("string(entry[@name='serial'])", ctxt);
+ def->asset =
+ virXPathString("string(entry[@name='asset'])", ctxt);
+ def->location =
+ virXPathString("string(entry[@name='location'])", ctxt);
+
+ if (!def->manufacturer && !def->product && !def->version &&
+ !def->serial && !def->asset && !def->location) {
+ /* nada */
+ } else {
+ nboards++;
+ }
+ }
+
+ *baseBoard = boards;
+ *nbaseBoard = nboards;
+ boards = NULL;
+ nboards = 0;
+ ret = 0;
+ cleanup:
+ while (nboards--)
+ virSysinfoBaseBoardDefClear(&boards[nboards]);
+ VIR_FREE(boards);
+ VIR_FREE(board_type);
+ VIR_FREE(nodes);
+ ctxt->node = oldnode;
+ return ret;
+}
+
static virSysinfoDefPtr
virSysinfoParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt,
@@ -11281,6 +11340,10 @@ virSysinfoParseXML(xmlNodePtr node,
ctxt->node = oldnode;
}
+ /* Extract system base board metadata */
+ if (virSysinfoBaseBoardParseXML(ctxt, &def->baseBoard, &def->nbaseBoard) < 0)
+ goto error;
+
cleanup:
VIR_FREE(type);
return def;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index dc8a52d..2348f14 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2182,6 +2182,7 @@ virVasprintfInternal;
# util/virsysinfo.h
+virSysinfoBaseBoardDefClear;
virSysinfoBIOSDefFree;
virSysinfoDefFree;
virSysinfoFormat;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c34fe8a..03f8e66 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6779,6 +6779,45 @@ static char *qemuBuildSmbiosSystemStr(virSysinfoSystemDefPtr def,
return NULL;
}
+static char *qemuBuildSmbiosBaseBoardStr(virSysinfoBaseBoardDefPtr def)
+{
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+
+ if (!def)
+ return NULL;
+
+ virBufferAddLit(&buf, "type=2");
+
+ /* 2:Manufacturer */
+ if (def->manufacturer)
+ virBufferAsprintf(&buf, ",manufacturer=%s",
+ def->manufacturer);
+ /* 2:Product Name */
+ if (def->product)
+ virBufferAsprintf(&buf, ",product=%s", def->product);
+ /* 2:Version */
+ if (def->version)
+ virBufferAsprintf(&buf, ",version=%s", def->version);
+ /* 2:Serial Number */
+ if (def->serial)
+ virBufferAsprintf(&buf, ",serial=%s", def->serial);
+ /* 2:Asset Tag */
+ if (def->asset)
+ virBufferAsprintf(&buf, ",asset=%s", def->asset);
+ /* 2:Location */
+ if (def->location)
+ virBufferAsprintf(&buf, ",location=%s", def->location);
+
+ if (virBufferCheckError(&buf) < 0)
+ goto error;
+
+ return virBufferContentAndReset(&buf);
+
+ error:
+ virBufferFreeAndReset(&buf);
+ return NULL;
+}
+
static char *
qemuBuildClockArgStr(virDomainClockDefPtr def)
{
@@ -9057,6 +9096,21 @@ qemuBuildCommandLine(virConnectPtr conn,
virCommandAddArgList(cmd, "-smbios", smbioscmd, NULL);
VIR_FREE(smbioscmd);
}
+
+ if (source->nbaseBoard > 1) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("qemu does not support more than "
+ "one entry to Type 2 in SMBIOS table"));
+ goto error;
+ }
+
+ for (i = 0; i < source->nbaseBoard; i++) {
+ if (!(smbioscmd = qemuBuildSmbiosBaseBoardStr(source->baseBoard + i)))
+ goto error;
+
+ virCommandAddArgList(cmd, "-smbios", smbioscmd, NULL);
+ VIR_FREE(smbioscmd);
+ }
}
}
diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 692c921..a4d31c9 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -91,6 +91,18 @@ void virSysinfoSystemDefFree(virSysinfoSystemDefPtr def)
VIR_FREE(def);
}
+void virSysinfoBaseBoardDefClear(virSysinfoBaseBoardDefPtr def)
+{
+ if (def == NULL)
+ return;
+
+ VIR_FREE(def->manufacturer);
+ VIR_FREE(def->product);
+ VIR_FREE(def->version);
+ VIR_FREE(def->serial);
+ VIR_FREE(def->asset);
+ VIR_FREE(def->location);
+}
/**
* virSysinfoDefFree:
@@ -109,6 +121,10 @@ void virSysinfoDefFree(virSysinfoDefPtr def)
virSysinfoBIOSDefFree(def->bios);
virSysinfoSystemDefFree(def->system);
+ for (i = 0; i < def->nbaseBoard; i++)
+ virSysinfoBaseBoardDefClear(def->baseBoard + i);
+ VIR_FREE(def->baseBoard);
+
for (i = 0; i < def->nprocessor; i++) {
VIR_FREE(def->processor[i].processor_socket_destination);
VIR_FREE(def->processor[i].processor_type);
@@ -717,6 +733,84 @@ virSysinfoParseSystem(const char *base, virSysinfoSystemDefPtr *system)
}
static int
+virSysinfoParseBaseBoard(const char *base,
+ virSysinfoBaseBoardDefPtr *baseBoard,
+ size_t *nbaseBoard)
+{
+ int ret = -1;
+ const char *cur, *eol = NULL;
+ virSysinfoBaseBoardDefPtr boards = NULL;
+ size_t nboards = 0;
+ char *board_type = NULL;
+
+ while (base && (cur = strstr(base, "Base Board Information"))) {
+ virSysinfoBaseBoardDefPtr def;
+
+ if (VIR_EXPAND_N(boards, nboards, 1) < 0)
+ goto cleanup;
+
+ def = &boards[nboards - 1];
+
+ base = cur + 22;
+ if ((cur = strstr(base, "Manufacturer: ")) != NULL) {
+ cur += 14;
+ eol = strchr(cur, '\n');
+ if (eol && VIR_STRNDUP(def->manufacturer, cur, eol - cur) < 0)
+ goto cleanup;
+ }
+ if ((cur = strstr(base, "Product Name: ")) != NULL) {
+ cur += 14;
+ eol = strchr(cur, '\n');
+ if (eol && VIR_STRNDUP(def->product, cur, eol - cur) < 0)
+ goto cleanup;
+ }
+ if ((cur = strstr(base, "Version: ")) != NULL) {
+ cur += 9;
+ eol = strchr(cur, '\n');
+ if (eol && VIR_STRNDUP(def->version, cur, eol - cur) < 0)
+ goto cleanup;
+ }
+ if ((cur = strstr(base, "Serial Number: ")) != NULL) {
+ cur += 15;
+ eol = strchr(cur, '\n');
+ if (eol && VIR_STRNDUP(def->serial, cur, eol - cur) < 0)
+ goto cleanup;
+ }
+ if ((cur = strstr(base, "Asset Tag: ")) != NULL) {
+ cur += 11;
+ eol = strchr(cur, '\n');
+ if (eol && VIR_STRNDUP(def->asset, cur, eol - cur) < 0)
+ goto cleanup;
+ }
+ if ((cur = strstr(base, "Location In Chassis: ")) != NULL) {
+ cur += 21;
+ eol = strchr(cur, '\n');
+ if (eol && VIR_STRNDUP(def->location, cur, eol - cur) < 0)
+ goto cleanup;
+ }
+
+ if (!def->manufacturer && !def->product && !def->version &&
+ !def->serial && !def->asset && !def->location)
+ nboards--;
+ }
+
+ /* This is safe, as we can be only shrinking the memory */
+ ignore_value(VIR_REALLOC_N(boards, nboards));
+
+ *baseBoard = boards;
+ *nbaseBoard = nboards;
+ boards = NULL;
+ nboards = 0;
+ ret = 0;
+ cleanup:
+ while (nboards--)
+ virSysinfoBaseBoardDefClear(&boards[nboards]);
+ VIR_FREE(boards);
+ VIR_FREE(board_type);
+ return ret;
+}
+
+static int
virSysinfoParseProcessor(const char *base, virSysinfoDefPtr ret)
{
const char *cur, *tmp_base;
@@ -938,7 +1032,7 @@ virSysinfoRead(void)
return NULL;
}
- cmd = virCommandNewArgList(path, "-q", "-t", "0,1,4,17", NULL);
+ cmd = virCommandNewArgList(path, "-q", "-t", "0,1,2,4,17", NULL);
VIR_FREE(path);
virCommandSetOutputBuffer(cmd, &outbuf);
if (virCommandRun(cmd, NULL) < 0)
@@ -955,6 +1049,9 @@ virSysinfoRead(void)
if (virSysinfoParseSystem(outbuf, &ret->system) < 0)
goto error;
+ if (virSysinfoParseBaseBoard(outbuf, &ret->baseBoard, &ret->nbaseBoard) < 0)
+ goto error;
+
ret->nprocessor = 0;
ret->processor = NULL;
if (virSysinfoParseProcessor(outbuf, ret) < 0)
@@ -1025,6 +1122,36 @@ virSysinfoSystemFormat(virBufferPtr buf, virSysinfoSystemDefPtr def)
}
static void
+virSysinfoBaseBoardFormat(virBufferPtr buf,
+ virSysinfoBaseBoardDefPtr baseBoard,
+ size_t nbaseBoard)
+{
+ virSysinfoBaseBoardDefPtr def;
+ size_t i;
+
+ for (i = 0; i < nbaseBoard; i++) {
+ def = baseBoard + i;
+
+ virBufferAddLit(buf, "<baseBoard>\n");
+ virBufferAdjustIndent(buf, 2);
+ virBufferEscapeString(buf, "<entry name='manufacturer'>%s</entry>\n",
+ def->manufacturer);
+ virBufferEscapeString(buf, "<entry name='product'>%s</entry>\n",
+ def->product);
+ virBufferEscapeString(buf, "<entry name='version'>%s</entry>\n",
+ def->version);
+ virBufferEscapeString(buf, "<entry name='serial'>%s</entry>\n",
+ def->serial);
+ virBufferEscapeString(buf, "<entry name='asset'>%s</entry>\n",
+ def->asset);
+ virBufferEscapeString(buf, "<entry name='location'>%s</entry>\n",
+ def->location);
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</baseBoard>\n");
+ }
+}
+
+static void
virSysinfoProcessorFormat(virBufferPtr buf, virSysinfoDefPtr def)
{
size_t i;
@@ -1157,6 +1284,7 @@ virSysinfoFormat(virBufferPtr buf, virSysinfoDefPtr def)
virSysinfoBIOSFormat(&childrenBuf, def->bios);
virSysinfoSystemFormat(&childrenBuf, def->system);
+ virSysinfoBaseBoardFormat(&childrenBuf, def->baseBoard, def->nbaseBoard);
virSysinfoProcessorFormat(&childrenBuf, def);
virSysinfoMemoryFormat(&childrenBuf, def);
@@ -1241,12 +1369,40 @@ virSysinfoSystemIsEqual(virSysinfoSystemDefPtr src,
return identical;
}
+static bool
+virSysinfoBaseBoardIsEqual(virSysinfoBaseBoardDefPtr src,
+ virSysinfoBaseBoardDefPtr dst)
+{
+ bool identical = false;
+
+ if (!src && !dst)
+ return true;
+
+ if ((src && !dst) || (!src && dst)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Target base board does not match source"));
+ goto cleanup;
+ }
+
+ CHECK_FIELD(manufacturer, "base board vendor");
+ CHECK_FIELD(product, "base board product");
+ CHECK_FIELD(version, "base board version");
+ CHECK_FIELD(serial, "base board serial");
+ CHECK_FIELD(asset, "base board asset");
+ CHECK_FIELD(location, "base board location");
+
+ identical = true;
+ cleanup:
+ return identical;
+}
+
#undef CHECK_FIELD
bool virSysinfoIsEqual(virSysinfoDefPtr src,
virSysinfoDefPtr dst)
{
bool identical = false;
+ size_t i;
if (!src && !dst)
return true;
@@ -1271,6 +1427,18 @@ bool virSysinfoIsEqual(virSysinfoDefPtr src,
if (!virSysinfoSystemIsEqual(src->system, dst->system))
goto cleanup;
+ if (src->nbaseBoard != dst->nbaseBoard) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target sysinfo base board count '%zu' does not match source '%zu'"),
+ dst->nbaseBoard, src->nbaseBoard);
+ goto cleanup;
+ }
+
+ for (i = 0; i < src->nbaseBoard; i++)
+ if (!virSysinfoBaseBoardIsEqual(src->baseBoard + i,
+ dst->baseBoard + i))
+ goto cleanup;
+
identical = true;
cleanup:
diff --git a/src/util/virsysinfo.h b/src/util/virsysinfo.h
index c8cc1e8..1e51d2c 100644
--- a/src/util/virsysinfo.h
+++ b/src/util/virsysinfo.h
@@ -86,6 +86,18 @@ struct _virSysinfoSystemDef {
char *family;
};
+typedef struct _virSysinfoBaseBoardDef virSysinfoBaseBoardDef;
+typedef virSysinfoBaseBoardDef *virSysinfoBaseBoardDefPtr;
+struct _virSysinfoBaseBoardDef {
+ char *manufacturer;
+ char *product;
+ char *version;
+ char *serial;
+ char *asset;
+ char *location;
+ /* XXX board type */
+};
+
typedef struct _virSysinfoDef virSysinfoDef;
typedef virSysinfoDef *virSysinfoDefPtr;
struct _virSysinfoDef {
@@ -94,6 +106,9 @@ struct _virSysinfoDef {
virSysinfoBIOSDefPtr bios;
virSysinfoSystemDefPtr system;
+ size_t nbaseBoard;
+ virSysinfoBaseBoardDefPtr baseBoard;
+
size_t nprocessor;
virSysinfoProcessorDefPtr processor;
@@ -105,6 +120,7 @@ virSysinfoDefPtr virSysinfoRead(void);
void virSysinfoBIOSDefFree(virSysinfoBIOSDefPtr def);
void virSysinfoSystemDefFree(virSysinfoSystemDefPtr def);
+void virSysinfoBaseBoardDefClear(virSysinfoBaseBoardDefPtr def);
void virSysinfoDefFree(virSysinfoDefPtr def);
int virSysinfoFormat(virBufferPtr buf, virSysinfoDefPtr def)
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smbios-multiple-type2.xml b/tests/qemuxml2argvdata/qemuxml2argv-smbios-multiple-type2.xml
new file mode 100644
index 0000000..1f6aec1
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smbios-multiple-type2.xml
@@ -0,0 +1,58 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <sysinfo type='smbios'>
+ <bios>
+ <entry name='vendor'>LENOVO</entry>
+ <entry name='version'>6FET82WW (3.12 )</entry>
+ </bios>
+ <system>
+ <entry name='manufacturer'>Fedora</entry>
+ <entry name='product'>Virt-Manager</entry>
+ <entry name='version'>0.8.2-3.fc14</entry>
+ <entry name='serial'>32dfcb37-5af1-552b-357c-be8c3aa38310</entry>
+ <entry name='uuid'>c7a5fdbd-edaf-9455-926a-d65c16db1809</entry>
+ <entry name='sku'>1234567890</entry>
+ <entry name='family'>Red Hat</entry>
+ </system>
+ <baseBoard>
+ <entry name='manufacturer'>Hewlett-Packard</entry>
+ <entry name='product'>0B4Ch</entry>
+ <entry name='version'>D</entry>
+ <entry name='serial'>CZC1065993</entry>
+ <entry name='asset'>CZC1065993</entry>
+ <entry name='location'>Upside down</entry>
+ </baseBoard>
+ <baseBoard>
+ <entry name='manufacturer'>Lenovo</entry>
+ <entry name='product'>20BE0061MC</entry>
+ <entry name='version'>0B98401 Pro</entry>
+ <entry name='serial'>W1KS427111E</entry>
+ <entry name='location'>Not Available</entry>
+ </baseBoard>
+ </sysinfo>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ <smbios mode='sysinfo'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smbios.args b/tests/qemuxml2argvdata/qemuxml2argv-smbios.args
index e939aca..209cf20 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-smbios.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smbios.args
@@ -4,5 +4,7 @@ pc -m 214 -smp 1 -smbios 'type=0,vendor=LENOVO,version=6FET82WW (3.12 )' \
-smbios 'type=1,manufacturer=Fedora,product=Virt-Manager,version=0.8.2-3.fc14,\
serial=32dfcb37-5af1-552b-357c-be8c3aa38310,\
uuid=c7a5fdbd-edaf-9455-926a-d65c16db1809,sku=1234567890,family=Red Hat' \
+-smbios 'type=2,manufacturer=Hewlett-Packard,product=0B4Ch,version=D,\
+serial=CZC1065993,asset=CZC1065993,location=Upside down' \
-nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smbios.xml b/tests/qemuxml2argvdata/qemuxml2argv-smbios.xml
index a2caeea..30888ae 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-smbios.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smbios.xml
@@ -18,6 +18,14 @@
<entry name='sku'>1234567890</entry>
<entry name='family'>Red Hat</entry>
</system>
+ <baseBoard>
+ <entry name='manufacturer'>Hewlett-Packard</entry>
+ <entry name='product'>0B4Ch</entry>
+ <entry name='version'>D</entry>
+ <entry name='serial'>CZC1065993</entry>
+ <entry name='asset'>CZC1065993</entry>
+ <entry name='location'>Upside down</entry>
+ </baseBoard>
</sysinfo>
<os>
<type arch='i686' machine='pc'>hvm</type>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 44b388c..3287ea3 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -614,6 +614,7 @@ mymain(void)
DO_TEST_DIFFERENT("tap-vhost-incorrect");
DO_TEST("shmem");
DO_TEST("smbios");
+ DO_TEST("smbios-multiple-type2");
DO_TEST("aarch64-aavmf-virtio-mmio");
DO_TEST("memory-hotplug");
--
2.3.6
9 years, 5 months
[libvirt] [PATCH] qemu: Report all supported machine types in capabilities
by Jiri Denemark
Some machine types are only reported as canonical names for other
machine types, which make it a bit harder to find what machine types are
supported by a specific QEMU binary. Ideally, one would just use
/capabilities/guest/arch[@name='...']/machine/text() XPath to get a list
of all supported machine types, but it doesn't work right now.
For example, we report
<machine canonical='pc-i440fx-2.3' maxCpus='255'>pc</machine>
in guest capabilities, but the corresponding
<machine maxCpus='255'>pc-i440fx-2.3</machine>
is missing.
This is a result of QMP probing. With "-machine ?" parsing QEMU sends
us two lines:
pc Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-2.3)
pc-i440fx-2.3 Standard PC (i440FX + PIIX, 1996) (default)
while query-machines QMP command reports both in the same entry:
{"name": "pc-i440fx-2.3", "is-default": true, "cpu-max": 255, "alias": "pc"}
Let's make sure we always report separate <machine/> for both the
canonical name and its alias and using the canonical name as the default
machine type (i.e., inserting it before its alias) in case is-default is
true.
https://bugzilla.redhat.com/show_bug.cgi?id=1229666
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index ca7a7c2..e9b3bb5 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2223,6 +2223,44 @@ int virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr qemuCaps,
mach->maxCpus = qemuCaps->machineMaxCpus[i];
}
+ /* Make sure all canonical machine types also have their own entry so that
+ * /capabilities/guest/arch[@name='...']/machine/text() XPath selects all
+ * supported machine types.
+ */
+ i = 0;
+ while (i < *nmachines) {
+ size_t j;
+ bool found = false;
+ virCapsGuestMachinePtr machine = (*machines)[i];
+
+ if (!machine->canonical) {
+ i++;
+ continue;
+ }
+
+ for (j = 0; j < *nmachines; j++) {
+ if (STREQ(machine->canonical, (*machines)[j]->name)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ virCapsGuestMachinePtr mach;
+ if (VIR_ALLOC(mach) < 0)
+ goto error;
+ if (VIR_INSERT_ELEMENT_COPY(*machines, i, *nmachines, mach) < 0) {
+ VIR_FREE(mach);
+ goto error;
+ }
+ if (VIR_STRDUP(mach->name, machine->canonical) < 0)
+ goto error;
+ mach->maxCpus = machine->maxCpus;
+ i++;
+ }
+ i++;
+ }
+
return 0;
error:
--
2.4.3
9 years, 5 months
[libvirt] [PATCH] daemon: only unref virNetServers once
by Ján Tomko
After we add srv and srvAdm to the virNetDaemon,
it's its responsibility to unref them in virNetDaemonDispose.
Added by commits fa14207 and d5f4241.
---
daemon/libvirtd.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 368e10c..9e6c489 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1589,8 +1589,6 @@ int main(int argc, char **argv) {
virObjectUnref(adminProgram);
virNetDaemonClose(dmn);
virObjectUnref(dmn);
- virObjectUnref(srv);
- virObjectUnref(srvAdm);
virNetlinkShutdown();
if (statuswrite != -1) {
if (ret != 0) {
--
2.3.6
9 years, 5 months
[libvirt] [PATCH] remove redundant condition
by Ján Tomko
If the address type is SPAPRVIO, it will match the != NONE condition.
---
src/qemu/qemu_command.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3886b4f..078ecf7 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2423,8 +2423,6 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
def->controllers[i]->idx == 0)
continue;
- if (def->controllers[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO)
- continue;
if (def->controllers[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
continue;
--
2.3.6
9 years, 5 months