[libvirt] hash.c patches
by Christophe Fergeau
Hi,
I recently started looking at libvirt code, and while reading hash.c,
I noticed a few buglets and some cleanup that could be done. I was
planning to test them carefully before sending them (ie make sure
there's a unit test for this code), but since I don't know when I have
time for that, and since make check and make syntax-check are passing,
I'm just sending them for an initial review :)
If you prefer the patches inline/in separate mails, just let me know.
Thanks!
Christophe
13 years, 8 months
[libvirt] [PATCH] build: Fix VPATH build
by Jiri Denemark
Even VPATH make dist succeeds now
---
docs/Makefile.am | 8 ++++----
docs/apibuild.py | 23 +++++++++++++----------
2 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 473bbbf..8c96e79 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -92,7 +92,7 @@ MAINTAINERCLEANFILES = $(dot_html) $(apihtml) $(devhelphtml)
all: web
-api: libvirt-api.xml libvirt-refs.xml
+api: $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml
web: $(dot_html) html/index.html devhelp/index.html
@@ -146,7 +146,7 @@ internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in
html/index.html: libvirt-api.xml newapi.xsl page.xsl sitemap.html.in
-@if [ -x $(XSLTPROC) ] ; then \
echo "Rebuilding the HTML pages from the XML API" ; \
- $(XSLTPROC) --nonet $(srcdir)/newapi.xsl libvirt-api.xml ; fi
+ $(XSLTPROC) --nonet $(srcdir)/newapi.xsl $(srcdir)/libvirt-api.xml ; fi
-@if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \
if $(XMLCATALOG) '$(XML_CATALOG_FILE)' "-//W3C//DTD XHTML 1.0 Strict//EN" \
> /dev/null ; then \
@@ -159,7 +159,7 @@ $(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl)
-@echo Rebuilding devhelp files
-@if [ -x $(XSLTPROC) ] ; then \
$(XSLTPROC) --nonet -o devhelp/libvirt.devhelp \
- $(top_srcdir)/docs/devhelp/devhelp.xsl libvirt-api.xml ; fi
+ $(top_srcdir)/docs/devhelp/devhelp.xsl $(srcdir)/libvirt-api.xml ; fi
python_generated_files = \
$(srcdir)/html/libvirt-libvirt.html \
@@ -179,7 +179,7 @@ clean-local:
rm -f *~ *.bak *.hierarchy *.signals *-unused.txt *.html
maintainer-clean-local: clean-local
- rm -rf libvirt-api.xml libvirt-refs.xml todo.html.in
+ rm -rf $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml todo.html.in
rebuild: api all
diff --git a/docs/apibuild.py b/docs/apibuild.py
index 62b7557..895a313 100755
--- a/docs/apibuild.py
+++ b/docs/apibuild.py
@@ -1614,8 +1614,9 @@ class CParser:
class docBuilder:
"""A documentation builder"""
- def __init__(self, name, directories=['.'], includes=[]):
+ def __init__(self, name, path='.', directories=['.'], includes=[]):
self.name = name
+ self.path = path
self.directories = directories
self.includes = includes + included_files.keys()
self.modules = {}
@@ -2062,7 +2063,7 @@ class docBuilder:
output.write(" </index>\n")
def serialize(self):
- filename = "%s-api.xml" % self.name
+ filename = "%s/%s-api.xml" % (self.path, self.name)
print "Saving XML description %s" % (filename)
output = open(filename, "w")
output.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n')
@@ -2098,7 +2099,7 @@ class docBuilder:
output.write("</api>\n")
output.close()
- filename = "%s-refs.xml" % self.name
+ filename = "%s/%s-refs.xml" % (self.path, self.name)
print "Saving XML Cross References %s" % (filename)
output = open(filename, "w")
output.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n')
@@ -2113,14 +2114,16 @@ def rebuild():
srcdir = os.environ["srcdir"]
if glob.glob(srcdir + "/../src/libvirt.c") != [] :
print "Rebuilding API description for libvirt"
- builder = docBuilder("libvirt",
- [srcdir + "/../src",
- srcdir + "/../src/util",
- srcdir + "/../include/libvirt"],
- [])
+ dirs = [srcdir + "/../src",
+ srcdir + "/../src/util",
+ srcdir + "/../include/libvirt"]
+ if glob.glob(srcdir + "/../include/libvirt/libvirt.h") == [] :
+ dirs.append("../include/libvirt")
+ builder = docBuilder("libvirt", srcdir, dirs, [])
elif glob.glob("src/libvirt.c") != [] :
- print "Rebuilding API description for libvir"
- builder = docBuilder("libvirt", ["src", "src/util", "include/libvirt"],
+ print "Rebuilding API description for libvirt"
+ builder = docBuilder("libvirt", srcdir,
+ ["src", "src/util", "include/libvirt"],
[])
else:
print "rebuild() failed, unable to guess the module"
--
1.7.4.1
13 years, 8 months
[libvirt] libvirt-ask
by stone1927
windows7 connect to linux/kvm by libvirt that is always failure.sothere, I want to know why? Why use qemu+tcp:// connect to linux/kvm is failure.
13 years, 8 months
[libvirt] [PATCH 0/6 v3] Add blkio cgroup support
by Gui Jianfeng
Hi
This patchset adds blkio cgroup support for qemu and lxc.
[PATCH 1/6] cgroup: Enable cgroup hierarchy for blkio cgroup
[PATCH 2/6 v3] cgroup: Implement blkio.weight tuning API.
[PATCH 3/6] Update XML Schema for new entries.
[PATCH 4/6 v3] qemu: Implement blkio tunable XML configuration and parsing.
[PATCH 5/6 v3] LXC: LXC Blkio weight configuration support.
[PATCH 6/6] Add documentation for blkiotune elements.
Will post a patchset to implement virsh command "blkiotune" to tune blkio
cgroup parameter later on.
v2 -> v3 Changes:
o Remove an unused local variable
o Rename virCgroup(Set/Get)Weight to virCgroup(Set/Get)BlkioWeight
o Add documentation in docs/formatdomain.html.in
o Update XML Schema for new entries.
docs/formatdomain.html.in | 10 ++++++++++
docs/schemas/domain.rng | 20 ++++++++++++++++++++
src/conf/domain_conf.c | 13 +++++++++++++
src/conf/domain_conf.h | 4 ++++
src/libvirt_private.syms | 2 ++
src/lxc/lxc_controller.c | 10 ++++++++++
src/qemu/qemu_cgroup.c | 16 +++++++++++++++-
src/qemu/qemu_conf.c | 3 ++-
src/util/cgroup.c | 41 ++++++++++++++++++++++++++++++++++++++++-
src/util/cgroup.h | 4 ++++
10 files changed, 120 insertions(+), 3 deletions(-)
Thanks
Gui
13 years, 8 months
[libvirt] [libvirt-php] domains: added autostart and is active
by Lyre
This patch added following functions for domain:
* integer libvirt_domain_get_autostart(resource $domain)
return 1, 0, and -1 indicates true, false, and error.
* bool libvirt_domain_set_autostart(resource $domain, bool $autosatrt)
return ture on succeess and false on failure.
* integer libvirt_domain_is_active(resource $domain)
return 1, 0, and -1 indicates true, false, and error.
modified: src/libvirt.c
modified: src/php_libvirt.h
---
src/libvirt.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
src/php_libvirt.h | 3 +++
2 files changed, 47 insertions(+), 1 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 570511e..748d898 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -63,6 +63,9 @@ static function_entry libvirt_functions[] = {
PHP_FE(libvirt_domain_memory_stats,NULL)
PHP_FE(libvirt_domain_block_stats,NULL)
PHP_FE(libvirt_domain_interface_stats,NULL)
+ PHP_FE(libvirt_domain_get_autostart, NULL)
+ PHP_FE(libvirt_domain_set_autostart, NULL)
+ PHP_FE(libvirt_domain_is_active, NULL)
PHP_FE(libvirt_version,NULL)
PHP_FE(libvirt_domain_get_connect, NULL)
PHP_FE(libvirt_domain_migrate, NULL)
@@ -70,7 +73,7 @@ static function_entry libvirt_functions[] = {
PHP_FE(libvirt_domain_get_job_info, NULL)
PHP_FE(libvirt_domain_xml_xpath, NULL)
PHP_FE(libvirt_domain_get_block_info, NULL)
- PHP_FE(libvirt_domain_get_network_info, NULL)
+ PHP_FE(libvirt_domain_get_network_info, NULL)
PHP_FE(libvirt_list_storagepools,NULL)
PHP_FE(libvirt_storagepool_lookup_by_name,NULL)
PHP_FE(libvirt_storagepool_list_volumes,NULL)
@@ -2200,6 +2203,46 @@ PHP_FUNCTION(libvirt_domain_interface_stats)
LONGLONG_ASSOC(return_value, "tx_drop", stats.tx_drop);
}
+PHP_FUNCTION(libvirt_domain_get_autostart)
+{
+ php_libvirt_domain *domain = NULL;
+ zval *zdomain;
+ int flags = 0;
+
+ GET_DOMAIN_FROM_ARGS ("r", &zdomain);
+
+ if (virDomainGetAutostart (domain->domain, &flags) != 0)
+ {
+ RETURN_LONG (-1);
+ }
+ RETURN_LONG ((long)flags);
+}
+
+PHP_FUNCTION(libvirt_domain_set_autostart)
+{
+ php_libvirt_domain *domain = NULL;
+ zval *zdomain;
+ zend_bool flags = 0;
+
+ GET_DOMAIN_FROM_ARGS ("rb", &zdomain, &flags);
+
+ if (virDomainSetAutostart (domain->domain, flags) != 0)
+ {
+ RETURN_FALSE;
+ }
+ RETURN_TRUE;
+}
+
+PHP_FUNCTION(libvirt_domain_is_active)
+{
+ php_libvirt_domain *domain = NULL;
+ zval *zdomain;
+
+ GET_DOMAIN_FROM_ARGS ("r", &zdomain);
+
+ RETURN_LONG (virDomainIsActive(domain->domain));
+}
+
PHP_FUNCTION(libvirt_version)
{
unsigned long libVer;
diff --git a/src/php_libvirt.h b/src/php_libvirt.h
index 054df46..213d27f 100644
--- a/src/php_libvirt.h
+++ b/src/php_libvirt.h
@@ -107,6 +107,9 @@ PHP_FUNCTION(libvirt_domain_memory_peek);
PHP_FUNCTION(libvirt_domain_memory_stats);
PHP_FUNCTION(libvirt_domain_block_stats);
PHP_FUNCTION(libvirt_domain_interface_stats);
+PHP_FUNCTION(libvirt_domain_get_autostart);
+PHP_FUNCTION(libvirt_domain_set_autostart);
+PHP_FUNCTION(libvirt_domain_is_active);
PHP_FUNCTION(libvirt_version);
PHP_FUNCTION(libvirt_domain_get_connect);
PHP_FUNCTION(libvirt_domain_migrate);
--
1.7.1
13 years, 8 months
[libvirt] [libvirt-php 0/2] Another update for building system
by Lyre
Hi all:
This patch updeted the building system.
* Added necessary checkings in configure.ac
* Cleared up libvirt-php.spec and src/Makefile.am
BTW, I've changed my email to business address.
Lyre (2):
spec file cleanup
Added checkings for tools and libraries
aclocal.m4 | 189 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
configure.ac | 12 ++++
libvirt-php.spec | 8 +-
src/Makefile.am | 30 +++------
4 files changed, 216 insertions(+), 23 deletions(-)
13 years, 8 months
[libvirt] [PATCH] 802.1Qbh: Delay IFF_UP'ing interface until migration final stage
by Roopa Prabhu
From: Roopa Prabhu <roprabhu(a)cisco.com>
Current code does an IFF_UP on a 8021Qbh interface immediately after a port
profile set. This is ok in most cases except when its the migration prepare
stage. During migration we want to postpone IFF_UP'ing the interface on the
destination host until the source host has disassociated the interface.
This patch moves IFF_UP of the interface to the final stage of migration.
The motivation for this change is to postpone any addr registrations on the
destination host until the source host has done the addr deregistrations.
While at it, for symmetry with associate move ifDown of a 8021Qbh interface
to before disassociate
Signed-off-by: Roopa Prabhu <roprabhu(a)cisco.com>
Signed-off-by: David Wang <dwang2(a)cisco.com>
Signed-off-by: Christian Benvenuti <benve(a)cisco.com>
---
src/util/macvtap.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/util/macvtap.c b/src/util/macvtap.c
index 8814400..a71db86 100644
--- a/src/util/macvtap.c
+++ b/src/util/macvtap.c
@@ -1470,8 +1470,6 @@ doPortProfileOp8021Qbh(const char *ifname,
NULL,
vf,
PORT_REQUEST_DISASSOCIATE);
- if (!rc)
- ifaceUp(ifname);
break;
case DISASSOCIATE:
@@ -1484,7 +1482,6 @@ doPortProfileOp8021Qbh(const char *ifname,
NULL,
vf,
PORT_REQUEST_DISASSOCIATE);
- ifaceDown(ifname);
break;
default:
@@ -1550,10 +1547,11 @@ vpAssociatePortProfileId(const char *macvtap_ifname,
case VIR_VIRTUALPORT_8021QBH:
/* avoid associating twice */
- if (vmOp == VIR_VM_OP_MIGRATE_IN_FINISH)
- break;
- rc = doPortProfileOp8021Qbh(linkdev, macvtap_macaddr,
- virtPort, vmuuid, ASSOCIATE);
+ if (vmOp != VIR_VM_OP_MIGRATE_IN_FINISH)
+ rc = doPortProfileOp8021Qbh(linkdev, macvtap_macaddr,
+ virtPort, vmuuid, ASSOCIATE);
+ if (vmOp != VIR_VM_OP_MIGRATE_IN_START && !rc)
+ ifaceUp(linkdev);
break;
}
@@ -1600,6 +1598,7 @@ vpDisassociatePortProfileId(const char *macvtap_ifname,
/* avoid disassociating twice */
if (vmOp == VIR_VM_OP_MIGRATE_IN_FINISH)
break;
+ ifaceDown(linkdev);
rc = doPortProfileOp8021Qbh(linkdev, macvtap_macaddr,
virtPort, NULL, DISASSOCIATE);
break;
13 years, 8 months
[libvirt] [PATCH] nwfilter: enable rejection of packets
by Stefan Berger
This patch adds the possibility to not just drop packets, but to also
have them rejected where iptables at least sends an ICMP msg back to the
originator. On ebtables this again maps into dropping packets since
rejecting is not supported.
I am adding 'since 0.8.9' to the docs assuming this will be the next
version of libvirt.
Signed-off-by: Stefan Berger <stefanb(a)us.ibm.com>
---
docs/formatnwfilter.html.in | 8 +++++---
docs/schemas/nwfilter.rng | 1 +
src/conf/nwfilter_conf.c | 6 ++++--
src/conf/nwfilter_conf.h | 1 +
src/nwfilter/nwfilter_ebiptables_driver.c | 15 +++++++++++++--
5 files changed, 24 insertions(+), 7 deletions(-)
Index: libvirt-acl/src/conf/nwfilter_conf.c
===================================================================
--- libvirt-acl.orig/src/conf/nwfilter_conf.c
+++ libvirt-acl/src/conf/nwfilter_conf.c
@@ -53,11 +53,13 @@
VIR_ENUM_IMPL(virNWFilterRuleAction, VIR_NWFILTER_RULE_ACTION_LAST,
"drop",
- "accept");
+ "accept",
+ "reject");
VIR_ENUM_IMPL(virNWFilterJumpTarget, VIR_NWFILTER_RULE_ACTION_LAST,
"DROP",
- "ACCEPT");
+ "ACCEPT",
+ "REJECT");
VIR_ENUM_IMPL(virNWFilterRuleDirection, VIR_NWFILTER_RULE_DIRECTION_LAST,
"in",
Index: libvirt-acl/src/conf/nwfilter_conf.h
===================================================================
--- libvirt-acl.orig/src/conf/nwfilter_conf.h
+++ libvirt-acl/src/conf/nwfilter_conf.h
@@ -291,6 +291,7 @@ struct _udpliteHdrFilterDef {
enum virNWFilterRuleActionType {
VIR_NWFILTER_RULE_ACTION_DROP = 0,
VIR_NWFILTER_RULE_ACTION_ACCEPT,
+ VIR_NWFILTER_RULE_ACTION_REJECT,
VIR_NWFILTER_RULE_ACTION_LAST,
};
Index: libvirt-acl/src/nwfilter/nwfilter_ebiptables_driver.c
===================================================================
--- libvirt-acl.orig/src/nwfilter/nwfilter_ebiptables_driver.c
+++ libvirt-acl/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -1516,7 +1516,7 @@ _iptablesCreateRuleInstance(int directio
if (rule->action == VIR_NWFILTER_RULE_ACTION_ACCEPT)
target = accept_target;
else {
- target = "DROP";
+ target = virNWFilterJumpTargetTypeToString(rule->action);
skipMatch = defMatch;
}
@@ -1880,6 +1880,7 @@ ebtablesCreateRuleInstance(char chainPre
number[20];
char chain[MAX_CHAINNAME_LENGTH];
virBuffer buf = VIR_BUFFER_INITIALIZER;
+ const char *target;
if (!ebtables_cmd_path) {
virNWFilterReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -2295,10 +2296,20 @@ ebtablesCreateRuleInstance(char chainPre
return -1;
}
+ switch (rule->action) {
+ case VIR_NWFILTER_RULE_ACTION_REJECT:
+ /* REJECT not supported */
+ target = virNWFilterJumpTargetTypeToString(
+ VIR_NWFILTER_RULE_ACTION_DROP);
+ break;
+ default:
+ target = virNWFilterJumpTargetTypeToString(rule->action);
+ }
+
virBufferVSprintf(&buf,
" -j %s" CMD_DEF_POST CMD_SEPARATOR
CMD_EXEC,
- virNWFilterJumpTargetTypeToString(rule->action));
+ target);
if (virBufferError(&buf)) {
virBufferFreeAndReset(&buf);
Index: libvirt-acl/docs/schemas/nwfilter.rng
===================================================================
--- libvirt-acl.orig/docs/schemas/nwfilter.rng
+++ libvirt-acl/docs/schemas/nwfilter.rng
@@ -839,6 +839,7 @@
<choice>
<value>drop</value>
<value>accept</value>
+ <value>reject</value>
</choice>
</define>
Index: libvirt-acl/docs/formatnwfilter.html.in
===================================================================
--- libvirt-acl.orig/docs/formatnwfilter.html.in
+++ libvirt-acl/docs/formatnwfilter.html.in
@@ -260,9 +260,11 @@
</p>
<ul>
<li>
- action -- mandatory; must either be <code>drop</code> or
<code>accept</code> if
- the evaluation of the filtering rule is supposed to drop or accept
- a packet
+ action -- mandatory; must either be <code>drop</code>,
+ <code>reject</code><span class="since">(since 0.8.9)</span>,
+ or <code>accept</code> if
+ the evaluation of the filtering rule is supposed to drop,
+ reject (using ICMP message), or accept a packet
</li>
<li>
direction -- mandatory; must either be <code>in</code>,
<code>out</code> or
13 years, 8 months
[libvirt] [PATCH] [libvirt-tck] Fix expected error code in network test
by Jim Fehlig
I missed this one while fixing a similar bug in the domain
transient autostart tests.
Attempting to autostart a transient network results in
ERR_OPERATION_INVALID not ERR_INTERNAL_ERROR.
---
scripts/networks/051-transient-autostart.t | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/networks/051-transient-autostart.t b/scripts/networks/051-transient-autostart.t
index 2b83fbc..2e220d3 100644
--- a/scripts/networks/051-transient-autostart.t
+++ b/scripts/networks/051-transient-autostart.t
@@ -48,7 +48,7 @@ my $auto = $net->get_autostart();
ok(!$auto, "autostart is disabled for transient VMs");
-ok_error(sub { $net->set_autostart(1) }, "Set autostart not supported on transient VMs", Sys::Virt::Error::ERR_INTERNAL_ERROR);
+ok_error(sub { $net->set_autostart(1) }, "Set autostart not supported on transient VMs", Sys::Virt::Error::ERR_OPERATION_INVALID);
diag "Destroying the transient network";
$net->destroy;
--
1.7.3.1
13 years, 8 months