[libvirt] [PATCH] vmx: do not treat controllers as implicit devices
by Ján Tomko
When parsing the config, we look for the SCSI controllers one by one,
remembering their models, then let virDomainDefAddImplicitDevices
add them if any SCSI disk is using them.
Since these controllers are not really implicit (they are present
in the source config), add them explicitly.
This patch maintains the behavior of not adding a controller
if it was present in the config, but no disk was using it.
This also resolves the memory leak of virVMXParseConfig overwriting
the video device added by calling virDomainDefAddImplicitDevices
before the parsing is finished.
Reported-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/vmx/vmx.c | 32 ++++++++++++--------------------
1 file changed, 12 insertions(+), 20 deletions(-)
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 3e2f4c3e1..849cfc6b1 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1650,6 +1650,18 @@ virVMXParseConfig(virVMXContext *ctx,
if (def->disks[def->ndisks] != NULL)
++def->ndisks;
}
+
+ }
+
+ /* add all the SCSI controllers we've seen, up until the last one that is
+ * currently used by a disk */
+ if (def->ndisks != 0) {
+ virDomainDeviceInfoPtr info = &def->disks[def->ndisks - 1]->info;
+ for (controller = 0; controller <= info->addr.drive.controller; controller++) {
+ if (virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_SCSI,
+ controller, scsi_virtualDev[controller]) < 0)
+ goto cleanup;
+ }
}
/* def:disks (ide) */
@@ -1689,26 +1701,6 @@ virVMXParseConfig(virVMXContext *ctx,
++def->ndisks;
}
- /* def:controllers */
- if (virDomainDefAddImplicitDevices(def) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not add controllers"));
- goto cleanup;
- }
-
- for (controller = 0; controller < def->ncontrollers; ++controller) {
- if (def->controllers[controller]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
- if (def->controllers[controller]->idx > 3) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("SCSI controller index %d out of [0..3] range"),
- def->controllers[controller]->idx);
- goto cleanup;
- }
-
- def->controllers[controller]->model =
- scsi_virtualDev[def->controllers[controller]->idx];
- }
- }
-
/* def:fss */
if (virVMXGetConfigBoolean(conf, "isolation.tools.hgfs.disable",
&hgfs_disabled, true, true) < 0) {
--
2.13.0
7 years, 4 months
[libvirt] [PATCH] tests: Fix leak in securityselinuxtest
by John Ferlan
If we jump to the error: label and @secbuf is allocated, then it's not
free'd at all.
Found by Coverity
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
tests/securityselinuxtest.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/securityselinuxtest.c b/tests/securityselinuxtest.c
index f6bc07a..0ac2828 100644
--- a/tests/securityselinuxtest.c
+++ b/tests/securityselinuxtest.c
@@ -68,7 +68,7 @@ testBuildDomainDef(bool dynamic,
const char *baselabel)
{
virDomainDefPtr def;
- virSecurityLabelDefPtr secdef;
+ virSecurityLabelDefPtr secdef = NULL;
if (!(def = virDomainDefNew()))
goto error;
@@ -98,6 +98,7 @@ testBuildDomainDef(bool dynamic,
error:
virDomainDefFree(def);
+ virSecurityLabelDefFree(secdef);
return NULL;
}
--
2.9.5
7 years, 4 months
[libvirt] [PATCH 0/2] Yet another namespace fix, kinda
by Martin Kletzander
Fixing easy problem (patch 1) lead me to finding out that there is yet
another problem that needs fixing (patch 2). For more information
read the code.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1443434
Martin Kletzander (2):
qemu: Don't mangle the storage format for type='dir'
qemu: Also treat directories properly when using namespaces
src/qemu/qemu_domain.c | 38 +++++++++++++++++++---
src/storage/storage_source.c | 5 +++
.../qemuxml2argv-floppy-drive-noformat.args | 24 ++++++++++++++
.../qemuxml2argv-floppy-drive-noformat.xml | 31 ++++++++++++++++++
tests/qemuxml2argvtest.c | 2 ++
5 files changed, 95 insertions(+), 5 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-noformat.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-noformat.xml
--
2.14.1
7 years, 4 months
[libvirt] [PATCH v2] vz: support disabled items in vz boot order
by Nikolay Shirokovskiy
At the time the check was written virtuozzo did not use disabled items in boot
order configuration. Boot items were always enabled. Now they can be disabled
as well. Supporting such items is easy - they just should be ignored.
---
src/vz/vz_sdk.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 8ccd7ea..a6eb0dd 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -1736,11 +1736,8 @@ prlsdkConvertBootOrderVm(PRL_HANDLE sdkdom, virDomainDefPtr def)
pret = PrlBootDev_IsInUse(bootDev, &inUse);
prlsdkCheckRetGoto(pret, cleanup);
- if (!inUse) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Boot ordering with disabled items is not supported"));
- goto cleanup;
- }
+ if (!inUse)
+ continue;
pret = PrlBootDev_GetSequenceIndex(bootDev, &bootIndex);
prlsdkCheckRetGoto(pret, cleanup);
--
1.8.3.1
7 years, 4 months
[libvirt] [PATCH 0/3] Add support for virtio-vga/gpu's max_outputs= parameter
by Martin Kletzander
The subject of this cover letter goes very nicely together with the
subjects of the subsequent messages. I hope my literature teachers
are proud of me.
Martin Kletzander (3):
qemu: Add capabilities for virtio-vga/gpu's max_outputs= parameter
qemu: Add support for virtio-vga/gpu's max_outputs= parameter
docs: Update news with virtio-vga/gpu's max_outputs= parameter
docs/news.xml | 5 +++++
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 5 +++++
tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.ppc64le.xml | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-video-virtio-vga.args | 2 +-
tests/qemuxml2argvtest.c | 3 ++-
19 files changed, 29 insertions(+), 2 deletions(-)
--
2.14.1
7 years, 4 months
[libvirt] [PATCH] docs: Define anchors correctly in pci-hotplug
by Andrea Bolognani
HTML5 obsoletes the 'name' attribute in favor of 'id',
and our TOC generator apparently follows the recommendation
to the letter, resulting in a broken TOC if you use the
old-school attribute.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
Pushed as trivial.
docs/pci-hotplug.html.in | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/docs/pci-hotplug.html.in b/docs/pci-hotplug.html.in
index cddc6f81b..6e0648ee2 100644
--- a/docs/pci-hotplug.html.in
+++ b/docs/pci-hotplug.html.in
@@ -33,9 +33,9 @@
types, hence the way it's organized.
</p>
- <h2><a name="x86_64">x86_64 architecture</a></h2>
+ <h2><a id="x86_64">x86_64 architecture</a></h2>
- <h3><a name="x86_64-q35">q35 machine type</a></h3>
+ <h3><a id="x86_64-q35">q35 machine type</a></h3>
<p>
This is a PCI Express native machine type. The default PCI topology
@@ -104,7 +104,7 @@
from 0x01 to 0x1f of the <code>pci-bridge</code> controller.
</p>
- <h3><a name="x86_64-i440fx">i440fx (pc) machine type</a></h3>
+ <h3><a id="x86_64-i440fx">i440fx (pc) machine type</a></h3>
<p>
This is a legacy PCI native machine type. The default PCI
@@ -121,9 +121,9 @@
assigned from the guest.
</p>
- <h2><a name="ppc64">ppc64 architecture</a></h2>
+ <h2><a id="ppc64">ppc64 architecture</a></h2>
- <h3><a name="ppc64-pseries">pseries machine type</a></h3>
+ <h3><a id="ppc64-pseries">pseries machine type</a></h3>
<p>
The default PCI topology for the <code>pseries</code> machine
@@ -162,9 +162,9 @@
from the host.
</p>
- <h2><a name="aarch64">aarch64 architecture</a></h2>
+ <h2><a id="aarch64">aarch64 architecture</a></h2>
- <h3><a name="aarch64-virt">mach-virt (virt) machine type</a></h3>
+ <h3><a id="aarch64-virt">mach-virt (virt) machine type</a></h3>
<p>
This machine type mostly behaves the same as the
--
2.13.5
7 years, 4 months
[libvirt] [PATCH v2] qemu: command: align disk serial check to schema
by Nikolay Shirokovskiy
Disk serial schema has extra '.+' allowed characters in comparison
with check in code. Looks like there is no reason for that as qemu
allows any character AFAIK for serial. This discrepancy is originated
in 85d15b51 where ability to add serial was added.
---
Diff from v1:
* fix xml2argv disk serial test to use all valid chars
Looks like there is no existing infrastructure to test every invalid character.
src/qemu/qemu_command.c | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c76f923..c5369b0 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -432,7 +432,7 @@ qemuBuildIoEventFdStr(virBufferPtr buf,
}
#define QEMU_SERIAL_PARAM_ACCEPTED_CHARS \
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ "
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ .+"
static int
qemuSafeSerialParamValue(const char *value)
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args
index 2cefdca..fa0fc93 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.args
@@ -18,6 +18,6 @@ QEMU_AUDIO_DRV=none \
-boot c \
-usb \
-drive 'file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-1,\
-serial=\ \ WD-WMAP9A966149' \
+serial=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_\ .+' \
-device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml
index 565462e..d54d73b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-serial.xml
@@ -17,7 +17,7 @@
<disk type='block' device='disk'>
<source dev='/dev/HostVG/QEMUGuest1'/>
<target dev='hda' bus='ide'/>
- <serial> WD-WMAP9A966149</serial>
+ <serial>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ .+</serial>
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
<controller type='usb' index='0'/>
--
1.8.3.1
7 years, 4 months
[libvirt] [PATCH v4 00/17] virObject adjustments for common object
by John Ferlan
v3: https://www.redhat.com/archives/libvir-list/2017-June/msg00916.html
Changes since v3 - honestly it's been too long to remember exactly
what changes have taken place. This series provide the util/virobject
changes and the implementation for nodedev, secret, interface, and
network drivers/vir*obj's. The nwfilter is awaiting more upstream
review and work and some more Storage Pool/Volume patches will be
posted in conjunction with these. These changes also use the rwlocks
Michal recently added to virobject as the means to provide locks
for the LookupHash table(s).
Although I understand it's not the preference of one reviewer, I've
kept with the virObject model. If that still doesn't pass muster and
someone else wants to create some other mechanism to combine the existing
drivers in a more sane manner, then have at it. This is the model I've
chosen. I personally don't see the value in just a shim API.
This set of patches moves away from using a strict "uuid/name" designation
in favor of using "key1" and "key2". While some may find that "too generic",
I think that's the whole purpose of it. After some soul searching I feel
using "name" or "uuid" is too restrictive and lends more towards the shim
API model. Besides for some consumers they don't have a uuid (nodedev,
interface, and nwfilter). In the long run it doesn't matter whether it's
a uuid, name, or whatever as long as it's a character string.
FWIW:
Patches 1, 12, and 16 could be easily separated out, but since I was
working in the area - they were added here as well.
John Ferlan (17):
util: Use VIR_ERROR instead of VIR_WARN
util: Introduce virObjectLookupKeys
util: Introduce virObjectLookupHash
util: Introduce virObjectLookupKeys*Active API's
util: Introduce virObjectLookupHash{Add|Remove}
util: Introduce virObjectLookupHashFind[Locked]
util: Introduce virObjectLookupHashForEach
util: Introduce virObjectLookupHashSearch[Locked]
nodedev: Use virObjectLookup{Keys|Hash}
secret: Use virObjectLookup{Keys|Hash}
util: Introduce virObjectLookupHashClone
Revert "interface: Consume @def in virInterfaceObjNew"
interface: Use virObjectLookup{Keys|Hash}
test: Clean up test driver Interface interactions
util: Introduce virObjectLookupHashPrune
network: Fix virNetworkObjBridgeInUse return type
network: Use virObjectLookup{Keys|Hash}
src/conf/virinterfaceobj.c | 301 ++++++++++----------
src/conf/virnetworkobj.c | 293 ++++++--------------
src/conf/virnetworkobj.h | 5 +-
src/conf/virnodedeviceobj.c | 286 ++++++-------------
src/conf/virsecretobj.c | 263 +++++-------------
src/libvirt_private.syms | 15 +
src/test/test_driver.c | 55 +---
src/util/virobject.c | 658 +++++++++++++++++++++++++++++++++++++++++++-
src/util/virobject.h | 119 ++++++++
tests/networkxml2conftest.c | 4 +-
10 files changed, 1190 insertions(+), 809 deletions(-)
--
2.9.4
7 years, 4 months
[libvirt] [PATCH 00/17] chardev parsing cleanup and improvements
by Pavel Hrdina
Pavel Hrdina (17):
tests: introduce genericxml test for TCP chardev
tests: introduce genericxml test for UDP chardev
tests: introduce genericxml test for UNIX chardev
conf: switch from while to for loop for chardev parsing
conf: error out for multiple source elements while parsing chardev
conf: error out for multiple log elements while parsing chardev
conf: error out for multiple protocol elements while parsing chardev
conf: move chardev protocol parsing to separate function
conf: move chardev log parsing to separate function
conf: move mode parsing of chardev source to separate function
conf: move TCP chardev source parsing to separate function
conf: move UDP chardev source parsing to separate function
conf: move UNIX chardev source parsing to separate function
conf: assign parsed strings directly into chardev source definition
conf: move FILE chardev source parsing to separate function
conf: separate PTY chardev source parsing
conf: move chardev validation into virDomainDeviceDefValidateInternal
src/conf/domain_conf.c | 700 ++++++++++++---------
.../generic-chardev-tcp-missing-host.xml | 25 +
.../generic-chardev-tcp-missing-service.xml | 25 +
.../generic-chardev-tcp-multiple-source.xml | 26 +
tests/genericxml2xmlindata/generic-chardev-tcp.xml | 32 +
...generic-chardev-udp-missing-connect-service.xml | 24 +
.../generic-chardev-udp-multiple-source.xml | 26 +
tests/genericxml2xmlindata/generic-chardev-udp.xml | 47 ++
.../generic-chardev-unix-redirdev-missing-path.xml | 24 +
.../generic-chardev-unix-rng-missing-path.xml | 25 +
...generic-chardev-unix-smartcard-missing-path.xml | 23 +
.../genericxml2xmlindata/generic-chardev-unix.xml | 43 ++
.../genericxml2xmloutdata/generic-chardev-tcp.xml | 35 ++
.../genericxml2xmloutdata/generic-chardev-udp.xml | 47 ++
.../genericxml2xmloutdata/generic-chardev-unix.xml | 44 ++
tests/genericxml2xmltest.c | 20 +
16 files changed, 875 insertions(+), 291 deletions(-)
create mode 100644 tests/genericxml2xmlindata/generic-chardev-tcp-missing-host.xml
create mode 100644 tests/genericxml2xmlindata/generic-chardev-tcp-missing-service.xml
create mode 100644 tests/genericxml2xmlindata/generic-chardev-tcp-multiple-source.xml
create mode 100644 tests/genericxml2xmlindata/generic-chardev-tcp.xml
create mode 100644 tests/genericxml2xmlindata/generic-chardev-udp-missing-connect-service.xml
create mode 100644 tests/genericxml2xmlindata/generic-chardev-udp-multiple-source.xml
create mode 100644 tests/genericxml2xmlindata/generic-chardev-udp.xml
create mode 100644 tests/genericxml2xmlindata/generic-chardev-unix-redirdev-missing-path.xml
create mode 100644 tests/genericxml2xmlindata/generic-chardev-unix-rng-missing-path.xml
create mode 100644 tests/genericxml2xmlindata/generic-chardev-unix-smartcard-missing-path.xml
create mode 100644 tests/genericxml2xmlindata/generic-chardev-unix.xml
create mode 100644 tests/genericxml2xmloutdata/generic-chardev-tcp.xml
create mode 100644 tests/genericxml2xmloutdata/generic-chardev-udp.xml
create mode 100644 tests/genericxml2xmloutdata/generic-chardev-unix.xml
--
2.13.5
7 years, 4 months