[libvirt] [PATCHv2] virsh: fix keepalive error msg, man page update
by Erik Skultety
resolves https://bugzilla.redhat.com/show_bug.cgi?id=1132305
---
tools/virsh.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 30a84c1..713c9a5 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -3470,18 +3470,32 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
exit(EXIT_SUCCESS);
break;
case 'k':
- if (virStrToLong_i(optarg, NULL, 0, &keepalive) < 0 ||
- keepalive < 0) {
- vshError(ctl, _("option %s requires a positive numeric argument"),
+ if (virStrToLong_i(optarg, NULL, 0, &keepalive) < 0) {
+ vshError(ctl,
+ _("Invalid value for option %s"),
+ longindex == -1 ? "-k" : "--keepalive-interval");
+ exit(EXIT_FAILURE);
+ }
+
+ if (keepalive < 0) {
+ vshError(ctl,
+ _("option %s requires a positive integer argument"),
longindex == -1 ? "-k" : "--keepalive-interval");
exit(EXIT_FAILURE);
}
ctl->keepalive_interval = keepalive;
break;
case 'K':
- if (virStrToLong_i(optarg, NULL, 0, &keepalive) < 0 ||
- keepalive < 0) {
- vshError(ctl, _("option %s requires a positive numeric argument"),
+ if (virStrToLong_i(optarg, NULL, 0, &keepalive) < 0) {
+ vshError(ctl,
+ _("Invalid value for option %s"),
+ longindex == -1 ? "-K" : "--keepalive-count");
+ exit(EXIT_FAILURE);
+ }
+
+ if (keepalive < 0) {
+ vshError(ctl,
+ _("option %s requires a positive integer argument"),
longindex == -1 ? "-K" : "--keepalive-count");
exit(EXIT_FAILURE);
}
--
1.9.3
10 years, 2 months
[libvirt] [PATCH] qemu: call endjob in RevertToSnapshot
by Jincheng Miao
In qemuDomainRevertToSnapshot(), it will check snap->def->state.
But when the state is PMSUSPENDED/NOSTATE/BLOCKED, it forgets to
call qemuDomainObjEndJob.
Signed-off-by: Jincheng Miao <jmiao(a)redhat.com>
---
src/qemu/qemu_driver.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f5b17ba..2db507f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14294,7 +14294,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("qemu doesn't support reversion of snapshot taken in "
"PMSUSPENDED state"));
- goto cleanup;
+ goto endjob;
case VIR_DOMAIN_NOSTATE:
case VIR_DOMAIN_BLOCKED:
@@ -14303,7 +14303,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
_("Invalid target domain state '%s'. Refusing "
"snapshot reversion"),
virDomainStateTypeToString(snap->def->state));
- goto cleanup;
+ goto endjob;
}
ret = 0;
--
1.7.1
10 years, 2 months
[libvirt] [PATCH 00/10] Resolve some Coverity found issues
by John Ferlan
After installing a new version of Coverity - my daily checker has found
many more (>140) "new" issues. Figured I'd start tackling the list bit
by bit. I didn't dig into when any of these were introduced - with so
many on the list it'd be overwhelming :-)
John Ferlan (10):
parallels: Resolve Coverity USE_AFTER_FREE
xen_common: Resolve Coverity USE_AFTER_FREE
xen_xm: Resolve Coverity USE_AFTER_FREE
storage_driver: Resolve Coverity REVERSE_INULL
domain_conf: Resolve Coverity REVERSE_INULL
qemu_command: Resolve Coverity REVERSE_INULL
domain_conf: Resolve Coverity REVERSE_INULL
qemu_driver: Resolve Coverity CONSTANT_EXPRESSION_RESULT
libxl_migration: Resolve Coverity NULL_RETURNS
qemu_capabilities: Resolve Coverity NULL_RETURNS
src/conf/domain_conf.c | 18 +++++++++---------
src/libxl/libxl_migration.c | 1 -
src/parallels/parallels_network.c | 4 +---
src/qemu/qemu_capabilities.c | 5 ++++-
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_driver.c | 4 ++--
src/storage/storage_driver.c | 6 ++++--
src/xenconfig/xen_common.c | 5 ++---
src/xenconfig/xen_xm.c | 1 +
9 files changed, 24 insertions(+), 22 deletions(-)
--
1.9.3
10 years, 2 months
[libvirt] [PREPOST] XL parser
by Kiarie Kahurani
Kiarie Kahurani (1):
src/xenconfig: XL parser
po/POTFILES.in | 1 +
src/Makefile.am | 3 +-
src/libvirt_xenconfig.syms | 5 +
src/libxl/libxl_driver.c | 44 ++-
src/xenconfig/xen_common.c | 140 ++++----
src/xenconfig/xen_common.h | 24 +-
src/xenconfig/xen_xl.c | 461 ++++++++++++++++++++++++++
src/xenconfig/xen_xl.h | 29 ++
tests/Makefile.am | 9 +-
tests/testutilsxen.c | 50 +++
tests/testutilsxen.h | 9 +-
tests/xlconfigdata/test-fullvirt-new-disk.cfg | 27 ++
tests/xlconfigdata/test-fullvirt-new-disk.xml | 46 +++
tests/xlconfigtest.c | 222 +++++++++++++
14 files changed, 981 insertions(+), 89 deletions(-)
create mode 100644 src/xenconfig/xen_xl.c
create mode 100644 src/xenconfig/xen_xl.h
create mode 100644 tests/xlconfigdata/test-fullvirt-new-disk.cfg
create mode 100644 tests/xlconfigdata/test-fullvirt-new-disk.xml
create mode 100644 tests/xlconfigtest.c
After *toooo* long the xen-xl parser has arrived with support for
xl disk format and spice graphics(with admittedly very kludgy code)
quick overview
1)coverts xl disk config such as
disk = ["/dev/sda,raw,hda,rw,"]
into xml config
<disk type='block' device='disk'>
<driver name='phy'/>
<source dev='/dev/sda/'>
<target dev= 'hda' bus='ide'/>
</disk>
and vice-versa
You notice that in the xl disk config there is no driver type but
it appears on the xml; I use the format to intelligently guess the
driver but this does not look very good again you notice I do not
support disk backend config which is because there is no member of
_virDomainDiskDef which I could relate to the backend
2)converts spice graphics config
spice = 1
spicehost = "127.0.0.1"
spiceport = 500
spicetls_port = 590
spicedisable_ticketing = 1 #with this set you require a passwd
spicepasswd = "thebeast"
spiceagent_mouse = 1
to
<graphics type='spice' port='500' tlsPort='590' autoport='no' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
<mouse mode='server'/>
and vice-versa
You notice that the passwd is not in the xml, am still trying to figure out why
Again you will notice the current tests are a bit dependent on xen code(when
initializing the xmlOpt) which would *better* be done away with but that would
require some code in src/libxl/
Into the bargain, am not *sure* how exactly to initialize _virCapsPtr which is
reqiured for xml formatting because I *assume* that tests should be able to run
even with drivers not loaded.
Am also not *sure* that how to map disks to device type, the existing code(xm)
code maps all the disks using another driver other than 'phy' to 'block'.Am not
sure this is correct.
With the current patch
$virsh domxml-from/to-native xen-xl works perfectly
TODO
Fix tests
--
1.8.4.5
10 years, 2 months
[libvirt] [PATCH 0/9] qemu: Introduce support for new the block_set_io_throttle parameters add in the version 1.7 of qemu.
by Matthias Gatto
This series of patches add suport for bps_max, bps_rd_max, bps_wr_max,
bps_max, bps_rd_max, bps_wr_max, and iops_size in the functions qemuDomainSetBlockIoTune,
and qemuDomainGetBlockIoTune.
The last patch add suport for therse parameters to the virsh blkdeviotune commande.
Matthias Gatto (9):
qemu: Add defines for the new throttle options
qemu: Add new throttle options to the structure
_virDomainBlockIoTuneInfo.
qemu: Add the capabilitie to detect if the qemu binary have the
capability to use bps_max and friends
qemu: Add bps_max and friends qemu driver
qemu: Add bps_max and friend to domain_conf
qemu: Add bps_max and friends QMP suport
qemu: Add bps_max and friends "text" suport
qemu: add bps_max and friends to qemu command genaration
qemu: Add bps_max and friends to virsh
include/libvirt/libvirt.h.in | 54 +++++++++++++++
src/conf/domain_conf.c | 89 +++++++++++++++++++++++-
src/conf/domain_conf.h | 8 +++
src/qemu/qemu_capabilities.c | 6 ++
src/qemu/qemu_capabilities.h | 2 +-
src/qemu/qemu_command.c | 49 ++++++++++++++
src/qemu/qemu_driver.c | 158 +++++++++++++++++++++++++++++++++++++++++--
src/qemu/qemu_monitor_json.c | 58 +++++++++++++---
src/qemu/qemu_monitor_text.c | 75 ++++++++++++++++++--
tests/qemumonitorjsontest.c | 2 +-
tools/virsh-domain.c | 119 ++++++++++++++++++++++++++++++++
11 files changed, 595 insertions(+), 25 deletions(-)
--
1.8.3.1
10 years, 2 months
[libvirt] [RFC] VIR_ERROR in detect_scsi_host_caps into warnings
by Cedric Bosdonnat
Hi all,
detect_scsi_host_caps function is called without caring of the result in
most cases. Wouldn't it be more logical to have VIR_ERRORs in this
function transformed into VIR_WARN as those problems aren't blocking
libvirt?
Note: I can do the (trivial) patch if the idea is ACKed.
--
Cedric
10 years, 2 months
[libvirt] [PATCH] virsh: fix keepalive error msg, man page update
by Erik Skultety
resolves https://bugzilla.redhat.com/show_bug.cgi?id=1132305
---
tools/virsh.c | 14 ++++++++++----
tools/virsh.pod | 6 ++++--
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 30a84c1..f9b3991 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -3472,8 +3472,11 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
case 'k':
if (virStrToLong_i(optarg, NULL, 0, &keepalive) < 0 ||
keepalive < 0) {
- vshError(ctl, _("option %s requires a positive numeric argument"),
- longindex == -1 ? "-k" : "--keepalive-interval");
+ vshError(ctl,
+ _("option %s requires a positive integer argument "
+ "within range <0,%d>"),
+ longindex == -1 ? "-k" : "--keepalive-interval",
+ INT_MAX);
exit(EXIT_FAILURE);
}
ctl->keepalive_interval = keepalive;
@@ -3481,8 +3484,11 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
case 'K':
if (virStrToLong_i(optarg, NULL, 0, &keepalive) < 0 ||
keepalive < 0) {
- vshError(ctl, _("option %s requires a positive numeric argument"),
- longindex == -1 ? "-K" : "--keepalive-count");
+ vshError(ctl,
+ _("option %s requires a positive integer argument "
+ "within range <0,%d>"),
+ longindex == -1 ? "-K" : "--keepalive-count",
+ INT_MAX);
exit(EXIT_FAILURE);
}
ctl->keepalive_count = keepalive;
diff --git a/tools/virsh.pod b/tools/virsh.pod
index e0dfd13..9bee664 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -77,13 +77,15 @@ given instead.
=item B<-k>, B<--keepalive-interval> I<INTERVAL>
Set an I<INTERVAL> (in seconds) for sending keepalive messages to
-check whether connection to the server is still alive. Setting the
+check whether connection to the server is still alive. I<INTERVAL>
+must be an integer value within range <0,INT_MAX>. Setting the
interval to 0 disables client keepalive mechanism.
=item B<-K>, B<--keepalive-count> I<COUNT>
Set a number of times keepalive message can be sent without getting an
-answer from the server without marking the connection dead. There is
+answer from the server without marking the connection dead. I<COUNT>
+must be an integer value within range <0,INT_MAX>. There is
no effect to this setting in case the I<INTERVAL> is set to 0.
=item B<-l>, B<--log> I<FILE>
--
1.9.3
10 years, 2 months
[libvirt] [PATCH for 1.2.8] conf: fix leak by freeing def->mem.hugepages
by Martin Kletzander
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/conf/domain_conf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3b295ab..d6fd1ab 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2136,6 +2136,8 @@ void virDomainDefFree(virDomainDefPtr def)
virDomainMemballoonDefFree(def->memballoon);
virDomainNVRAMDefFree(def->nvram);
+ VIR_FREE(def->mem.hugepages);
+
for (i = 0; i < def->nseclabels; i++)
virSecurityLabelDefFree(def->seclabels[i]);
VIR_FREE(def->seclabels);
--
2.1.0
10 years, 2 months
[libvirt] [PATCH] API: Tweak virDomainOpenGraphics to return fd directly
by Eric Blake
Let's fix this before we bake in a painful API. Since we know
that we have exactly one non-negative fd on success, we might
as well return the fd directly instead of forcing the user to
pass in a pointer. Fix a memory leak I found while reviewing.
* include/libvirt/libvirt.h.in (virDomainOpenGraphicsFD): Drop
unneeded parameter.
* src/driver.h (virDrvDomainOpenGraphicsFD): Likewise.
* src/libvirt.c (virDomainOpenGraphicsFD): Adjust interface to
return fd directly.
* daemon/remote.c (remoteDispatchDomainOpenGraphicsFd): Adjust
semantics.
* src/qemu/qemu_driver.c (qemuDomainOpenGraphicsFD): Likewise.
* src/remote/remote_driver.c (remoteDomainOpenGraphicsFD):
Likewise, and plug memory leak.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
daemon/remote.c | 9 +++++----
include/libvirt/libvirt.h.in | 1 -
src/driver.h | 1 -
src/libvirt.c | 14 ++++++--------
src/qemu/qemu_driver.c | 3 +--
src/remote/remote_driver.c | 17 +++++++++++------
6 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 27d1aa8..940dcfa 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -4419,10 +4419,9 @@ remoteDispatchDomainOpenGraphicsFd(virNetServerPtr server ATTRIBUTE_UNUSED,
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
goto cleanup;
- if (virDomainOpenGraphicsFD(dom,
- args->idx,
- &fd,
- args->flags) < 0)
+ if ((fd = virDomainOpenGraphicsFD(dom,
+ args->idx,
+ args->flags)) < 0)
goto cleanup;
if (virNetMessageAddFD(msg, fd) < 0)
@@ -4442,6 +4441,8 @@ remoteDispatchDomainOpenGraphicsFd(virNetServerPtr server ATTRIBUTE_UNUSED,
virDomainFree(dom);
return rv;
}
+
+
static int
remoteDispatchDomainGetInterfaceParameters(virNetServerPtr server ATTRIBUTE_UNUSED,
virNetServerClientPtr client ATTRIBUTE_UNUSED,
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 2a108b8..e79c9ad 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -5401,7 +5401,6 @@ int virDomainOpenGraphics(virDomainPtr dom,
int virDomainOpenGraphicsFD(virDomainPtr dom,
unsigned int idx,
- int *fd,
unsigned int flags);
int virDomainInjectNMI(virDomainPtr domain, unsigned int flags);
diff --git a/src/driver.h b/src/driver.h
index cd136ba..a7366e4 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -890,7 +890,6 @@ typedef int
typedef int
(*virDrvDomainOpenGraphicsFD)(virDomainPtr dom,
unsigned int idx,
- int *fd,
unsigned int flags);
typedef int
diff --git a/src/libvirt.c b/src/libvirt.c
index 772cc0d..7a3f01a 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -20305,11 +20305,10 @@ virDomainOpenGraphics(virDomainPtr dom,
* virDomainOpenGraphicsFD:
* @dom: pointer to domain object
* @idx: index of graphics config to open
- * @fd: returned file descriptor
* @flags: bitwise-OR of virDomainOpenGraphicsFlags
*
* This will create a socket pair connected to the graphics backend of @dom.
- * One socket will be returned as @fd.
+ * One end of the socket will be returned on success.
* If @dom has multiple graphics backends configured, then @idx will determine
* which one is opened, starting from @idx 0.
*
@@ -20320,21 +20319,18 @@ virDomainOpenGraphics(virDomainPtr dom,
* libvirt hypervisor, over a UNIX domain socket. Attempts
* to use this method over a TCP connection will always fail
*
- * Returns 0 on success, -1 on failure
+ * Returns an fd on success, -1 on failure
*/
int
virDomainOpenGraphicsFD(virDomainPtr dom,
unsigned int idx,
- int *fd,
unsigned int flags)
{
- VIR_DOMAIN_DEBUG(dom, "idx=%u, fd=%p, flags=%x",
- idx, fd, flags);
+ VIR_DOMAIN_DEBUG(dom, "idx=%u, flags=%x", idx, flags);
virResetLastError();
virCheckDomainReturn(dom, -1);
- virCheckNonNullArgGoto(fd, error);
virCheckReadOnlyGoto(dom->conn->flags, error);
@@ -20347,7 +20343,7 @@ virDomainOpenGraphicsFD(virDomainPtr dom,
if (dom->conn->driver->domainOpenGraphicsFD) {
int ret;
- ret = dom->conn->driver->domainOpenGraphicsFD(dom, idx, fd, flags);
+ ret = dom->conn->driver->domainOpenGraphicsFD(dom, idx, flags);
if (ret < 0)
goto error;
return ret;
@@ -20359,6 +20355,8 @@ virDomainOpenGraphicsFD(virDomainPtr dom,
virDispatchError(dom->conn);
return -1;
}
+
+
/**
* virConnectSetKeepAlive:
* @conn: pointer to a hypervisor connection
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5ff2059..57c999c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15808,7 +15808,6 @@ qemuDomainOpenGraphics(virDomainPtr dom,
static int
qemuDomainOpenGraphicsFD(virDomainPtr dom,
unsigned int idx,
- int *fd,
unsigned int flags)
{
virQEMUDriverPtr driver = dom->conn->privateData;
@@ -15871,7 +15870,7 @@ qemuDomainOpenGraphicsFD(virDomainPtr dom,
if (!qemuDomainObjEndJob(driver, vm))
vm = NULL;
- *fd = pair[0];
+ ret = pair[0];
cleanup:
if (ret < 0) {
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index e01216a..e949223 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -6448,7 +6448,6 @@ remoteDomainOpenGraphics(virDomainPtr dom,
static int
remoteDomainOpenGraphicsFD(virDomainPtr dom,
unsigned int idx,
- int *fd,
unsigned int flags)
{
int rv = -1;
@@ -6472,15 +6471,21 @@ remoteDomainOpenGraphicsFD(virDomainPtr dom,
goto done;
if (fdoutlen != 1) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("no file descriptor received"));
+ if (fdoutlen) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("too many file descriptors received"));
+ while (fdoutlen)
+ VIR_FORCE_CLOSE(fdout[--fdoutlen]);
+ } else {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("no file descriptor received"));
+ }
goto done;
}
- *fd = fdout[0];
-
- rv = 0;
+ rv = fdout[0];
done:
+ VIR_FREE(fdout);
remoteDriverUnlock(priv);
return rv;
--
1.9.3
10 years, 2 months
[libvirt] [PATCHv2 00/16] LXC network configuration support
by Cédric Bosdonnat
Hi all,
Here is the whole series resent with a major addition: the functions
used to set the IP and add a route now use libnl when possible. The idea
behind this is to avoid requiring iproute2 or ifconfig installed in the
container rootfs.
Otherwise nothing changed since v1.
Cédric Bosdonnat (16):
Forgot to cleanup ifname_guest* in domain network def parsing
Domain conf: allow more than one IP address for net devices
LXC: set IP addresses to veth devices in the container
lxc conf2xml: convert IP addresses
Allow network capabilities hostdev to configure IP addresses
lxc conf2xml: convert ip addresses for hostdev NICs
Domain network devices can now have a <gateway> element
lxc conf2xml: convert lxc.network.ipv[46].gateway
LXC: use the new net devices gateway definition
LXC: honour network devices link state
Wrong place for virDomainNetIpsFormat
virNetDevSetIPv4Address: libnl implementation
Renamed virNetDevSetIPv4Address to virNetDevSetIPAddress
virNetDevAddRoute: implementation using netlink
virNetDevClearIPv4Address: netlink implementation
Renamed virNetDevClearIPv4Address to virNetDevClearIPAddress
docs/formatdomain.html.in | 39 +++
docs/schemas/domaincommon.rng | 55 +++-
src/conf/domain_conf.c | 214 +++++++++++++--
src/conf/domain_conf.h | 22 +-
src/libvirt_private.syms | 7 +-
src/lxc/lxc_container.c | 74 ++++-
src/lxc/lxc_native.c | 173 ++++++++----
src/network/bridge_driver.c | 4 +-
src/openvz/openvz_conf.c | 2 +-
src/openvz/openvz_driver.c | 6 +-
src/qemu/qemu_driver.c | 25 +-
src/qemu/qemu_hotplug.c | 6 +-
src/uml/uml_conf.c | 2 +-
src/util/virnetdev.c | 305 ++++++++++++++++++---
src/util/virnetdev.h | 12 +-
src/util/virnetlink.c | 38 +++
src/util/virnetlink.h | 2 +
src/vbox/vbox_common.c | 3 +-
src/xenconfig/xen_common.c | 15 +-
src/xenconfig/xen_sxpr.c | 12 +-
.../lxcconf2xmldata/lxcconf2xml-physnetwork.config | 4 +
tests/lxcconf2xmldata/lxcconf2xml-physnetwork.xml | 3 +
tests/lxcconf2xmldata/lxcconf2xml-simple.config | 4 +
tests/lxcconf2xmldata/lxcconf2xml-simple.xml | 3 +
tests/lxcxml2xmldata/lxc-hostdev.xml | 3 +
tests/lxcxml2xmldata/lxc-idmap.xml | 3 +
26 files changed, 880 insertions(+), 156 deletions(-)
--
1.8.4.5
10 years, 2 months