[libvirt] [PATCH] virSocketAddrIsWildcard: Drop IN6_IS_ADDR_UNSPECIFIED
by Michal Privoznik
There's this macro IN6_IS_ADDR_UNSPECIFIED which seems to be portable,
but it is not. On other architectures many errors are produced, e.g. on
my ARM box I get:
CC libvirt_util_la-virsocketaddr.lo
util/virsocketaddr.c: In function 'virSocketAddrIsWildcard':
util/virsocketaddr.c:244:16: error: cast increases required alignment of target type [-Werror=cast-align]
util/virsocketaddr.c: At top level:
cc1: error: unrecognized command line option "-Wno-unused-command-line-argument" [-Werror]
cc1: all warnings being treated as errors
Hence, we should drop its usage and move to memcmp instead.
---
src/util/virsocketaddr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c
index e84c58e..1cefda7 100644
--- a/src/util/virsocketaddr.c
+++ b/src/util/virsocketaddr.c
@@ -241,7 +241,8 @@ virSocketAddrIsWildcard(const virSocketAddrPtr addr)
return memcmp(&addr->data.inet4.sin_addr.s_addr, &tmp,
sizeof(addr->data.inet4.sin_addr.s_addr)) == 0;
case AF_INET6:
- return IN6_IS_ADDR_UNSPECIFIED(&addr->data.inet6.sin6_addr.s6_addr);
+ return memcmp(addr->data.inet6.sin6_addr.s6_addr, &in6addr_any,
+ sizeof(addr->data.inet6.sin6_addr.s6_addr)) == 0;
}
return false;
}
--
1.8.1.5
11 years, 5 months
[libvirt] [PATCH] storage: Small file probing fixup
by Martin Kletzander
Fallback to possible storage format after nothing else than magic has
matched, since this is likely theformat user wants even though we
don't know any better.
Also fix a comment which wasn't very clear about what "skip" meant.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=836676
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/util/virstoragefile.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index b985df4..b083530 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -79,7 +79,8 @@ struct FileTypeInfo {
enum lv_endian endian; /* Endianness of file format */
int versionOffset; /* Byte offset from start of file
* where we find version number,
- * -1 to skip version test */
+ * -1 to fail version test,
+ * -2 to pass version test */
int versionNumber; /* Version number to validate */
int sizeOffset; /* Byte offset from start of file
* where we find capacity info,
@@ -662,6 +663,10 @@ virStorageFileProbeFormatFromBuf(const char *path,
}
}
+ if (format == VIR_STORAGE_FILE_RAW &&
+ possibleFormat != VIR_STORAGE_FILE_RAW)
+ format = possibleFormat;
+
cleanup:
VIR_DEBUG("format=%d", format);
return format;
--
1.8.2.1
11 years, 5 months
[libvirt] [PATCH] Fix commit 29c1e913e459058c12d02b3f4b767b3dd428a498
by Peter Krempa
This patch fixes changes done in commit 29c1e913e459058c12d02b3f4b767b3
that was pushed without implementing review feedback.
The flag introduced by the patch is changed to VIR_DOMAIN_VCPU_GUEST and
documentation makes the difference between regular hotplug and this new
functionality more explicit.
The virsh options that enable the use of the new flag are changed to
"--guest" and the documentation is fixed too.
---
include/libvirt/libvirt.h.in | 2 +-
src/libvirt.c | 18 +++++++++---------
src/qemu/qemu_driver.c | 8 ++++----
tools/virsh-domain.c | 34 +++++++++++++++++-----------------
tools/virsh.pod | 16 ++++++++--------
5 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index e057be1..574b970 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -2120,7 +2120,7 @@ typedef enum {
/* Additionally, these flags may be bitwise-OR'd in. */
VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */
- VIR_DOMAIN_VCPU_AGENT = (1 << 3), /* Use guest-agent based cpu hotplug */
+ VIR_DOMAIN_VCPU_GUEST = (1 << 3), /* Modify state of the cpu in the guest */
} virDomainVcpuFlags;
int virDomainSetVcpus (virDomainPtr domain,
diff --git a/src/libvirt.c b/src/libvirt.c
index 820519a..620dbdd 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -8907,10 +8907,10 @@ error:
* current virtual CPU limit, which must be less than or equal to the
* maximum limit.
*
- * If @flags includes VIR_DOMAIN_VCPU_AGENT, then a guest agent is used to
- * modify the number of processors used by a domain. This flag can only be used
- * with live guests and is incompatible with VIR_DOMAIN_VCPU_MAXIMUM as the
- * maximum limit can't be changed using the guest agent.
+ * If @flags includes VIR_DOMAIN_VCPU_GUEST, then the state of processors is
+ * modified inside the guest instead of the hypervisor. This flag can only
+ * be used with live guests and is incompatible with VIR_DOMAIN_VCPU_MAXIMUM.
+ * The usage of this flag may require a guest agent configured.
*
* Not all hypervisors can support all flag combinations.
*
@@ -8937,11 +8937,11 @@ virDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
goto error;
}
- if (flags & VIR_DOMAIN_VCPU_AGENT &&
+ if (flags & VIR_DOMAIN_VCPU_GUEST &&
flags & VIR_DOMAIN_VCPU_MAXIMUM) {
virReportInvalidArg(flags,
_("flags 'VIR_DOMAIN_VCPU_MAXIMUM' and "
- "'VIR_DOMAIN_VCPU_AGENT' in '%s' are mutually "
+ "'VIR_DOMAIN_VCPU_GUEST' in '%s' are mutually "
"exclusive"), __FUNCTION__);
goto error;
}
@@ -8991,9 +8991,9 @@ error:
* virtual CPU limit is queried. Otherwise, this call queries the
* current virtual CPU count.
*
- * If @flags includes VIR_DOMAIN_VCPU_AGENT, then a guest agent is used to
- * modify the number of processors used by a domain. This flag is only usable on
- * live domains.
+ * If @flags includes VIR_DOMAIN_VCPU_GUEST, then the state of the processors
+ * is modified in the guest instead of the hypervisor. This flag is only usable
+ * on live domains. Guest agent may be needed for this flag to be available.
*
* Returns the number of vCPUs in case of success, -1 in case of failure.
*/
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e5f6988..1b5b04f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3792,7 +3792,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
VIR_DOMAIN_AFFECT_CONFIG |
VIR_DOMAIN_VCPU_MAXIMUM |
- VIR_DOMAIN_VCPU_AGENT, -1);
+ VIR_DOMAIN_VCPU_GUEST, -1);
if (!nvcpus || (unsigned short) nvcpus != nvcpus) {
virReportError(VIR_ERR_INVALID_ARG,
@@ -3834,7 +3834,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
goto endjob;
}
- if (flags & VIR_DOMAIN_VCPU_AGENT) {
+ if (flags & VIR_DOMAIN_VCPU_GUEST) {
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("chainging of maximum vCPU count isn't supported "
@@ -4518,7 +4518,7 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
VIR_DOMAIN_AFFECT_CONFIG |
VIR_DOMAIN_VCPU_MAXIMUM |
- VIR_DOMAIN_VCPU_AGENT, -1);
+ VIR_DOMAIN_VCPU_GUEST, -1);
if (!(vm = qemuDomObjFromDomain(dom)))
return -1;
@@ -4535,7 +4535,7 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
if (flags & VIR_DOMAIN_AFFECT_LIVE)
def = vm->def;
- if (flags & VIR_DOMAIN_VCPU_AGENT) {
+ if (flags & VIR_DOMAIN_VCPU_GUEST) {
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("vCPU count provided by the guest agent can only be "
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 0616487..955e882 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -5161,9 +5161,9 @@ static const vshCmdOptDef opts_vcpucount[] = {
.type = VSH_OT_BOOL,
.help = N_("get value according to current domain state")
},
- {.name = "agent",
+ {.name = "guest",
.type = VSH_OT_BOOL,
- .help = N_("use guest agent based hotplug")
+ .help = N_("retrieve vcpu count from the guest instead of the hypervisor")
},
{.name = NULL}
};
@@ -5207,8 +5207,8 @@ vshCPUCountCollect(vshControl *ctl,
last_error->code == VIR_ERR_INVALID_ARG))
goto cleanup;
- if (flags & VIR_DOMAIN_VCPU_AGENT) {
- vshError(ctl, "%s", _("Failed to retrieve vCPU count via guest agent"));
+ if (flags & VIR_DOMAIN_VCPU_GUEST) {
+ vshError(ctl, "%s", _("Failed to retrieve vCPU count from the guest"));
goto cleanup;
}
@@ -5267,8 +5267,8 @@ cmdVcpucount(vshControl *ctl, const vshCmd *cmd)
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
- bool agent = vshCommandOptBool(cmd, "agent");
- bool all = maximum + active + current + config + live + agent == 0;
+ bool guest = vshCommandOptBool(cmd, "guest");
+ bool all = maximum + active + current + config + live + guest == 0;
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
/* Backwards compatibility: prior to 0.9.4,
@@ -5283,7 +5283,7 @@ cmdVcpucount(vshControl *ctl, const vshCmd *cmd)
VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
VSH_EXCLUSIVE_OPTIONS_VAR(active, maximum);
- VSH_EXCLUSIVE_OPTIONS_VAR(agent, config);
+ VSH_EXCLUSIVE_OPTIONS_VAR(guest, config);
if (live)
flags |= VIR_DOMAIN_AFFECT_LIVE;
@@ -5291,8 +5291,8 @@ cmdVcpucount(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_DOMAIN_AFFECT_CONFIG;
if (maximum)
flags |= VIR_DOMAIN_VCPU_MAXIMUM;
- if (agent)
- flags |= VIR_DOMAIN_VCPU_AGENT;
+ if (guest)
+ flags |= VIR_DOMAIN_VCPU_GUEST;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -5762,10 +5762,6 @@ static const vshCmdOptDef opts_emulatorpin[] = {
.type = VSH_OT_BOOL,
.help = N_("affect current domain")
},
- {.name = "agent",
- .type = VSH_OT_BOOL,
- .help = N_("use guest agent based hotplug")
- },
{.name = NULL}
};
@@ -5889,6 +5885,10 @@ static const vshCmdOptDef opts_setvcpus[] = {
.type = VSH_OT_BOOL,
.help = N_("affect current domain")
},
+ {.name = "guest",
+ .type = VSH_OT_BOOL,
+ .help = N_("modify cpu state in the guest")
+ },
{.name = NULL}
};
@@ -5902,19 +5902,19 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
- bool agent = vshCommandOptBool(cmd, "agent");
+ bool guest = vshCommandOptBool(cmd, "guest");
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
- VSH_EXCLUSIVE_OPTIONS_VAR(agent, config);
+ VSH_EXCLUSIVE_OPTIONS_VAR(guest, config);
if (config)
flags |= VIR_DOMAIN_AFFECT_CONFIG;
if (live)
flags |= VIR_DOMAIN_AFFECT_LIVE;
- if (agent)
- flags |= VIR_DOMAIN_VCPU_AGENT;
+ if (guest)
+ flags |= VIR_DOMAIN_VCPU_GUEST;
/* none of the options were specified */
if (!current && flags == 0)
flags = -1;
diff --git a/tools/virsh.pod b/tools/virsh.pod
index d537653..405b4d2 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1585,7 +1585,7 @@ exclusive. If no flag is specified, behavior is different depending
on hypervisor.
=item B<setvcpus> I<domain> I<count> [I<--maximum>] [[I<--config>]
-[I<--live>] | [I<--current>]] [I<--agent>]
+[I<--live>] | [I<--current>]] [I<--guest>]
Change the number of virtual CPUs active in a guest domain. By default,
this command works on active guest domains. To change the settings for an
@@ -1611,9 +1611,9 @@ is up to the hypervisor whether the I<--config> flag is also assumed, and
therefore whether the XML configuration is adjusted to make the change
persistent.
-If I<--agent> is specified, then guest agent commands are used to retrieve the
-count of available vCPUs from the perspective of the guest. This flag is usable
-only for live domains.
+If I<--guest> is specified, then the count of cpus is modified in the guest
+instead of the hypervisor. This flag is usable only for live domains
+and may require guest agent to be configured in the guest.
The I<--maximum> flag controls the maximum number of virtual cpus that can
be hot-plugged the next time the domain is booted. As such, it must only be
@@ -1741,7 +1741,7 @@ NOTE: For an inactive domain, the domain name or UUID must be used as the
I<domain>.
=item B<vcpucount> I<domain> [{I<--maximum> | I<--active>}
-{I<--config> | I<--live> | I<--current>}] [I<--agent>]
+{I<--config> | I<--live> | I<--current>}] [I<--guest>]
Print information about the virtual cpu counts of the given
I<domain>. If no flags are specified, all possible counts are
@@ -1759,9 +1759,9 @@ lists current values, and I<--current> queries according to the current
state of the domain (corresponding to I<--live> if running, or
I<--config> if inactive); these three flags are mutually exclusive.
-If I<--agent> is specified, then guest agent commands are used to retrieve the
-count of available vCPUs from the perspective of the guest. This flag is usable
-only for live domains.
+If I<--guest> is specified, then the count of cpus is reported from
+the perspective of the guest. This flag is usable only for live domains
+and may require guest agent to be configured in the guest.
=item B<vcpuinfo> I<domain>
--
1.8.2.1
11 years, 5 months
[libvirt] [PATCH 0/6] Support to use iscsi storage in domain conf
by Osier Yang
This supports to use libvirt iscsi storage volume for qemu with
either the LUN's path on host (e.g. /dev/disk/by-path/*-lun-1),
or the the libiscsi uri (e.g iscsi://demo.org:6000/$iqn/1)in
domain conf.
Osier Yang (6):
storage_iscsi: Reflect the default target port
conf: Introduce new XML tag "mode" for disk source
qemu: Translate the iscsi pool/volume disk source
security: Ignore to manage the volume type disk if its mode is uri
conf: Ignore the volume type disk if its mode is "uri"
qemu: Translate the volume type disk source before cgroup setting
docs/formatdomain.html.in | 9 ++-
docs/schemas/domaincommon.rng | 8 +++
src/conf/domain_conf.c | 71 +++++++++++++++++++++-
src/conf/domain_conf.h | 25 ++++++++
src/libvirt_private.syms | 1 +
src/qemu/qemu_command.c | 20 ++++--
src/qemu/qemu_conf.c | 117 +++++++++++++++++++++++++++++-------
src/qemu/qemu_process.c | 13 ++--
src/security/security_apparmor.c | 10 ++-
src/security/security_dac.c | 10 ++-
src/security/security_selinux.c | 10 ++-
src/storage/storage_backend_iscsi.c | 6 +-
tests/qemuxml2xmltest.c | 1 +
13 files changed, 261 insertions(+), 40 deletions(-)
--
1.8.1.4
11 years, 5 months
[libvirt] [PATCH v3 0/4]Add startupPolicy attribute support for hard disks
by Guannan Ren
v2 to v3: not only check disk source, startupPolicy should work if any
backing file is missing. The commit 039a3283 break the limition
of contiguous device boot orders, so I remove my previous patch
about it.
v1 to v2: added relax schema for disk of block and dir type
removed original patch 3/5.
The set of patches is trying to add 'startupPolicy' attribute support
to the source element of hard disks. Policy levels are using the
mandatory, requisite, optional levels as originally documented.
For the 'optional' policy, there is a little difference from CDROM and
Floppy which only drop its source path, for disks, if missing, the
checking function will drop their definitions, because qemu doesn't
allow missing source path for hard disk.
Guannan Ren
[PATCH v3 1/4] conf: add startupPolicy attribute for harddisk
[PATCH v3 2/4] storage: report error rather than warning if backing files doesn't exist
[PATCH v3 3/4] qemu: drop disk with 'optional' startupPolicy if it is not present
[PATCH v3 4/4] security: restore DAC for every disk file in disk chain
docs/schemas/domaincommon.rng | 6 +++++
include/libvirt/libvirt.h.in | 1 +
src/conf/domain_conf.c | 20 ++++++++++------
src/qemu/qemu_domain.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------
src/qemu/qemu_process.c | 7 ------
src/security/security_dac.c | 15 +++++++++++-
src/util/virstoragefile.c | 23 +++++++++++-------
tests/virstoragetest.c | 16 ++++++-------
8 files changed, 130 insertions(+), 77 deletions(-)
11 years, 5 months
[libvirt] [PATCH] spec: Drop Requires: vbox
by Cole Robinson
Since this package isn't provided by any stock RH based distro. The
upstream RPMs are called VirtualBox anyways.
---
libvirt.spec.in | 1 -
1 file changed, 1 deletion(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 47902e6..8d43e6d 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1050,7 +1050,6 @@ Requires: libvirt-daemon-driver-nwfilter = %{version}-%{release}
Requires: libvirt-daemon-driver-secret = %{version}-%{release}
Requires: libvirt-daemon-driver-storage = %{version}-%{release}
%endif
-Requires: vbox
%description daemon-vbox
Server side daemon and driver required to manage the virtualization
--
1.8.2.1
11 years, 5 months
[libvirt] How does virsh lxc-enter-namespace work? Does it?
by Richard Weinberger
Hi!
I'm facing the issue that "virsh lxc-enter-namespace ..." does not work for me.
setns() always fails with EINVAL.
Reading the code confused me a bit, maybe you can help me. :D
virsh itself calls:
cmdLxcEnterNamespace()
virDomainLxcOpenNamespace()
conn->driver->domainLxcOpenNamespace()
Here comes the first thing that is not clear to me.
conn->driver seems to be the remote driver and therefore
->domainLxcOpenNamespace is remoteDomainLxcOpenNamespace()
Why is lxc:/// a remote connection?
remoteDomainLxcOpenNamespace() does a rpc call to libvirtd.
On the remote side libvirtd does:
lxcDispatchDomainOpenNamespace(), which opens the namespace fds,
and sends them back as result.
How can this work? Does it somewhere magic file descriptor passing
on AF_UNIX?
virsh then receives the fd's (pure numbers) and setns() failed badly.
Wouldn't it make much more sense to do the open(/proc/XXX/ns/{mnt, user, ...}) and setns()
calls directly on the local side? IOW directly in virsh?
driver->domainLxcOpenNamespace() should only report the process id of the container's
init process.
Thanks,
//richard
11 years, 5 months
[libvirt] [libvirt-designer PATCHv4 0/9] Handle more devices in GVirDesignerDomain
by Christophe Fergeau
Hey,
Here is a new version of that series with the issues raised by Michal addressed.
Changes since v3:
- don't automatically add USB/smartcard/graphics devices, but add options
to virtxml to explicitly request those
- return an error when gvir_designer_domain_add_graphics() fails to
automatically add the spice agent channel
- set a GError when gvir_designer_domain_get_fallback_devices() could not
find any device.
Christophe
11 years, 5 months
[libvirt] [PATCH] Prefer VIR_STRDUP over virAsprintf(&dst, "%s", str)
by Michal Privoznik
There's no sense in using virAsprintf() just to duplicate a string.
We should use VIR_STRDUP which is designed just for that.
---
daemon/libvirtd-config.c | 2 +-
src/conf/domain_audit.c | 2 +-
src/libxl/libxl_driver.c | 30 ++++++++++++------------------
src/nwfilter/nwfilter_ebiptables_driver.c | 2 +-
src/phyp/phyp_driver.c | 4 +---
src/storage/storage_backend_scsi.c | 4 +---
6 files changed, 17 insertions(+), 27 deletions(-)
diff --git a/daemon/libvirtd-config.c b/daemon/libvirtd-config.c
index 66dfb4a..d9357b7 100644
--- a/daemon/libvirtd-config.c
+++ b/daemon/libvirtd-config.c
@@ -283,7 +283,7 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
* running in disconnected operation, and report a less
* useful Avahi string
*/
- ret = virAsprintf(&data->mdns_name, "Virtualization Host");
+ ret = VIR_STRDUP(data->mdns_name, "Virtualization Host");
} else {
char *tmp;
/* Extract the host part of the potentially FQDN */
diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index fd3de5e..97e71f7 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -505,7 +505,7 @@ virDomainAuditRedirdev(virDomainObjPtr vm, virDomainRedirdevDefPtr redirdev,
switch (redirdev->bus) {
case VIR_DOMAIN_REDIRDEV_BUS_USB:
- if (virAsprintf(&address, "USB redirdev") < 0) {
+ if (VIR_STRDUP_QUIET(address, "USB redirdev") < 0) {
VIR_WARN("OOM while encoding audit message");
goto cleanup;
}
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index bed583b..3990354 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1191,29 +1191,23 @@ libxlStateInitialize(bool privileged,
if (!(libxl_driver->domains = virDomainObjListNew()))
goto error;
- if (virAsprintf(&libxl_driver->configDir,
- "%s", LIBXL_CONFIG_DIR) == -1)
- goto out_of_memory;
+ if (VIR_STRDUP(libxl_driver->configDir, LIBXL_CONFIG_DIR) < 0)
+ goto error;
- if (virAsprintf(&libxl_driver->autostartDir,
- "%s", LIBXL_AUTOSTART_DIR) == -1)
- goto out_of_memory;
+ if (VIR_STRDUP(libxl_driver->autostartDir, LIBXL_AUTOSTART_DIR) < 0)
+ goto error;
- if (virAsprintf(&libxl_driver->logDir,
- "%s", LIBXL_LOG_DIR) == -1)
- goto out_of_memory;
+ if (VIR_STRDUP(libxl_driver->logDir, LIBXL_LOG_DIR) < 0)
+ goto error;
- if (virAsprintf(&libxl_driver->stateDir,
- "%s", LIBXL_STATE_DIR) == -1)
- goto out_of_memory;
+ if (VIR_STRDUP(libxl_driver->stateDir, LIBXL_STATE_DIR) < 0)
+ goto error;
- if (virAsprintf(&libxl_driver->libDir,
- "%s", LIBXL_LIB_DIR) == -1)
- goto out_of_memory;
+ if (VIR_STRDUP(libxl_driver->libDir, LIBXL_LIB_DIR) < 0)
+ goto error;
- if (virAsprintf(&libxl_driver->saveDir,
- "%s", LIBXL_SAVE_DIR) == -1)
- goto out_of_memory;
+ if (VIR_STRDUP(libxl_driver->saveDir, LIBXL_SAVE_DIR) < 0)
+ goto error;
if (virFileMakePath(libxl_driver->logDir) < 0) {
VIR_ERROR(_("Failed to create log dir '%s': %s"),
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index c4fcde6..9a54de4 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -3008,7 +3008,7 @@ ebtablesCreateTmpSubChain(ebiptablesRuleInstPtr *inst,
ignore_value(VIR_STRDUP(protostr, ""));
break;
case L2_PROTO_STP_IDX:
- ignore_value(virAsprintf(&protostr, "-d " NWFILTER_MAC_BGA " "));
+ ignore_value(VIR_STRDUP(protostr, "-d " NWFILTER_MAC_BGA " "));
break;
default:
ignore_value(virAsprintf(&protostr, "-p 0x%04x ",
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 70d3adb..2df082b 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -259,10 +259,8 @@ phypGetSystemType(virConnectPtr conn)
char *ret = NULL;
int exit_status = 0;
- if (virAsprintf(&cmd, "lshmc -V") < 0) {
- virReportOOMError();
+ if (VIR_STRDUP(cmd, "lshmc -V") < 0)
return -1;
- }
ret = phypExec(session, cmd, &exit_status, conn);
VIR_FREE(cmd);
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index bd6a2a9..4dad1eb 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -507,10 +507,8 @@ virStorageBackendSCSIFindLUs(virStoragePoolObjPtr pool,
virFileWaitForDevices();
- if (virAsprintf(&device_path, "/sys/bus/scsi/devices") < 0) {
- virReportOOMError();
+ if (VIR_STRDUP(device_path, "/sys/bus/scsi/devices") < 0)
goto out;
- }
devicedir = opendir(device_path);
--
1.8.2.1
11 years, 5 months
[libvirt] [PATCH 0/2] Resolve issues seen with schedinfo
by John Ferlan
These patches resolve an issue seen using 'virsh schedinfo <domain>' on a
non running domain that have been present since 1.0.4 as a result of the
cgroup infrastructure changes:
https://www.redhat.com/archives/libvir-list/2013-April/msg00783.html
The exact commit id that caused the issue is listed in each of the commit
messages. I used git bisect to determine, although it was tricky because
the TPM changes were made around the same time and required commit '8b934a5c'
to be applied in order to actually see domains on my host.
Prior to the changes the "CFS Bandwidth" data provided by qemuGetCpuBWStatus()
and lxcGetCpuBWStatus() would be obtained as a result of the driver cgroup
being mounted. Now it relies on the domain cgroup being mounted which only
occurs once the domain is active.
This issue also affects the libvirt-cim code in how it defines QEMU domains.
Fortunately it only looks for the "cpu_shares" value.
A "downside" to the end result of these changes is that for a non-running
domain it becomes impossible to obtain the vcpu_period, vcpu_quota,
emulator_period, and emulator_quota values. All that can be obtained is
the 'cpu_shares" value. As an option, I did consider adding the following to
either [qemu|lxc]DomainSchedulerGetType() and DomainSchedulerParameter[Flags]()
or just [qemu|lxc]GetCpuBWStatus() APIs in order to get the "host" values if
they existed (since they are eventually copied into the domain cgroup):
if (cgroup == NULL) {
rc = virCgroupNewSelf(&hostgrp);
if (rc < 0) {
virReportSystemError(-rc, "%s",
_("Unable to get schedinfo host cgroup"));
goto cleanup;
}
cgroup = hostgrp;
}
However, I wasn't sure going that route was desired and figured that I'd
use the code review opportunity to get the answer. Furthermore, it wasn't
clear that the vcpu_* and emulator_* values made sense for a non running
domain. Also, the virReportSystemError may need to change to a VIR_INFO
since I believe it would be triggered if cgroups weren't mounted on the system.
Another option would be to just add the above code to the GetType() APIs and
then ignore the 'cpu_bw_status' for the VIR_DOMAIN_AFFECT_CONFIG path in
the ParametersFlags() APIs thus returning all 5 datapoints set to whatever
the persistentDef had defined.
Since this has been present since 1.0.4 and no one has complained so far, I
don't think it's critical for 1.0.6. I suspect the change would need to into
the maint trees though. It might be nice to get DanB's opinion on this too.
John Ferlan (2):
qemu: Resolve issue with virsh schedinfo for non running domain
lxc: Resolve issue with virsh schedinfo for non running domain
src/lxc/lxc_driver.c | 9 ++++++++-
src/qemu/qemu_driver.c | 11 ++++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
--
1.8.1.4
11 years, 5 months