[libvirt] [PATCH] move comments after enum members for virDomainMemoryStatTags
by Claudio Bley
Signed-off-by: Claudio Bley <cbley(a)av-test.de>
---
In the same vein as
https://www.redhat.com/archives/libvir-list/2013-January/msg00522.html
this change moves comments after the corresponding member it is
intended for.
Alas, this looks a bit ugly now.
I'd love to see alternative solutions.
include/libvirt/libvirt.h.in | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 8eb4a59..9d86249 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1103,10 +1103,11 @@ typedef virDomainInterfaceStatsStruct *virDomainInterfaceStatsPtr;
* Memory Statistics Tags:
*/
typedef enum {
- /* The total amount of data read from swap space (in kB). */
VIR_DOMAIN_MEMORY_STAT_SWAP_IN = 0,
- /* The total amount of memory written out to swap space (in kB). */
+ /* The total amount of data read from swap space (in kB). */
+
VIR_DOMAIN_MEMORY_STAT_SWAP_OUT = 1,
+ /* The total amount of memory written out to swap space (in kB). */
/*
* Page faults occur when a process makes a valid access to virtual memory
@@ -1117,33 +1118,33 @@ typedef enum {
VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT = 2,
VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT = 3,
+ VIR_DOMAIN_MEMORY_STAT_UNUSED = 4,
/*
* The amount of memory left completely unused by the system. Memory that
* is available but used for reclaimable caches should NOT be reported as
* free. This value is expressed in kB.
*/
- VIR_DOMAIN_MEMORY_STAT_UNUSED = 4,
+ VIR_DOMAIN_MEMORY_STAT_AVAILABLE = 5,
/*
* The total amount of usable memory as seen by the domain. This value
* may be less than the amount of memory assigned to the domain if a
* balloon driver is in use or if the guest OS does not initialize all
* assigned pages. This value is expressed in kB.
*/
- VIR_DOMAIN_MEMORY_STAT_AVAILABLE = 5,
- /* Current balloon value (in KB). */
VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON = 6,
+ /* Current balloon value (in KB). */
+ VIR_DOMAIN_MEMORY_STAT_RSS = 7,
/* Resident Set Size of the process running the domain. This value
* is in kB */
- VIR_DOMAIN_MEMORY_STAT_RSS = 7,
+ VIR_DOMAIN_MEMORY_STAT_NR = 8,
/*
* The number of statistics supported by this version of the interface.
* To add new statistics, add them to the enum and increase this value.
*/
- VIR_DOMAIN_MEMORY_STAT_NR = 8,
#ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_MEMORY_STAT_LAST = VIR_DOMAIN_MEMORY_STAT_NR
--
1.7.9.5
11 years, 10 months
[libvirt] [PATCH] qemu: Forbid snapshot names starting with '.'
by Peter Krempa
Forbid the names to match the loading procedure of snapshots.
---
src/qemu/qemu_driver.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3a54228..8286334 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11348,13 +11348,23 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
goto cleanup;
/* reject snapshot names containing slashes as snapshot definitions are
- * saved in files containing the name */
- if (!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA) &&
- strchr(def->name, '/')) {
- virReportError(VIR_ERR_XML_DETAIL,
- _("invalid snapshot name '%s': name can't contain '/'"),
- def->name);
- goto cleanup;
+ * saved in files containing the name and names starting with dots */
+ if (!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA)) {
+ if (strchr(def->name, '/')) {
+ virReportError(VIR_ERR_XML_DETAIL,
+ _("invalid snapshot name '%s': "
+ "name can't contain '/'"),
+ def->name);
+ goto cleanup;
+ }
+
+ if (def->name[0] == '.') {
+ virReportError(VIR_ERR_XML_DETAIL,
+ _("invalid snapshot name '%s': "
+ "name can't start with '.'"),
+ def->name);
+ goto cleanup;
+ }
}
/* reject the VIR_DOMAIN_SNAPSHOT_CREATE_LIVE flag where not supported */
--
1.8.1.1
11 years, 10 months
[libvirt] [PATCH] qemu_agent: Ignore expected EOFs
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=892079
One of my previous patches (f2a4e5f176c408) tried to fix crashing
libvirtd on domain detroy. However, we need to copy pattern from
qemuProcessHandleMonitorEOF() instead of decrementing reference
counter. The rationale for this is, if qemu process is dying due
to domain being destroyed, we obtain EOF on both the monitor and
agent sockets. However, if the exit is expected, qemuProcessStop
is called, which cleans both agent and monitor sockets up. We
want qemuAgentClose() to be called iff the EOF is not expected,
so we don't leak an FD and memory.
---
src/qemu/qemu_process.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 2f08215..b212752 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -133,8 +133,15 @@ qemuProcessHandleAgentEOF(qemuAgentPtr agent,
virObjectLock(vm);
priv = vm->privateData;
- if (priv->agent == agent &&
- !virObjectUnref(priv->agent))
+
+ if (priv->beingDestroyed) {
+ VIR_DEBUG("Domain is being destroyed, agent EOF is expected");
+ virObjectUnlock(vm);
+ qemuDriverUnlock(driver);
+ return;
+ }
+
+ if (priv->agent == agent)
priv->agent = NULL;
virObjectUnlock(vm);
--
1.8.0.2
11 years, 10 months
[libvirt] [test-API][PATCH] Fix the screenshot case
by Wayne Sun
Fix missing sharemod and nonexist filename
Signed-off-by: Wayne Sun <gsun(a)redhat.com>
---
repos/domain/screenshot.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/repos/domain/screenshot.py b/repos/domain/screenshot.py
index c0db17f..8284fb4 100644
--- a/repos/domain/screenshot.py
+++ b/repos/domain/screenshot.py
@@ -6,6 +6,7 @@ import os
import mimetypes
import libvirt
+from src import sharedmod
required_params = ('guestname', 'filename',)
optional_params = {'screen' : 0}
@@ -30,9 +31,9 @@ def screenshot(params):
ext = mimetypes.guess_extension(mime) or '.ppm'
last_filename = params['filename'] + ext
- f = file(filename, 'w')
+ f = file(last_filename, 'w')
- logger.debug('Saving screenshot into %s' % filename)
+ logger.debug('Saving screenshot into %s' % last_filename)
st.recvAll(saver, f)
logger.debug('Mimetype of the file is %s' % mime)
--
1.7.1
11 years, 10 months
Re: [libvirt] [Openstack] [Openstack-dev]Where is libvirt library packages in Openstack Nova branch
by harryxiyou
On Tue, Jan 22, 2013 at 9:21 AM, longeek <mengql112233(a)gmail.com> wrote:
> Hi friends,
>
Hi Meng,
> the python interface of libvirt maybe help you, because openstack uses it in
> nova/virt/libvirt/
If openstack use it direactly, how to call these interface effectively? I think
Nova should place libvirt python module to its source codes directory tree,
then he can call these interfaces. Therefore, i cannot find the libvirt python
module in Nova branch.
Daniel said libvirt.so is from standard libvirt code itself and libvirt
python module is from libvirt.so. They(libvirt.so and libvirt python module)
are part of libvirt. And Nova just uses libvirt integration driver codes.
But i wonder if they(libvirt integration codes and libvirt python module)
have any relationships? What and how do they have? Nova's libvirt integration
codes call libvirt python module, right? Where does Nova place libvirt python
module? How to call libvirt python module?
--
Thanks
Harry Wei
11 years, 10 months
[libvirt] [PATCH RFC] auto-create pci-bridge controller info
by liguang
if some devices specify a pci bus number that
haven't been defined by a pci-bridge controller
then fill the required correct controller info
silently.
it based on previous add pci-bridge support patches,
https://www.redhat.com/archives/libvir-list/2013-January/msg00577.html
Signed-off-by: liguang <lig.fnst(a)cn.fujitsu.com>
---
src/conf/domain_conf.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8ebe77d..988e4f2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11756,6 +11756,60 @@ virDomainDefMaybeAddSmartcardController(virDomainDefPtr def)
}
+static int
+virDomainDefMaybeAddPcibridgeController(virDomainDefPtr def)
+{
+ int i, idx = 0;
+
+ for (i = 0; i < def->nnets; i++) {
+ if (def->nets[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
+ continue;
+ idx = def->nets[i]->info.addr.pci.bus;
+ if (virDomainDefMaybeAddController(def,
+ VIR_DOMAIN_CONTROLLER_TYPE_PCIBRIDGE,
+ idx) < 0)
+ return -1;
+ }
+
+ for (i = 0; i < def->nsounds; i++) {
+ if (def->sounds[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
+ continue;
+ idx = def->sounds[i]->info.addr.pci.bus;
+ if (virDomainDefMaybeAddController(def,
+ VIR_DOMAIN_CONTROLLER_TYPE_PCIBRIDGE,
+ idx) < 0)
+ return -1;
+ }
+
+ for (i = 0; i < def->nvideos; i++) {
+ if (def->videos[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
+ continue;
+ idx = def->videos[i]->info.addr.pci.bus;
+ if (virDomainDefMaybeAddController(def,
+ VIR_DOMAIN_CONTROLLER_TYPE_PCIBRIDGE,
+ idx) < 0)
+ return -1;
+ }
+
+ if (def->watchdog->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
+ idx = def->watchdog->info.addr.pci.bus;
+
+ if (virDomainDefMaybeAddController(def,
+ VIR_DOMAIN_CONTROLLER_TYPE_PCIBRIDGE,
+ idx) < 0)
+ return -1;
+
+ if (def->memballoon->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
+ idx = def->memballoon->info.addr.pci.bus;
+
+ if (virDomainDefMaybeAddController(def,
+ VIR_DOMAIN_CONTROLLER_TYPE_PCIBRIDGE,
+ idx) < 0)
+ return -1;
+
+ return 0;
+}
+
/*
* Based on the declared <address/> info for any devices,
* add necessary drive controllers which are not already present
@@ -11790,6 +11844,9 @@ int virDomainDefAddImplicitControllers(virDomainDefPtr def)
if (virDomainDefMaybeAddSmartcardController(def) < 0)
return -1;
+ if (virDomainDefMaybeAddPcibridgeController(def) < 0)
+ return -1;
+
return 0;
}
--
1.7.2.5
11 years, 10 months
[libvirt] [PATCH] qemu: Allow loading snapshot configs starting with a dot
by Peter Krempa
Relax the check for the period on start of a snapshot name to skip only
the '.' and '..' directories.
---
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3a54228..637e599 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -520,7 +520,7 @@ qemuDomainSnapshotLoad(void *payload,
}
while ((entry = readdir(dir))) {
- if (entry->d_name[0] == '.')
+ if (STREQ(entry->d_name, ".") || STREQ(entry->d_name, ".."))
continue;
/* NB: ignoring errors, so one malformed config doesn't
--
1.8.1.1
11 years, 10 months
[libvirt] [PATCH] fixed xt_physdev warning when defining ip(6)tables rules
by Reinier Schoof
---
src/nwfilter/nwfilter_ebiptables_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 4fec52d..db2276c 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -166,7 +166,7 @@ static const char ebiptables_script_set_ifs[] =
snprintf(buf, sizeof(buf), "%c%c-%s", prefix[0], prefix[1], ifname)
#define PHYSDEV_IN "--physdev-in"
-#define PHYSDEV_OUT "--physdev-out"
+#define PHYSDEV_OUT "--physdev-is-bridged --physdev-out"
static const char *m_state_out_str = "-m state --state NEW,ESTABLISHED";
static const char *m_state_in_str = "-m state --state ESTABLISHED";
--
1.7.11.5
11 years, 10 months
[libvirt] [PATCH 0/4] Fix issues with snapshots named with strings containing '/'
by Peter Krempa
Multiple places in the code were affected by snapshots that would contain a slash
in the name as the name is used to create path to the definition save file.
Peter Krempa (4):
qemu: Simplify condition with already extracted flag
snapshot: conf: Avoid dereferencing NULL snapshot parent
qemu: Don't return success if creation of snapshot save file fails
qemu: Reject attempts to create snapshots with names containig '/'
src/conf/snapshot_conf.c | 3 +++
src/qemu/qemu_driver.c | 22 +++++++++++++++++++---
2 files changed, 22 insertions(+), 3 deletions(-)
--
1.8.1.1
11 years, 10 months
[libvirt] [PATCH] safe{read, write}: Document usage with nonblocking FD
by Michal Privoznik
Currently, whenever somebody calls saferead() on nonblocking FD
(safewrite() is totally interchangeable for purpose of this message)
he might get wrong return value. For instance, in the first iteration
some data is read. The number of bytes read is stored into local
variable 'nread'. However, in next iterations we can get -1 from
read() with errno == EAGAIN, in which case the -1 is returned despite
fact some data has already been read. So the caller gets confused.
Bare read() should be used for nonblocking FD.
---
src/util/virutil.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/util/virutil.c b/src/util/virutil.c
index b36e9d3..bc970a4 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -98,7 +98,9 @@ verify(sizeof(gid_t) <= sizeof(unsigned int) &&
#define VIR_FROM_THIS VIR_FROM_NONE
-/* Like read(), but restarts after EINTR */
+/* Like read(), but restarts after EINTR.
+ * Doesn't play nicely with nonblocking FD and EAGAIN,
+ * in which case you want to use bare read() */
ssize_t
saferead(int fd, void *buf, size_t count)
{
@@ -118,7 +120,9 @@ saferead(int fd, void *buf, size_t count)
return nread;
}
-/* Like write(), but restarts after EINTR */
+/* Like write(), but restarts after EINTR.
+ * Doesn't play nicely with nonblocking FD and EAGAIN,
+ * in which case you want to use bare write() */
ssize_t
safewrite(int fd, const void *buf, size_t count)
{
--
1.8.0.2
11 years, 10 months