[libvirt] [PATCH 00/11] caps: various internal cleanups
by Cole Robinson
First two patches are straight bug fixes.
The rest is a bunch of internal cleanup I felt compelled to do. Summary is
- Switch caps and domain to use an enum for os.type value (hvm, xen, exe, ...)
- Switch caps to use VIR_DOMAIN_VIRT* internally
- Add a single function for looking up domain XML relevant values from capabilities, and test the crap out of it.
- Use that function to simplfy and improve a lot of code.
Thanks,
Cole
Cole Robinson (11):
domain: conf: Better errors on bad os <type> values
domain: conf: Don't validate VM ostype/arch at daemon startup
caps: Use an enum internally for ostype value
caps: Switch AddGuest to take VIR_DOMAIN_OSTYPE value
domain: Convert os.type to VIR_DOMAIN_OSTYPE enum
caps: Convert to use VIR_DOMAIN_VIRT internally
caps: Add virCapabilitiesDomainDataLookup
domain: conf: Do ostype/arch/machine parsing earlier
domain: conf: Use CapabilitiesDomainDataLookup for caps validation
caps: Use DomainDataLookup to replace GuestDefault*
domain: conf: Drop expectedVirtTypes
src/bhyve/bhyve_capabilities.c | 6 +-
src/bhyve/bhyve_driver.c | 5 -
src/conf/capabilities.c | 307 ++++++++++++--------------
src/conf/capabilities.h | 50 ++---
src/conf/domain_audit.c | 2 +-
src/conf/domain_conf.c | 331 +++++++++++------------------
src/conf/domain_conf.h | 25 ++-
src/conf/snapshot_conf.c | 18 +-
src/conf/snapshot_conf.h | 2 -
src/esx/esx_driver.c | 12 +-
src/hyperv/hyperv_driver.c | 4 +-
src/libvirt_private.syms | 6 +-
src/libxl/libxl_conf.c | 14 +-
src/libxl/libxl_domain.c | 7 +-
src/libxl/libxl_driver.c | 8 +-
src/libxl/libxl_migration.c | 2 -
src/lxc/lxc_conf.c | 8 +-
src/lxc/lxc_controller.c | 1 -
src/lxc/lxc_driver.c | 7 +-
src/lxc/lxc_native.c | 4 +-
src/openvz/openvz_conf.c | 7 +-
src/openvz/openvz_driver.c | 7 +-
src/parallels/parallels_driver.c | 23 +-
src/parallels/parallels_sdk.c | 6 +-
src/parallels/parallels_utils.h | 2 +-
src/phyp/phyp_driver.c | 10 +-
src/qemu/qemu_capabilities.c | 21 +-
src/qemu/qemu_command.c | 29 +--
src/qemu/qemu_domain.c | 1 -
src/qemu/qemu_domain.h | 6 -
src/qemu/qemu_driver.c | 14 +-
src/qemu/qemu_migration.c | 5 +-
src/security/virt-aa-helper.c | 9 +-
src/test/test_driver.c | 12 +-
src/uml/uml_conf.c | 4 +-
src/uml/uml_driver.c | 6 +-
src/util/virerror.c | 5 +-
src/vbox/vbox_common.c | 23 +-
src/vmware/vmware_conf.c | 8 +-
src/vmware/vmware_driver.c | 4 +-
src/vmx/vmx.c | 3 +-
src/xen/xen_driver.c | 5 +-
src/xen/xen_hypervisor.c | 4 +-
src/xen/xend_internal.c | 6 +-
src/xenapi/xenapi_driver.c | 20 +-
src/xenapi/xenapi_utils.c | 4 +-
src/xenconfig/xen_common.c | 64 +++---
src/xenconfig/xen_sxpr.c | 5 +-
src/xenconfig/xen_xl.c | 17 +-
src/xenconfig/xen_xm.c | 12 +-
tests/Makefile.am | 8 +-
tests/domainconftest.c | 3 +-
tests/domainsnapshotxml2xmltest.c | 1 -
tests/lxcxml2xmltest.c | 1 -
tests/openvzutilstest.c | 2 +-
tests/qemuagenttest.c | 1 -
tests/qemuhotplugtest.c | 1 -
tests/qemuxml2argvtest.c | 1 -
tests/qemuxml2xmltest.c | 3 +-
tests/qemuxmlnstest.c | 1 -
tests/securityselinuxlabeldata/chardev.xml | 2 +-
tests/securityselinuxlabeldata/disks.xml | 2 +-
tests/securityselinuxlabeldata/kernel.xml | 2 +-
tests/securityselinuxlabeldata/nfs.xml | 2 +-
tests/securityselinuxlabeltest.c | 4 +-
tests/testutils.c | 8 +-
tests/testutilslxc.c | 10 +-
tests/testutilsqemu.c | 38 ++--
tests/testutilsxen.c | 18 +-
tests/vircapstest.c | 209 +++++++++++++++++-
tests/vmx2xmltest.c | 8 +-
tests/xlconfigtest.c | 1 -
tests/xmconfigtest.c | 1 -
tests/xml2sexprtest.c | 1 -
tests/xml2vmxtest.c | 9 +-
75 files changed, 742 insertions(+), 756 deletions(-)
--
2.3.5
9 years, 7 months
[libvirt] [PATCH v3 0/6] Implement Add/Del IOThreads
by John Ferlan
v2:
http://www.redhat.com/archives/libvir-list/2015-April/msg00426.html
Differences:
Patch 1 (old patch 3):
- virDomainIOThreadIDDefParseXML:
- Fix error message for <id> (was element, change to attribute for
<iothread> element)
- Silently bump the 'def->iothreads' count if there are a more
<iothreadid> elements found than def->iothreads defined rather than
causing an error
- virDomainIOThreadIDAdd
- Just use VIR_APPEND_ELEMENT - no need for empty array check
- Remove virDomainIOThreadIDIsDuplicate
- Since it was doing essentially the same as virDomainIOThreadIDFind
- Replace callers of IDIsDuplicate with the IDFind
- Remove 'name' from _virDomainIOThreadIDDef causes ripple effect...
- formatdomain.html.in and docs/schemas/domaincommon.rng
- No need for virDomainIOThreadIDDefFree
- Change of parameters to virDomainIOThreadIDAdd
- Remove parse in virDomainIOThreadIDDefParseXML
- Remove format in virDomainDefFormatInternal
- Remove virDomainIOThreadIDDefFree
- Unnecessary since 'name' is removed
Patch 2 (merged old patch 4 & 5)
- Add 'thread_id' to virDomainIOThreadIDDef and remove from
_qemuDomainObjPrivate. Adjust qemuDomainObjPrivateFree,
qemuDomainObjPrivateXMLFormat, and qemuDomainObjPrivateXMLParse
to remove the the iothreadpids usage. Rely on saved domain XML
for the 'live' data.
- Use vm->def->niothreadids instead of priv->niothreadpids
- Remove a couple of (now) unnecessary checks where priv->[n]iothreadpids
was referenced. Now we now that at XMLParse we've created the
[vm->]def->iothreadids with enough elements to satisfy the maximum
of def->iothreads and def->niothreadids, so no need to check if it
exists like we had to for priv->iothreadpids
Patch 3 (old patch 6)
- Remove 'name' from virDomainAddIOThread
- Fix comments in virDomainIOThreadAdd and virDomainIOThreadDel
- Remove if ((unsigned short) iothread_id != iothread_id) check
Patch 4 (old patch 7)
- Remove 'name' from remote_domain_add_iothread_args and
remote_domain_add_iothread_args
Patch 5 (old patch 8)
- Split qemuDomainHotplugIOThread into qemuDomainHotplugAddIOThread and
qemuDomainHotplugDelIOThread
- Removed extraneous comments
- Moved active domain check to after job starts and only for LIVE
- Removed the virResetLastError if qemuMonitorGetIOThreads fails
- Didn't touch the Numatune change - that can be resolved separately
- For the Add case, there was a comment about already having the data
which while true, we don't know where in the returned qemu iothreads
list the new IOThread was added, so we have to find it in the list so
we can get the thread_id so save once we create the element in the
iothreadids list.
- Moved where the virDomainLiveConfigHelperMethod was called
- For an inactive config - we can add iothreads and iothreadids, when/if
someone starts the guest, then they'll get the bad news if the right
emulator wasn't available.
- Handling LIVE before CONFIG just seemed to be the norm for commands
that I looked at, so I left it that way.
Patch 6 (old patch 9)
- Remove "name" (avoided the one comment from the review)
John Ferlan (6):
conf: Add new domain XML element 'iothreadids'
qemu: Use domain iothreadids to IOThread's 'thread_id'
Implement virDomainAddIOThread and virDomainDelIOThread
remote: Add support for AddIOThread and DelIOThread
qemu: Add support to Add/Delete IOThreads
virsh: Add iothreadadd and iothreaddel commands
docs/formatdomain.html.in | 30 ++
docs/schemas/domaincommon.rng | 12 +
include/libvirt/libvirt-domain.h | 6 +
src/conf/domain_audit.c | 9 +
src/conf/domain_audit.h | 6 +
src/conf/domain_conf.c | 190 ++++++++-
src/conf/domain_conf.h | 16 +
src/driver-hypervisor.h | 12 +
src/libvirt-domain.c | 118 ++++++
src/libvirt_private.syms | 4 +
src/libvirt_public.syms | 6 +
src/qemu/qemu_cgroup.c | 22 +-
src/qemu/qemu_command.c | 38 +-
src/qemu/qemu_command.h | 3 +
src/qemu/qemu_domain.c | 36 --
src/qemu/qemu_domain.h | 3 -
src/qemu/qemu_driver.c | 466 ++++++++++++++++++++-
src/qemu/qemu_process.c | 37 +-
src/remote/remote_driver.c | 2 +
src/remote/remote_protocol.x | 30 +-
src/remote_protocol-structs | 12 +
.../qemuxml2argv-iothreads-ids-partial.args | 10 +
.../qemuxml2argv-iothreads-ids-partial.xml | 33 ++
.../qemuxml2argv-iothreads-ids.args | 8 +
.../qemuxml2argv-iothreads-ids.xml | 33 ++
tests/qemuxml2argvtest.c | 2 +
tests/qemuxml2xmltest.c | 2 +
tools/virsh-domain.c | 164 ++++++++
tools/virsh.pod | 31 ++
29 files changed, 1239 insertions(+), 102 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-ids-partial.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-ids-partial.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-ids.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-ids.xml
--
2.1.0
9 years, 7 months
[libvirt] [PATCH v2 0/2] QoS: Adapt to changing MAC
by Michal Privoznik
Diff to v1:
- Laine's comments worked in
Michal Privoznik (2):
virDomainActualNetDefContentsFormat: Format class_id only for status
XML
processNicRxFilterChangedEvent: Take appropriate actions for
NET_TYPE_NETWORK too
src/conf/domain_conf.c | 3 ++-
src/qemu/qemu_driver.c | 12 ++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
--
2.0.5
9 years, 7 months
[libvirt] [PATCH] spec: If installing default network, reload libvirtd (bz 867546)
by Cole Robinson
If libvirt-daemon-config-network is installed while libvirtd is already
running, the daemon needs to be restarted to pick up the change.
Instead let's trigger a daemon reload when the package is first installed.
Then the default network is available immediately if libvirtd was already
running.
https://bugzilla.redhat.com/show_bug.cgi?id=867546
---
libvirt.spec.in | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index e08c9e7..ada0257 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1770,6 +1770,14 @@ if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ;
< %{_datadir}/libvirt/networks/default.xml \
> %{_sysconfdir}/libvirt/qemu/networks/default.xml
ln -s ../default.xml %{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
+
+ # Make sure libvirt picks up the new network defininiton
+ %if %{with_systemd}
+ /bin/systemctl reload libvirtd.service >/dev/null 2>&1 ||:
+ %else
+ /sbin/service libvirtd reload > /dev/null 2>&1 || :
+ %endif
+
fi
%endif
--
2.3.5
9 years, 7 months
[libvirt] [PATCH] qemu: Always refresh capabilities if no <guests> found (bz 1000116)
by Cole Robinson
- Remove all qemu emulators
- Restart libvirtd
- Install qemu emulators
- Call 'virsh version' -> errors
The only thing that will force the qemu driver to refresh it's cached
capablities info is an explict API call to GetCapabilities.
However in the case when the initial caps lookup at driver connect didn't
find a single qemu emulator to poll, the driver is effectively useless
and really can't do anything until it's populated some qemu capabilities
info.
With the above steps, the user would have to either know about the
magic refresh capabilities call, or restart libvirtd to pick up the
changes.
Instead, this patch changes things so that every time a part of th
driver requests access to capabilities info, check to see if
we've previously seen any emulators. If not, force a refresh.
In the case of 'still no emulators found', this is still very quick, so
I can't think of a downside.
https://bugzilla.redhat.com/show_bug.cgi?id=1000116
---
src/qemu/qemu_conf.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 2cf3905..b662b69 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -965,6 +965,13 @@ virCapsPtr virQEMUDriverGetCapabilities(virQEMUDriverPtr driver,
qemuDriverLock(driver);
}
+ if (driver->caps->nguests == 0 && !refresh) {
+ VIR_DEBUG("Capabilities didn't detect any guests. Forcing a "
+ "refresh.");
+ qemuDriverUnlock(driver);
+ return virQEMUDriverGetCapabilities(driver, true);
+ }
+
ret = virObjectRef(driver->caps);
qemuDriverUnlock(driver);
return ret;
--
2.3.5
9 years, 7 months
[libvirt] [PATCH] vircapstest: fix build without LXC
by Roman Bogorodskiy
When building without lxc support enabled, build fails with:
CLD vircapstest
vircapstest.o: In function `test_virCapsDomainDataLookupLXC':
vircapstest.c:(.text+0x9ef): undefined reference to `testLXCCapsInit'
Fix that by hiding LXC tests under appropriate #ifdef.
---
tests/vircapstest.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/vircapstest.c b/tests/vircapstest.c
index 3e5038b..b2c321e 100644
--- a/tests/vircapstest.c
+++ b/tests/vircapstest.c
@@ -289,6 +289,7 @@ test_virCapsDomainDataLookupXen(const void *data ATTRIBUTE_UNUSED)
return ret;
}
+#ifdef WITH_LXC
static int
test_virCapsDomainDataLookupLXC(const void *data ATTRIBUTE_UNUSED)
{
@@ -311,6 +312,7 @@ test_virCapsDomainDataLookupLXC(const void *data ATTRIBUTE_UNUSED)
virObjectUnref(caps);
return ret;
}
+#endif /* WITH_LXC */
static int
mymain(void)
@@ -326,9 +328,11 @@ mymain(void)
if (virtTestRun("virCapsDomainDataLookupXen",
test_virCapsDomainDataLookupXen, NULL) < 0)
ret = -1;
+#ifdef WITH_LXC
if (virtTestRun("virCapsDomainDataLookupLXC",
test_virCapsDomainDataLookupLXC, NULL) < 0)
ret = -1;
+#endif /* WITH_LXC */
return ret;
}
--
2.3.5
9 years, 7 months
[libvirt] [PATCH v4 0/4] storage: handle scsi/iscsi error paths better
by John Ferlan
v3 here:
http://www.redhat.com/archives/libvir-list/2015-April/msg00240.html
changes:
Patch 1: (prior patch 1)
Adjustments from code review - mostly just creating a new function
using the "const char *" path instead of pool pointer. Called only
from virStorageBackendStablePath
Patch 2: (prior patch 3)
Rather than continue to try to talk through the v3, here's the latest
changes. These will just check in the SCSINewLun if the source pool
target path doesn't start with /dev, then to just fail. This includes
if the path is "/dev" or "/dev/". Theory for failure is that even if
we allowed "/dev" or "/dev/" to continue down into the call to
virStorageBackendStablePath all we'd get back was the duplicated
'devpath' which we'd claim was non-fatal.
Patch 3: (NEW)
Adjust virStorageBackendSCSIFindLUs to return a count of LU's found
rather than the current "0" or -1" with a setting of the boolean found
(which gets ignored in most cases). By returning a count, 0, or -1 the
caller can decide what to do with the data.
Patch 4: (prior patch 4)
Couple of minor changes regarding comments and the use of a goto instead
of if then else in processLU retval checks. Kept the flow as previous
including using 'retval' in virStorageBackendSCSIFindLUs rather than
creating yet another local status that would need to be checked.
John Ferlan (4):
storage: Split out the valid path check
scsi: Adjust return value for virStorageBackendSCSINewLun
scsi: Change return values for virStorageBackendSCSIFindLUs
scsi: Adjust return values from processLU
src/storage/storage_backend.c | 26 +++++-----
src/storage/storage_backend.h | 1 +
src/storage/storage_backend_scsi.c | 101 ++++++++++++++++++++++++-------------
3 files changed, 79 insertions(+), 49 deletions(-)
--
2.1.0
9 years, 7 months
[libvirt] [PATCH] xend: Remove a couple of unused function prototypes.
by Richard W.M. Jones
Commit 70f446631f142ae92b4d4eb349fcf11408171556 (from 2008) introduced
some functions for testing whether xend was returning correct sound
models. Those functions have long gone, but the function prototypes
remain. This commit removes the unused prototypes.
Signed-off-by: Richard W.M. Jones <rjones(a)redhat.com>
---
src/xen/xend_internal.h | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
index 814330d..9064b47 100644
--- a/src/xen/xend_internal.h
+++ b/src/xen/xend_internal.h
@@ -84,10 +84,6 @@ xenDaemonDomainFetch(virConnectPtr xend,
const char *cpus);
- int is_sound_model_valid(const char *model);
- int is_sound_model_conflict(const char *model, const char *soundstr);
-
-
/* refactored ones */
int xenDaemonOpen(virConnectPtr conn, virConnectAuthPtr auth,
unsigned int flags);
--
2.3.1
9 years, 7 months
[libvirt] [PATCH 0/2] rework the check for the numa cpus
by Luyao Huang
We introduce a check for numa cpu total count in 5f7b71,
But seems this check cannot work well. There are some scenarioes:
1. one of cpu id is out of maxvcpus, can set success(cpu count = 5 < 10):
<vcpu placement='static'>10</vcpu>
<cell id='0' cpus='0-3,100' memory='512000' unit='KiB'/>
the cpus '100' exceed maxvcpus, this setting is not valid (although qemu
do not output error).
2. use the same cpu in 2 cell, can set success(cpu count = 8 < 10):
<vcpu placement='static'>10</vcpu>
<cell id='0' cpus='0-3' memory='512000' unit='KiB'/>
<cell id='1' cpus='0-3' memory='512000' unit='KiB'/>
I guess nobody will use this setting if he really want use numa in his
vm. (qemu not output error, but we can find some interesting things in
vm, all cpus have bind in one numa node)
3. use the same cpu in 2 cell, cannot set success(cpu count = 11 > 10):
<vcpu placement='static'>10</vcpu>
<cell id='0' cpus='0-6' memory='512000' unit='KiB'/>
<cell id='1' cpus='0-3' memory='512000' unit='KiB'/>
No need forbid this scenario if scenario 2 is a 'valid' setting.
However add new check during parse xml will make vm has broken settings
disappear after update libvirtd, so possible solutions:
1. add new check when parse xml, and find a way to avoid vm evaporate.
I chose this way and i don't think just drop the invalid settings is a good
idea for numa cpus, so i add a new function.
2. add new check when start vm.
I think this is a configuration issue, so no need report it so late.
3. just remove this check and do not add new check... :)
Luyao Huang (2):
conf: introduce a new function to add check avoid losing track
conf: rework the cpu check for vm numa settings
src/bhyve/bhyve_driver.c | 4 ++--
src/conf/domain_conf.c | 21 ++++++++++++++-------
src/conf/domain_conf.h | 1 +
src/conf/numa_conf.c | 37 ++++++++++++++++++++++++++++++-------
src/conf/numa_conf.h | 2 +-
src/esx/esx_driver.c | 2 +-
src/libxl/libxl_driver.c | 4 ++--
src/lxc/lxc_driver.c | 4 ++--
src/openvz/openvz_driver.c | 4 ++--
src/parallels/parallels_driver.c | 2 +-
src/phyp/phyp_driver.c | 2 +-
src/qemu/qemu_driver.c | 4 ++--
src/test/test_driver.c | 4 ++--
src/uml/uml_driver.c | 4 ++--
src/vbox/vbox_common.c | 2 +-
src/vmware/vmware_driver.c | 4 ++--
src/xen/xen_driver.c | 4 ++--
src/xenapi/xenapi_driver.c | 4 ++--
18 files changed, 70 insertions(+), 39 deletions(-)
--
1.8.3.1
9 years, 7 months
[libvirt] [PATCH] lxc: fix 2 issue around cpuset
by Luyao Huang
There are two bugs in this function:
1. cannot start a vm with cpuset but without numatune settings
# virsh -c lxc:/// start helloworld
error: Failed to start domain helloworld
error: internal error: guest failed to start: Invalid value '1-3' for 'cpuset.mems': Invalid argument
we don't free &mask after use it for virCgroupSetCpusetCpus() and
then virDomainNumatuneMaybeFormatNodeset() do not get a new &mask,
then we use it in virCgroupSetCpusetMems().
2. when start a lxc with numatune memory mode not strict
# virsh -c lxc:/// start helloworld
error: Failed to start domain helloworld
error: internal error: guest failed to start: Unknown failure in libvirt_lxc startup
We shouldn't set anything in cpuset.mems for these mode.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/lxc/lxc_cgroup.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
index c1813e2..5e959a2 100644
--- a/src/lxc/lxc_cgroup.c
+++ b/src/lxc/lxc_cgroup.c
@@ -77,11 +77,15 @@ static int virLXCCgroupSetupCpusetTune(virDomainDefPtr def,
if (virCgroupSetCpusetCpus(cgroup, mask) < 0)
goto cleanup;
+ /* free mask to make sure we won't use it in a wrong way later */
+ VIR_FREE(mask);
}
if (virDomainNumatuneGetMode(def->numa, -1) !=
- VIR_DOMAIN_NUMATUNE_MEM_STRICT)
+ VIR_DOMAIN_NUMATUNE_MEM_STRICT) {
+ ret = 0;
goto cleanup;
+ }
if (virDomainNumatuneMaybeFormatNodeset(def->numa, nodemask,
&mask, -1) < 0)
--
1.8.3.1
9 years, 7 months