[libvirt] [PATCH 0/3] Clean up some virstorageencryption code
by John Ferlan
While working through adding luks support for libvirt, I have a few patches
that aren't really germane to adding support and rather than drop a large
patch series when I'm done - I figured I'd post a few adjustments.
In the long run the encryption code probably doesn't work, but I'm trying
to move it to the side at least.
John Ferlan (3):
util: Clean up code formatting in virstorageencryption
storage: Split out setting default secret for encryption
storage: Split out a helper for encryption checks
src/storage/storage_backend.c | 80 ++++++++++++++++++++++++++--------------
src/storage/storage_backend_fs.c | 79 ++++++++++++++++++++++++---------------
src/util/virstorageencryption.c | 58 ++++++++++++++---------------
3 files changed, 128 insertions(+), 89 deletions(-)
--
2.5.5
8 years, 10 months
[libvirt] [PATCH 0/2] Fix a virperf related crasher
by Michal Privoznik
I've ran into a crasher. Worse crasher over RO connection.
Michal Privoznik (2):
Drop virPerfGetEventFd
virPerfEventIsEnabled: Don't crash on shut off domains
src/libvirt_private.syms | 1 -
src/util/virperf.c | 22 +++-------------------
src/util/virperf.h | 3 ---
3 files changed, 3 insertions(+), 23 deletions(-)
--
2.8.3
8 years, 10 months
[libvirt] Plan for the next release
by Daniel Veillard
I will be travelling end of this week and most of next week, but
I think we can still try to get a release for June 1st, I suggest:
- enter freeze this Thrusday 26
- Push an rc2 over the week-end
- try to push the 1.3.5 release on Wed June 1st
I hope this works for everybody !
Thanks,
Daniel
--
Daniel Veillard | Open Source and Standards, Red Hat
veillard(a)redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
8 years, 10 months
[libvirt] [PATCH v3] virDomainChrGetDomainPtrsInternal: Return an integer
by Michal Privoznik
There's this problem on the recent gcc-6.1:
In file included from conf/domain_conf.c:37:0:
conf/domain_conf.c: In function 'virDomainChrPreAlloc':
conf/domain_conf.c:14109:35: error: potential null pointer dereference [-Werror=null-dereference]
return VIR_REALLOC_N(*arrPtr, *cntPtr + 1);
^~
./util/viralloc.h:158:73: note: in definition of macro 'VIR_REALLOC_N'
# define VIR_REALLOC_N(ptr, count) virReallocN(&(ptr), sizeof(*(ptr)), (count), \
^~~~~
conf/domain_conf.c: In function 'virDomainChrRemove':
conf/domain_conf.c:14133:21: error: potential null pointer dereference [-Werror=null-dereference]
for (i = 0; i < *cntPtr; i++) {
^~~~~~~
GCC basically fails to see, that the
virDomainChrGetDomainPtrsInternal will never actually return NULL
because it's never called over a domain char device with _LAST
type. But to make it shut up, lets turn this function into
returning an integer and check in the callers if a zero value
value was returned.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
diff to v2:
- Yet another improvement as suggested in review of v2
src/conf/domain_conf.c | 39 +++++++++++++++++++++++----------------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7d46d0b..9f9fdf2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14038,7 +14038,7 @@ virDomainChrFind(virDomainDefPtr def,
/* Return the address within vmdef to be modified when working with a
* chrdefptr of the given type. */
-static void
+static int ATTRIBUTE_RETURN_CHECK
virDomainChrGetDomainPtrsInternal(virDomainDefPtr vmdef,
virDomainChrDeviceType type,
virDomainChrDefPtr ***arrPtr,
@@ -14048,28 +14048,30 @@ virDomainChrGetDomainPtrsInternal(virDomainDefPtr vmdef,
case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL:
*arrPtr = &vmdef->parallels;
*cntPtr = &vmdef->nparallels;
- break;
+ return 0;
case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL:
*arrPtr = &vmdef->serials;
*cntPtr = &vmdef->nserials;
- break;
+ return 0;
case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE:
*arrPtr = &vmdef->consoles;
*cntPtr = &vmdef->nconsoles;
- break;
+ return 0;
case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL:
*arrPtr = &vmdef->channels;
*cntPtr = &vmdef->nchannels;
- break;
+ return 0;
case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST:
- *arrPtr = NULL;
- *cntPtr = NULL;
break;
}
+
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown char device type: %d"), type);
+ return -1;
}
@@ -14085,14 +14087,13 @@ virDomainChrGetDomainPtrs(const virDomainDef *vmdef,
size_t *cntVar = NULL;
/* Cast away const; we add it back in the final assignment. */
- virDomainChrGetDomainPtrsInternal((virDomainDefPtr) vmdef, type,
- &arrVar, &cntVar);
- if (arrVar) {
+ if (virDomainChrGetDomainPtrsInternal((virDomainDefPtr) vmdef, type,
+ &arrVar, &cntVar) < 0) {
+ *arrPtr = NULL;
+ *cntPtr = 0;
+ } else {
*arrPtr = (const virDomainChrDef **) *arrVar;
*cntPtr = *cntVar;
- } else {
- *arrPtr = NULL;
- *cntPtr = 0;
}
}
@@ -14104,7 +14105,9 @@ virDomainChrPreAlloc(virDomainDefPtr vmdef,
virDomainChrDefPtr **arrPtr = NULL;
size_t *cntPtr = NULL;
- virDomainChrGetDomainPtrsInternal(vmdef, chr->deviceType, &arrPtr, &cntPtr);
+ if (virDomainChrGetDomainPtrsInternal(vmdef, chr->deviceType,
+ &arrPtr, &cntPtr) < 0)
+ return -1;
return VIR_REALLOC_N(*arrPtr, *cntPtr + 1);
}
@@ -14116,7 +14119,9 @@ virDomainChrInsertPreAlloced(virDomainDefPtr vmdef,
virDomainChrDefPtr **arrPtr = NULL;
size_t *cntPtr = NULL;
- virDomainChrGetDomainPtrsInternal(vmdef, chr->deviceType, &arrPtr, &cntPtr);
+ if (virDomainChrGetDomainPtrsInternal(vmdef, chr->deviceType,
+ &arrPtr, &cntPtr) < 0)
+ return;
VIR_APPEND_ELEMENT_INPLACE(*arrPtr, *cntPtr, chr);
}
@@ -14128,7 +14133,9 @@ virDomainChrRemove(virDomainDefPtr vmdef,
virDomainChrDefPtr ret = NULL, **arrPtr = NULL;
size_t i, *cntPtr = NULL;
- virDomainChrGetDomainPtrsInternal(vmdef, chr->deviceType, &arrPtr, &cntPtr);
+ if (virDomainChrGetDomainPtrsInternal(vmdef, chr->deviceType,
+ &arrPtr, &cntPtr) < 0)
+ return NULL;
for (i = 0; i < *cntPtr; i++) {
ret = (*arrPtr)[i];
--
2.8.3
8 years, 10 months
[libvirt] [PATCH 00/10] vz: improve locking in getting domain statistics
by Nikolay Shirokovskiy
Current stats cache uses same lock as domain cache, namely lock
of virDomainObjPtr. First this is not necessary, domain cache is
used to translate id of object of interest from libvirt to vzsdk
one. Besides this domain object is not used. Second this is risky
game as lock is dropped on waiting for stat events from sdk deep
down on stack so callers throughout the stack should be written
very carefully.
This patch series makes stats cache self locking and thus making
code much more solid. This is done thru introducing extra lock for
stats cache. Statistics API functions first use domain cache then
drop domain lock, query stats cache and unreference domain object.
Patches 1-4 conform API functions to this structure. Patches 5-7
makes subsidiary improvments. Patch 8 finally introduce new lock.
Last patches are cleanup[9] and bugfix[10].
Nikolay Shirokovskiy (10):
vz: pass string instead of disk definition to block stat function
vz: prepare disks names before getting all disks stats
vz: move getting stats in vzDomainGetVcpus to the end
vz: move getting stats in vzDomainGetInfo to the end
vz: use consistent naming for different domain object in vz_driver.c
vz: simplify refcount on sdkdom in prlsdkLoadDomain
vz: hold stats cache in a pointer in vzDomObj
vz: introduce stats cache lock
vz: extract on stats cache update into a function
vz: fix many stat request issue
src/vz/vz_driver.c | 397 +++++++++++++++++++++++++++++++++++------------------
src/vz/vz_sdk.c | 230 +++++++++++++++++++++----------
src/vz/vz_sdk.h | 15 +-
src/vz/vz_utils.c | 9 --
src/vz/vz_utils.h | 6 +-
5 files changed, 438 insertions(+), 219 deletions(-)
--
1.8.3.1
8 years, 10 months
[libvirt] libvirt-tck test failure after commit b3d06987
by Jim Fehlig
We've noticed libvirt-tck test 100-apply-verify-host.t failing recently on
libvirt.git master and I finally got around to bisecting it to commit b3d06987.
I haven't looked at the test in detail, but it appears to expect a broadcast
address of 10.1.2.255, however finds an address of 0.0.0.0 after commit
b3d06987. I'm not terribly familiar with this code, but the following hunk of
b3d06987 looks suspect
@@ -1039,21 +1039,28 @@ virNetDevCreateNetlinkAddressMessage(int messageType,
const char *ifname,
virSocketAddr *addr,
unsigned int prefix,
- virSocketAddr *broadcast)
+ virSocketAddr *broadcast,
+ virSocketAddr *peer)
{
struct nl_msg *nlmsg = NULL;
struct ifaddrmsg ifa;
unsigned int ifindex;
void *addrData = NULL;
+ void *peerData = NULL;
void *broadcastData = NULL;
size_t addrDataLen;
if (virNetDevGetIPAddressBinary(addr, &addrData, &addrDataLen) < 0)
return NULL;
- if (broadcast && virNetDevGetIPAddressBinary(broadcast, &broadcastData,
- &addrDataLen) < 0)
- return NULL;
+ if (peer && VIR_SOCKET_ADDR_VALID(peer)) {
+ if (virNetDevGetIPAddressBinary(peer, &peerData, &addrDataLen) < 0)
+ return NULL;
+ } else if (broadcast) {
+ if (virNetDevGetIPAddressBinary(broadcast, &broadcastData,
+ &addrDataLen) < 0)
+ return NULL;
+ }
/* Get the interface index */
if ((ifindex = if_nametoindex(ifname)) == 0)
Vasiliy, I can look in more detail tomorrow, but in the meantime any suggestions
you have would be much appreciated.
Regards,
Jim
8 years, 10 months
[libvirt] [PATCH v2 0/4] Final round of build fixes
by Michal Privoznik
diff to v1:
- Some patches from the original patch set are pushed now
- For the other ones, I've managed to work in review suggestions
Michal Privoznik (4):
virNetDevBridgeGet: Don't require users to virNetDevSetupControl
ppc64Compute: Avoid possible NULL dereference
virDomainChrGetDomainPtrsInternal: Return an integer
virDomainFormatSchedDef: Avoid false positive NULL dereference
src/conf/domain_conf.c | 44 ++++++++++++++++++++++++++++++--------------
src/cpu/cpu_ppc64.c | 12 ++++++------
src/util/virnetdevbridge.c | 35 ++++++++++++-----------------------
3 files changed, 48 insertions(+), 43 deletions(-)
--
2.8.3
8 years, 10 months
[libvirt] Python listDefinedDomains broken?
by Marc Richter
Hi everyone,
please, don't roast me if I'm asking stupid things or fail to provide
info, since I'm a freshman, using libvirt.
I have two servers, both running the following versions:
Compiled against library: libvirt 1.3.1
Using library: libvirt 1.3.1
Using API: QEMU 1.3.1
Running hypervisor: QEMU 0.14.0
I'm trying to create a Python program, which gets a list of all defined
domains for each host and give a list for domains only defined on one of
these hosts. This Python script is running on a third host (my
workstation), using these versions:
Python: 3.5.1
libvirt-python: 1.3.1
When I'm running virsh on my workstation (version 1.3.1), like this:
virsh -c
"qemu+ssh://root@host1/system?keyfile=/home/user/.ssh/id_rsa_libvirt"
--readonly list --all
Then a domain named "winxp_ausgeschaltet" is within that list:
Id Name State
----------------------------------------------------
...
- winxp_ausgeschaltet shut off
When I do the same for the second host, it is also in that list:
Id Name State
----------------------------------------------------
...
7 winxp_ausgeschaltet running
When I do the following in Python, this domain is listed for the first
host (where it's state is "shut off"), but not for the second one:
import libvirt
import sys
class kvmhost:
def __init__(self, host, keyfile):
self.conn = self.connect_kvm(host, keyfile)
self.doms = sorted(self.get_doms())
def connect_kvm(self, host, keyfile):
try:
conn = libvirt.openReadOnly('qemu+ssh://root@' + host +
'/system?keyfile=' + keyfile)
except libvirt.libvirtError as lve:
print('Error: ' + str(lve))
sys.exit(1)
return conn
def get_doms(self):
try:
alldoms = self.conn.listDefinedDomains()
except libvirt.libvirtError as lve:
print('Error: ' + str(lve))
self.conn.close()
sys.exit(1)
return alldoms
host1 = kvmhost('host1', '/path/to/ssh_keyfile')
host2 = kvmhost('host2', '/path/to/ssh_keyfile')
print(host1.doms)
print(host2.doms)
What am I doing wrong here or: is there a missbehavior in libvirt or the
python module?
Using listAllDomains instead of listDefinedDomains gives:
libvirt: Remote Driver error : unknown procedure: 273
What is the difference between listAllDomains and listDefinedDomains at all?
Thanks for your help.
Marc
8 years, 10 months
[libvirt] [PATCH v2 0/2] qemu: expand domain memory statistics
by Derbyshev Dmitriy
From: Derbyshev Dmitry <dderbyshev(a)virtuozzo.com>
QEMU reports timestamp and available along with other memory statistics.
This information was not saved into domain statistics.
Changes since v1:
* Enum numeration fixed
* Macro getting "usage" field fixed
Derbyshev Dmitry (2):
qemu: expand domain memory statistics with 'usable'
qemu: expand domain memory statistics with 'last-update' timestamp
include/libvirt/libvirt-domain.h | 11 ++++++++++-
src/libvirt-domain.c | 5 +++++
src/qemu/qemu_monitor_json.c | 23 +++++++++++++----------
tools/virsh-domain-monitor.c | 4 ++++
4 files changed, 32 insertions(+), 11 deletions(-)
--
1.9.5.msysgit.0
8 years, 10 months
[libvirt] [PATCH 0/4] Move secret object command line building helpers
by John Ferlan
More "extractable" changes from my work on adding luks support.
While working through changes in storage_backend.c I found that the
building of the 'qemu-img' command to create a luks volume will need
to create a secret object.
In order to do that I found if I took the qemu_command code and moved
things around a bit, then I would be able to access the API's that I
need. Moving the command line building from qemu_command.c to virjson.c
seemed logical since it was multipurpose/generic anyway. I'm not "tied"
to the API name chosen - if there's suggestions, I'll adjust. Then splitting
out the generation of the secret object props into their own API and then
eventually into secret_util.c seemed to be the best avenue. I can then
include secret_util into the storage driver.
The last change just cleans up the secinfo command building processing.
It was "complicated" when there was going to be hostdev and disk code
trying to generate the same objects... Now that just seems less important.
When/if iSCSI/hostdev support for the AES secret is added, I'll made the
appropriate adjustments then.
John Ferlan (4):
qemu: Move and rename qemuBuildObjectCommandlineFromJSON
qemu: Introduce qemuBuildSecretObjectProps
qemu: Move and rename qemuBuildSecretObjectProps
qemu: Rework secinfo command line building
src/libvirt_private.syms | 4 +-
src/qemu/qemu_command.c | 199 ++++++--------------------------------------
src/qemu/qemu_command.h | 4 -
src/secret/secret_util.c | 59 +++++++++++++
src/secret/secret_util.h | 10 +++
src/util/virjson.c | 117 +++++++++++++++++++++++++-
src/util/virjson.h | 12 ++-
tests/qemucommandutiltest.c | 7 +-
8 files changed, 219 insertions(+), 193 deletions(-)
--
2.5.5
8 years, 10 months