[libvirt] [PATCHv3 0/4] Support filesystem limits for containers
by Guido Günther
Hi,
the following patches are a third stab at filesystem limits for
containers. With these patches space limits in openvz containers are
printed in the domain config as:
<filesystem type='template' accessmode='passthrough'>
<source name='debian'/>
<target dir='/'/>
<space_hard_limit unit="MiB">1153024</space_hard_limit>
<space_soft_limit unit="MiB">1048576</space_soft_limit>
</filesystem>
The can also be set from the domain xml. I left out inode limits for now
since the unit "Bytes" wouldn't fit there well and I didnt' get around
to update the unit parsing code yet. Changes since last time:
* Add the version we introduced this feature to formatdomain.html.in
* Move the patch that makes virDomainParseMemory use
virDomainParseScaledValue to the front of the queue
* Fix safe_node -> save_node typo
* Make output format consistent with what's used in storage_conf.c
('bytes' not 'B')
* openvz: Check for overflow when parsing DISKSPACE out of the container
config
* openvz: Fix logic that only sets the hard limit when no soft limit is
given and rejects config that only specify a soft limit
Cheers,
-- Guido
Guido Günther (4):
Introduce virDomainParseScaledValue
Introduce filesystem limits to virDomainFSDef
openvz: support file system quota reporting
openvz: add quota argument when creating container
docs/formatdomain.html.in | 14 +++
docs/schemas/domaincommon.rng | 12 +++
src/conf/domain_conf.c | 124 ++++++++++++++++-------
src/conf/domain_conf.h | 2 +
src/openvz/openvz_conf.c | 24 +++++
src/openvz/openvz_driver.c | 58 ++++++++++-
tests/domainschemadata/domain-openvz-simple.xml | 2 +
7 files changed, 199 insertions(+), 37 deletions(-)
--
1.7.10
12 years, 6 months
[libvirt] Providing custom arguments/environment to network scripts
by Tore Anderson
I'm trying to build a setup where the VMs only have point-to-point
Ethernet connections to the hypervisor, which will then act as a layer-3
router. When the VM starts, the hypervisor needs to UP the assigned tap
interface and configure an IP/mask on it (that will be the VMs default
gateway). So I'm currently looking at a config looking like this:
<interface type='ethernet'>
<script path='/sbin/vm-ifup'/>
</interface>
The problem I'm facing is that there appears to be no way supply
information to the script by way of command-line arguments or custom
environment variables. So something like:
<script path='/sbin/vm-ifup 2001:db8::/64'/>
...fails because it tries to execute the whole string, space included,
as the script file.
The only information I have available in the script is the assigned tap
device in the hypervisor (which is automatically passed in as the first
argument to the script). As the device name is automatically assigned on
VM start, it is useless as a lookup key of sorts for finding more
information. One workaround would be to have one network script per VM
that hard-codes all the necessary information, but if you have a large
number of hypervisors with an even larger number of VMs, this quickly
becomes impractical.
So my question is, is there some other way to pass configuration
information to the network script or to accomplish what I'm trying to do?
Best regards,
--
Tore Anderson
Redpill Linpro AS - http://www.redpill-linpro.com
12 years, 6 months
[libvirt] [RFC PATCH 0/4] block: file descriptor passing using -filefd and getfd_file
by Corey Bryant
libvirt's sVirt security driver provides SELinux MAC isolation for
Qemu guest processes and their corresponding image files. In other
words, sVirt uses SELinux to prevent a QEMU process from opening
files that do not belong to it.
sVirt provides this support by labeling guests and resources with
security labels that are stored in file system extended attributes.
Some file systems, such as NFS, do not support the extended
attribute security namespace, and therefore cannot support sVirt
isolation.
A solution to this problem is to provide fd passing support, where
libvirt opens files and passes file descriptors to QEMU. This,
along with SELinux policy to prevent QEMU from opening files, can
provide image file isolation for NFS files.
This patch series adds the -filefd command-line option and the
getfd_file monitor command. This will enable libvirt to open a
file and push the corresponding filename and file descriptor to
QEMU. When QEMU needs to "open" a file, it will first check if the
file descriptor was passed by either of these methods before
attempting to actually open the file.
This series reuses the file_open function that Anthony Liguori
<aliguori(a)us.ibm.com> created for the most recent fd passing
prototype. It also reuses the test driver that Stefan
Hajnoczi <stefanha(a)linux.vnet.ibm.com> created for that prototype,
with several modifications.
Corey Bryant (4):
qemu-options: Add -filefd command line option
qmp/hmp: Add getfd_file monitor command
block: Enable QEMU to retrieve passed fd before attempting open
Example -filefd and getfd_file server
block.c | 31 +++++++
block/raw-posix.c | 20 +++---
block/raw-win32.c | 4 +-
block/vdi.c | 4 +-
block/vmdk.c | 21 ++---
block/vpc.c | 2 +-
block/vvfat.c | 4 +-
block_int.h | 12 +++
hmp-commands.hx | 17 ++++
monitor.c | 70 +++++++++++++++++
monitor.h | 3 +
qemu-config.c | 17 ++++
qemu-config.h | 1 +
qemu-options.hx | 17 ++++
qemu-tool.c | 5 +
qmp-commands.hx | 30 +++++++
test-fd-passing.c | 224 +++++++++++++++++++++++++++++++++++++++++++++++++++++
vl.c | 6 ++
18 files changed, 459 insertions(+), 29 deletions(-)
create mode 100644 test-fd-passing.c
--
1.7.7.6
12 years, 6 months
[libvirt] [libvirt-glib 1/2] Add gvir_config_object_get_attribute_uint64()
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
Another internal libvirt-gconfig helper to get unint64 XML attributes.
---
libvirt-gconfig/libvirt-gconfig-object-private.h | 4 ++++
libvirt-gconfig/libvirt-gconfig-object.c | 15 +++++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-object-private.h b/libvirt-gconfig/libvirt-gconfig-object-private.h
index b3798c0..830517c 100644
--- a/libvirt-gconfig/libvirt-gconfig-object-private.h
+++ b/libvirt-gconfig/libvirt-gconfig-object-private.h
@@ -42,6 +42,10 @@ gint gvir_config_object_get_node_content_genum(GVirConfigObject *object,
const char *gvir_config_object_get_attribute(GVirConfigObject *object,
const char *node_name,
const char *attr_name);
+guint64 gvir_config_object_get_attribute_uint64(GVirConfigObject *object,
+ const char *node_name,
+ const char *attr_name,
+ guint64 default_value);
gint gvir_config_object_get_attribute_genum(GVirConfigObject *object,
const char *node_name,
const char *attr_name,
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index 1474393..a7352a5 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -644,6 +644,21 @@ gvir_config_object_get_attribute_genum(GVirConfigObject *object,
return value;
}
+G_GNUC_INTERNAL guint64
+gvir_config_object_get_attribute_uint64(GVirConfigObject *object,
+ const char *node_name,
+ const char *attr_name,
+ guint64 default_value)
+{
+ const char *str;
+
+ str = gvir_config_object_get_attribute(object, node_name, attr_name);
+ if (str == NULL)
+ return default_value;
+
+ return g_ascii_strtoull(str, NULL, 0);
+}
+
GVirConfigObject *gvir_config_object_new_from_xml(GType type,
const char *root_name,
const char *schema,
--
1.7.7.6
12 years, 6 months
[libvirt] [PATCH] Remove more bogus systemd service dependencies
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Adding syslog.target is obsolete, avahi.target does not
exist and dbus.target is also obsolete
---
daemon/libvirtd.service.in | 3 ---
1 file changed, 3 deletions(-)
diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in
index 64dbd27..33724ee 100644
--- a/daemon/libvirtd.service.in
+++ b/daemon/libvirtd.service.in
@@ -5,9 +5,6 @@
[Unit]
Description=Virtualization daemon
-After=syslog.target
-After=avahi.target
-After=dbus.target
Before=libvirt-guests.service
[Service]
--
1.7.10.1
12 years, 6 months
[libvirt] [PATCH 0/3 v4] use qemu's dump-guest-meory when vm uses host device
by Wen Congyang
Currently, we use migrate to dump guest's memory. There is one
restriction in migrate command: the device's status should be
stored in qemu because the device's status should be passed to
target machine.
If we passthrough a host device to guest, the device's status
is stored in the real device. So migrate command will fail.
We usually use dump when guest is panicked. So there is no need
to store device's status in the vmcore.
qemu will have a new monitor command dump-guest-memory to dump
guest memory, but it doesn't support async now(it will support
later when the common async API is implemented).
So I use dump-guest-memory only when the guest uses host device
in this patchset.
Note: the patchset for qemu is still queued. Luiz has acked,
but he said he does not wait an ACK from Jan and/or Anthony.
Changes from v3 to v4:
1. allow the user to specify the core file's format
Changes from v2 to v3:
1. qemu supports the fd that is associated with a pipe, socket, or FIFO.
So pass a pipe fd to qemu and O_DIRECT can work now.
Change from v1 to v2:
1. remove the implemention for text mode.
Wen Congyang (3):
qemu: implement qemu's dump-guest-memory
qemu: allow the client to choose the vmcore's format
virsh: allow the user to specify vmcore's format
include/libvirt/libvirt.h.in | 1 +
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_driver.c | 54 +++++++++++++++++++++++++++++++----------
src/qemu/qemu_monitor.c | 38 +++++++++++++++++++++++++++++
src/qemu/qemu_monitor.h | 12 +++++++++
src/qemu/qemu_monitor_json.c | 35 +++++++++++++++++++++++++++
src/qemu/qemu_monitor_json.h | 6 ++++
tools/virsh.c | 3 ++
tools/virsh.pod | 5 +++-
10 files changed, 142 insertions(+), 14 deletions(-)
12 years, 6 months
[libvirt] [libvirt-glib] Check arguments to public libvirt-gobject methods
by Christophe Fergeau
Some public methods in libvirt-gobject don't have g_return_if_fail
checks on their arguments. It happens that GNOME Boxes tries to call
gvir_connection_find_storage_pool_by_name with a NULL GVirConnection
causing a crash https://bugzilla.gnome.org/show_bug.cgi?id=676216 While
GNOME Boxes needs to be fixed not to pass an invalid value to this
function, it's better if libvirt-object sanity checks the argument it is
passed by the caller before using them. In this commit, I've went over
all libvirt-gobject public functions to add g_return_if_fail checks
where needed.
---
libvirt-gobject/libvirt-gobject-connection.c | 122 +++++++++++++++++---
libvirt-gobject/libvirt-gobject-domain-device.c | 4 +
libvirt-gobject/libvirt-gobject-domain-disk.c | 1 +
libvirt-gobject/libvirt-gobject-domain-interface.c | 1 +
libvirt-gobject/libvirt-gobject-domain-snapshot.c | 7 +-
libvirt-gobject/libvirt-gobject-domain.c | 70 +++++++++--
libvirt-gobject/libvirt-gobject-interface.c | 13 ++-
libvirt-gobject/libvirt-gobject-manager.c | 27 +++--
libvirt-gobject/libvirt-gobject-network-filter.c | 14 ++-
libvirt-gobject/libvirt-gobject-network.c | 13 ++-
libvirt-gobject/libvirt-gobject-node-device.c | 14 ++-
libvirt-gobject/libvirt-gobject-secret.c | 6 +-
libvirt-gobject/libvirt-gobject-storage-pool.c | 61 ++++++++--
libvirt-gobject/libvirt-gobject-storage-vol.c | 33 ++++--
libvirt-gobject/libvirt-gobject-stream.c | 6 +
15 files changed, 321 insertions(+), 71 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
index b12669d..3a99034 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -407,7 +407,14 @@ gboolean gvir_connection_open(GVirConnection *conn,
GCancellable *cancellable,
GError **err)
{
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
+
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), FALSE);
+ g_return_val_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable),
+ FALSE);
+ g_return_val_if_fail((err == NULL) || (*err == NULL), FALSE);
+
+ priv = conn->priv;
if (g_cancellable_set_error_if_cancelled(cancellable, err))
return FALSE;
@@ -486,6 +493,9 @@ void gvir_connection_open_async(GVirConnection *conn,
{
GSimpleAsyncResult *res;
+ g_return_if_fail(GVIR_IS_CONNECTION(conn));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
+
res = g_simple_async_result_new(G_OBJECT(conn),
callback,
user_data,
@@ -521,8 +531,12 @@ gboolean gvir_connection_open_finish(GVirConnection *conn,
gboolean gvir_connection_is_open(GVirConnection *conn)
{
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
gboolean open = TRUE;
+
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), FALSE);
+
+ priv = conn->priv;
g_mutex_lock(priv->lock);
if (!priv->conn)
open = FALSE;
@@ -532,7 +546,12 @@ gboolean gvir_connection_is_open(GVirConnection *conn)
void gvir_connection_close(GVirConnection *conn)
{
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
+
+ g_return_if_fail(GVIR_IS_CONNECTION(conn));
+
+ priv = conn->priv;
+
g_debug("Close GVirConnection=%p", conn);
g_mutex_lock(priv->lock);
@@ -613,7 +632,7 @@ gboolean gvir_connection_fetch_domains(GVirConnection *conn,
GCancellable *cancellable,
GError **err)
{
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
GHashTable *doms;
gchar **inactive = NULL;
gint ninactive = 0;
@@ -624,6 +643,12 @@ gboolean gvir_connection_fetch_domains(GVirConnection *conn,
virConnectPtr vconn = NULL;
GError *lerr = NULL;
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), FALSE);
+ g_return_val_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable),
+ FALSE);
+ g_return_val_if_fail((err == NULL) || (*err == NULL), FALSE);
+
+ priv = conn->priv;
g_mutex_lock(priv->lock);
if (!priv->conn) {
g_set_error_literal(err, GVIR_CONNECTION_ERROR,
@@ -742,7 +767,7 @@ gboolean gvir_connection_fetch_storage_pools(GVirConnection *conn,
GCancellable *cancellable,
GError **err)
{
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
GHashTable *pools;
gchar **inactive = NULL;
gint ninactive = 0;
@@ -753,6 +778,12 @@ gboolean gvir_connection_fetch_storage_pools(GVirConnection *conn,
virConnectPtr vconn = NULL;
GError *lerr = NULL;
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), FALSE);
+ g_return_val_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable),
+ FALSE);
+ g_return_val_if_fail((err == NULL) || (*err == NULL), FALSE);
+
+ priv = conn->priv;
g_mutex_lock(priv->lock);
if (!priv->conn) {
g_set_error_literal(err, GVIR_CONNECTION_ERROR,
@@ -891,6 +922,9 @@ void gvir_connection_fetch_domains_async(GVirConnection *conn,
{
GSimpleAsyncResult *res;
+ g_return_if_fail(GVIR_IS_CONNECTION(conn));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
+
res = g_simple_async_result_new(G_OBJECT(conn),
callback,
user_data,
@@ -950,6 +984,9 @@ void gvir_connection_fetch_storage_pools_async(GVirConnection *conn,
{
GSimpleAsyncResult *res;
+ g_return_if_fail(GVIR_IS_CONNECTION(conn));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
+
res = g_simple_async_result_new(G_OBJECT(conn),
callback,
user_data,
@@ -983,8 +1020,9 @@ gboolean gvir_connection_fetch_storage_pools_finish(GVirConnection *conn,
const gchar *gvir_connection_get_uri(GVirConnection *conn)
{
- GVirConnectionPrivate *priv = conn->priv;
- return priv->uri;
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), NULL);
+
+ return conn->priv->uri;
}
static void gvir_domain_ref(gpointer obj, gpointer ignore G_GNUC_UNUSED)
@@ -1004,9 +1042,12 @@ static void gvir_domain_ref(gpointer obj, gpointer ignore G_GNUC_UNUSED)
*/
GList *gvir_connection_get_domains(GVirConnection *conn)
{
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
GList *domains = NULL;
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), NULL);
+
+ priv = conn->priv;
g_mutex_lock(priv->lock);
if (priv->domains != NULL) {
domains = g_hash_table_get_values(priv->domains);
@@ -1030,9 +1071,12 @@ GList *gvir_connection_get_domains(GVirConnection *conn)
*/
GList *gvir_connection_get_storage_pools(GVirConnection *conn)
{
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
GList *pools = NULL;
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), NULL);
+
+ priv = conn->priv;
g_mutex_lock(priv->lock);
if (priv->pools != NULL) {
pools = g_hash_table_get_values(priv->pools);
@@ -1054,8 +1098,13 @@ GList *gvir_connection_get_storage_pools(GVirConnection *conn)
GVirDomain *gvir_connection_get_domain(GVirConnection *conn,
const gchar *uuid)
{
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
GVirDomain *dom;
+
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), NULL);
+ g_return_val_if_fail(uuid != NULL, NULL);
+
+ priv = conn->priv;
g_mutex_lock(priv->lock);
dom = g_hash_table_lookup(priv->domains, uuid);
if (dom)
@@ -1075,9 +1124,13 @@ GVirDomain *gvir_connection_get_domain(GVirConnection *conn,
GVirStoragePool *gvir_connection_get_storage_pool(GVirConnection *conn,
const gchar *uuid)
{
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
GVirStoragePool *pool;
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), NULL);
+ g_return_val_if_fail(uuid != NULL, NULL);
+
+ priv = conn->priv;
g_mutex_lock(priv->lock);
pool = g_hash_table_lookup(priv->pools, uuid);
if (pool)
@@ -1098,10 +1151,13 @@ GVirStoragePool *gvir_connection_get_storage_pool(GVirConnection *conn,
GVirDomain *gvir_connection_find_domain_by_id(GVirConnection *conn,
gint id)
{
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
GHashTableIter iter;
gpointer key, value;
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), NULL);
+
+ priv = conn->priv;
g_mutex_lock(priv->lock);
g_hash_table_iter_init(&iter, priv->domains);
@@ -1132,10 +1188,14 @@ GVirDomain *gvir_connection_find_domain_by_id(GVirConnection *conn,
GVirDomain *gvir_connection_find_domain_by_name(GVirConnection *conn,
const gchar *name)
{
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
GHashTableIter iter;
gpointer key, value;
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), NULL);
+ g_return_val_if_fail(name != NULL, NULL);
+
+ priv = conn->priv;
g_mutex_lock(priv->lock);
g_hash_table_iter_init(&iter, priv->domains);
@@ -1168,10 +1228,14 @@ GVirDomain *gvir_connection_find_domain_by_name(GVirConnection *conn,
GVirStoragePool *gvir_connection_find_storage_pool_by_name(GVirConnection *conn,
const gchar *name)
{
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
GHashTableIter iter;
gpointer key, value;
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), NULL);
+ g_return_val_if_fail(name != NULL, NULL);
+
+ priv = conn->priv;
g_mutex_lock(priv->lock);
g_hash_table_iter_init(&iter, priv->pools);
@@ -1253,12 +1317,17 @@ GVirDomain *gvir_connection_create_domain(GVirConnection *conn,
{
gchar *xml;
virDomainPtr handle;
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
+
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), NULL);
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN(conf), NULL);
+ g_return_val_if_fail((err == NULL) || (*err == NULL), NULL);
xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf));
g_return_val_if_fail(xml != NULL, NULL);
+ priv = conn->priv;
handle = virDomainDefineXML(priv->conn, xml);
g_free(xml);
if (!handle) {
@@ -1302,12 +1371,17 @@ GVirDomain *gvir_connection_start_domain(GVirConnection *conn,
{
gchar *xml;
virDomainPtr handle;
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
+
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), NULL);
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN(conf), NULL);
+ g_return_val_if_fail((err == NULL) || (*err == NULL), NULL);
xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf));
g_return_val_if_fail(xml != NULL, NULL);
+ priv = conn->priv;
handle = virDomainCreateXML(priv->conn, xml, flags);
g_free(xml);
if (!handle) {
@@ -1350,12 +1424,17 @@ GVirStoragePool *gvir_connection_create_storage_pool
GError **err) {
const gchar *xml;
virStoragePoolPtr handle;
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
+
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), NULL);
+ g_return_val_if_fail(GVIR_CONFIG_IS_STORAGE_POOL(conf), NULL);
+ g_return_val_if_fail((err == NULL) || (*err == NULL), NULL);
xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf));
g_return_val_if_fail(xml != NULL, NULL);
+ priv = conn->priv;
if (!(handle = virStoragePoolDefineXML(priv->conn, xml, flags))) {
gvir_set_error_literal(err, GVIR_CONNECTION_ERROR,
flags,
@@ -1390,10 +1469,14 @@ GVirStoragePool *gvir_connection_create_storage_pool
GVirNodeInfo *gvir_connection_get_node_info(GVirConnection *conn,
GError **err)
{
- GVirConnectionPrivate *priv = conn->priv;
+ GVirConnectionPrivate *priv;
virNodeInfo info;
GVirNodeInfo *ret;
+ g_return_val_if_fail(GVIR_IS_CONNECTION(conn), NULL);
+ g_return_val_if_fail((err == NULL) || (*err == NULL), NULL);
+
+ priv = conn->priv;
if (virNodeGetInfo(priv->conn, &info) < 0) {
gvir_set_error_literal(err, GVIR_CONNECTION_ERROR,
0,
@@ -1480,6 +1563,9 @@ void gvir_connection_get_capabilities_async(GVirConnection *conn,
{
GSimpleAsyncResult *res;
+ g_return_if_fail(GVIR_IS_CONNECTION(conn));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
+
res = g_simple_async_result_new(G_OBJECT(conn),
callback,
user_data,
diff --git a/libvirt-gobject/libvirt-gobject-domain-device.c b/libvirt-gobject/libvirt-gobject-domain-device.c
index 9a65468..f2f3dfc 100644
--- a/libvirt-gobject/libvirt-gobject-domain-device.c
+++ b/libvirt-gobject/libvirt-gobject-domain-device.c
@@ -167,6 +167,8 @@ virDomainPtr gvir_domain_device_get_domain_handle(GVirDomainDevice *self)
*/
GVirDomain *gvir_domain_device_get_domain(GVirDomainDevice *device)
{
+ g_return_val_if_fail(GVIR_IS_DOMAIN_DEVICE(device), NULL);
+
return g_object_ref (device->priv->domain);
}
@@ -180,6 +182,8 @@ GVirDomain *gvir_domain_device_get_domain(GVirDomainDevice *device)
*/
GVirConfigDomainDevice *gvir_domain_device_get_config(GVirDomainDevice *device)
{
+ g_return_val_if_fail(GVIR_IS_DOMAIN_DEVICE(device), NULL);
+
return g_object_ref (device->priv->config);
}
diff --git a/libvirt-gobject/libvirt-gobject-domain-disk.c b/libvirt-gobject/libvirt-gobject-domain-disk.c
index 607e26c..46b47fd 100644
--- a/libvirt-gobject/libvirt-gobject-domain-disk.c
+++ b/libvirt-gobject/libvirt-gobject-domain-disk.c
@@ -124,6 +124,7 @@ GVirDomainDiskStats *gvir_domain_disk_get_stats(GVirDomainDisk *self, GError **e
const gchar *path;
g_return_val_if_fail(GVIR_IS_DOMAIN_DISK(self), NULL);
+ g_return_val_if_fail((err == NULL) || (*err == NULL), NULL);
handle = gvir_domain_device_get_domain_handle(GVIR_DOMAIN_DEVICE(self));
path = gvir_domain_disk_get_path (self);
diff --git a/libvirt-gobject/libvirt-gobject-domain-interface.c b/libvirt-gobject/libvirt-gobject-domain-interface.c
index 7087cbc..3ae9a46 100644
--- a/libvirt-gobject/libvirt-gobject-domain-interface.c
+++ b/libvirt-gobject/libvirt-gobject-domain-interface.c
@@ -126,6 +126,7 @@ GVirDomainInterfaceStats *gvir_domain_interface_get_stats(GVirDomainInterface *s
const gchar *path;
g_return_val_if_fail(GVIR_IS_DOMAIN_INTERFACE(self), NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
handle = gvir_domain_device_get_domain_handle(GVIR_DOMAIN_DEVICE(self));
path = gvir_domain_interface_get_path (self);
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
index d06d4d5..11a073c 100644
--- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c
+++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
@@ -161,6 +161,7 @@ G_DEFINE_BOXED_TYPE(GVirDomainSnapshotHandle, gvir_domain_snapshot_handle,
const gchar *gvir_domain_snapshot_get_name(GVirDomainSnapshot *snapshot)
{
+ g_return_val_if_fail(GVIR_IS_DOMAIN_SNAPSHOT(snapshot), NULL);
#if 0
GVirDomainSnapshotPrivate *priv = snapshot->priv;
const char *name;
@@ -194,9 +195,13 @@ GVirConfigDomainSnapshot *gvir_domain_snapshot_get_config
guint flags,
GError **err)
{
- GVirDomainSnapshotPrivate *priv = snapshot->priv;
+ GVirDomainSnapshotPrivate *priv;
gchar *xml;
+ g_return_val_if_fail(GVIR_IS_DOMAIN_SNAPSHOT(snapshot), NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
+
+ priv = snapshot->priv;
if (!(xml = virDomainSnapshotGetXMLDesc(priv->handle, flags))) {
gvir_set_error_literal(err, GVIR_DOMAIN_SNAPSHOT_ERROR,
0,
diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index 9be568a..59af63f 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -274,9 +274,12 @@ G_DEFINE_BOXED_TYPE(GVirDomainInfo, gvir_domain_info,
const gchar *gvir_domain_get_name(GVirDomain *dom)
{
- GVirDomainPrivate *priv = dom->priv;
+ GVirDomainPrivate *priv;
const char *name;
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), NULL);
+
+ priv = dom->priv;
if (!(name = virDomainGetName(priv->handle))) {
g_warning("Failed to get domain name on %p", priv->handle);
return NULL;
@@ -296,9 +299,13 @@ const gchar *gvir_domain_get_uuid(GVirDomain *dom)
gint gvir_domain_get_id(GVirDomain *dom,
GError **err)
{
- GVirDomainPrivate *priv = dom->priv;
+ GVirDomainPrivate *priv;
gint ret;
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), -1);
+ g_return_val_if_fail(err == NULL || *err == NULL, -1);
+
+ priv = dom->priv;
if ((ret = virDomainGetID(priv->handle)) < 0) {
gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
0,
@@ -317,9 +324,13 @@ gboolean gvir_domain_start(GVirDomain *dom,
guint flags,
GError **err)
{
- GVirDomainPrivate *priv = dom->priv;
+ GVirDomainPrivate *priv;
int ret;
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
+ priv = dom->priv;
if (flags)
ret = virDomainCreateWithFlags(priv->handle, flags);
else
@@ -344,8 +355,12 @@ gboolean gvir_domain_start(GVirDomain *dom,
gboolean gvir_domain_resume(GVirDomain *dom,
GError **err)
{
- GVirDomainPrivate *priv = dom->priv;
+ GVirDomainPrivate *priv;
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
+ priv = dom->priv;
if (virDomainResume(priv->handle) < 0) {
gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
0,
@@ -365,9 +380,13 @@ gboolean gvir_domain_stop(GVirDomain *dom,
guint flags,
GError **err)
{
- GVirDomainPrivate *priv = dom->priv;
+ GVirDomainPrivate *priv;
int ret;
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
+ priv = dom->priv;
if (flags)
ret = virDomainDestroyFlags(priv->handle, flags);
else
@@ -391,9 +410,13 @@ gboolean gvir_domain_delete(GVirDomain *dom,
guint flags,
GError **err)
{
- GVirDomainPrivate *priv = dom->priv;
+ GVirDomainPrivate *priv;
int ret;
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
+ priv = dom->priv;
if (flags)
ret = virDomainUndefineFlags(priv->handle, flags);
else
@@ -417,8 +440,12 @@ gboolean gvir_domain_shutdown(GVirDomain *dom,
guint flags G_GNUC_UNUSED,
GError **err)
{
- GVirDomainPrivate *priv = dom->priv;
+ GVirDomainPrivate *priv;
+
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+ priv = dom->priv;
if (virDomainShutdown(priv->handle) < 0) {
gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
0,
@@ -438,8 +465,12 @@ gboolean gvir_domain_reboot(GVirDomain *dom,
guint flags,
GError **err)
{
- GVirDomainPrivate *priv = dom->priv;
+ GVirDomainPrivate *priv;
+
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+ priv = dom->priv;
if (virDomainReboot(priv->handle, flags) < 0) {
gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
0,
@@ -462,9 +493,13 @@ GVirConfigDomain *gvir_domain_get_config(GVirDomain *dom,
guint flags,
GError **err)
{
- GVirDomainPrivate *priv = dom->priv;
+ GVirDomainPrivate *priv;
gchar *xml;
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
+
+ priv = dom->priv;
if (!(xml = virDomainGetXMLDesc(priv->handle, flags))) {
gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
0,
@@ -501,12 +536,13 @@ gboolean gvir_domain_set_config(GVirDomain *domain,
virConnectPtr conn;
virDomainPtr handle;
gchar uuid[VIR_UUID_STRING_BUFLEN];
- GVirDomainPrivate *priv = domain->priv;
+ GVirDomainPrivate *priv;
g_return_val_if_fail(GVIR_IS_DOMAIN (domain), FALSE);
g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN (conf), FALSE);
g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+ priv = domain->priv;
xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf));
g_return_val_if_fail(xml != NULL, FALSE);
@@ -556,10 +592,14 @@ gboolean gvir_domain_set_config(GVirDomain *domain,
GVirDomainInfo *gvir_domain_get_info(GVirDomain *dom,
GError **err)
{
- GVirDomainPrivate *priv = dom->priv;
+ GVirDomainPrivate *priv;
virDomainInfo info;
GVirDomainInfo *ret;
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
+
+ priv = dom->priv;
if (virDomainGetInfo(priv->handle, &info) < 0) {
gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
0,
@@ -613,6 +653,7 @@ void gvir_domain_get_info_async(GVirDomain *dom,
GSimpleAsyncResult *res;
g_return_if_fail(GVIR_IS_DOMAIN(dom));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
res = g_simple_async_result_new(G_OBJECT(dom),
callback,
@@ -679,6 +720,7 @@ gchar *gvir_domain_screenshot(GVirDomain *dom,
g_return_val_if_fail(GVIR_IS_DOMAIN(dom), NULL);
g_return_val_if_fail(GVIR_IS_STREAM(stream), NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
priv = dom->priv;
g_object_get(stream, "handle", &st, NULL);
@@ -725,6 +767,7 @@ gboolean gvir_domain_open_console(GVirDomain *dom,
g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
g_return_val_if_fail(GVIR_IS_STREAM(stream), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
priv = dom->priv;
g_object_get(stream, "handle", &st, NULL);
@@ -769,6 +812,7 @@ gboolean gvir_domain_open_graphics(GVirDomain *dom,
gboolean ret = FALSE;
g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
priv = dom->priv;
@@ -804,6 +848,7 @@ gboolean gvir_domain_suspend (GVirDomain *dom,
gboolean ret = FALSE;
g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
if (virDomainSuspend(dom->priv->handle) < 0) {
gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
@@ -834,6 +879,7 @@ gboolean gvir_domain_save (GVirDomain *dom,
GError **err)
{
g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
if (virDomainManagedSave(dom->priv->handle, flags) < 0) {
gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
@@ -889,6 +935,7 @@ void gvir_domain_save_async (GVirDomain *dom,
DomainSaveData *data;
g_return_if_fail(GVIR_IS_DOMAIN(dom));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
data = g_slice_new0(DomainSaveData);
data->flags = flags;
@@ -923,6 +970,7 @@ gboolean gvir_domain_save_finish (GVirDomain *dom,
g_return_val_if_fail(g_simple_async_result_is_valid(result, G_OBJECT(dom),
gvir_domain_save_async),
FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
if (g_simple_async_result_propagate_error(G_SIMPLE_ASYNC_RESULT(result), err))
return FALSE;
diff --git a/libvirt-gobject/libvirt-gobject-interface.c b/libvirt-gobject/libvirt-gobject-interface.c
index 883cf92..ecabb41 100644
--- a/libvirt-gobject/libvirt-gobject-interface.c
+++ b/libvirt-gobject/libvirt-gobject-interface.c
@@ -159,11 +159,12 @@ G_DEFINE_BOXED_TYPE(GVirInterfaceHandle, gvir_interface_handle,
const gchar *gvir_interface_get_name(GVirInterface *iface)
{
- GVirInterfacePrivate *priv = iface->priv;
const char *name;
- if (!(name = virInterfaceGetName(priv->handle))) {
- g_warning("Failed to get interface name on %p", priv->handle);
+ g_return_val_if_fail(GVIR_IS_INTERFACE(iface), NULL);
+
+ if (!(name = virInterfaceGetName(iface->priv->handle))) {
+ g_warning("Failed to get interface name on %p", iface->priv->handle);
return NULL;
}
@@ -184,9 +185,13 @@ GVirConfigInterface *gvir_interface_get_config(GVirInterface *iface,
guint flags,
GError **err)
{
- GVirInterfacePrivate *priv = iface->priv;
+ GVirInterfacePrivate *priv;
gchar *xml;
+ g_return_val_if_fail(GVIR_IS_INTERFACE(iface), NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
+
+ priv = iface->priv;
if (!(xml = virInterfaceGetXMLDesc(priv->handle, flags))) {
gvir_set_error_literal(err, GVIR_INTERFACE_ERROR,
0,
diff --git a/libvirt-gobject/libvirt-gobject-manager.c b/libvirt-gobject/libvirt-gobject-manager.c
index c44e711..d0a2839 100644
--- a/libvirt-gobject/libvirt-gobject-manager.c
+++ b/libvirt-gobject/libvirt-gobject-manager.c
@@ -131,8 +131,12 @@ GVirManager *gvir_manager_new(void)
void gvir_manager_add_connection(GVirManager *man,
GVirConnection *conn)
{
- GVirManagerPrivate *priv = man->priv;
+ GVirManagerPrivate *priv;
+
+ g_return_if_fail(GVIR_IS_MANAGER(man));
+ g_return_if_fail(GVIR_IS_CONNECTION(conn));
+ priv = man->priv;
g_mutex_lock(priv->lock);
g_object_ref(conn);
priv->connections = g_list_append(priv->connections, conn);
@@ -147,8 +151,12 @@ void gvir_manager_add_connection(GVirManager *man,
void gvir_manager_remove_connection(GVirManager *man,
GVirConnection *conn)
{
- GVirManagerPrivate *priv = man->priv;
+ GVirManagerPrivate *priv;
+
+ g_return_if_fail(GVIR_IS_MANAGER(man));
+ g_return_if_fail(GVIR_IS_CONNECTION(conn));
+ priv = man->priv;
g_mutex_lock(priv->lock);
priv->connections = g_list_remove(priv->connections, conn);
g_mutex_unlock(priv->lock);
@@ -167,16 +175,18 @@ void gvir_manager_remove_connection(GVirManager *man,
*/
GList *gvir_manager_get_connections(GVirManager *man)
{
- GVirManagerPrivate *priv = man->priv;
+ GList *tmp;
- GList *tmp = priv->connections;
+ g_return_val_if_fail(GVIR_IS_MANAGER(man), NULL);
+
+ tmp = man->priv->connections;
while (tmp) {
GVirConnection *conn = tmp->data;
g_object_ref(conn);
tmp = tmp->next;
}
- return g_list_copy(priv->connections);
+ return g_list_copy(man->priv->connections);
}
@@ -190,9 +200,12 @@ GList *gvir_manager_get_connections(GVirManager *man)
GVirConnection *gvir_manager_find_connection_by_uri(GVirManager *man,
const gchar *uri)
{
- GVirManagerPrivate *priv = man->priv;
+ GList *tmp;
- GList *tmp = priv->connections;
+ g_return_val_if_fail(GVIR_IS_MANAGER(man), NULL);
+ g_return_val_if_fail(uri != NULL, NULL);
+
+ tmp = man->priv->connections;
while (tmp) {
GVirConnection *conn = tmp->data;
if (g_strcmp0(gvir_connection_get_uri(conn), uri) == 0)
diff --git a/libvirt-gobject/libvirt-gobject-network-filter.c b/libvirt-gobject/libvirt-gobject-network-filter.c
index b3db236..00b1ed2 100644
--- a/libvirt-gobject/libvirt-gobject-network-filter.c
+++ b/libvirt-gobject/libvirt-gobject-network-filter.c
@@ -182,11 +182,13 @@ G_DEFINE_BOXED_TYPE(GVirNetworkFilterHandle, gvir_network_filter_handle,
const gchar *gvir_network_filter_get_name(GVirNetworkFilter *filter)
{
- GVirNetworkFilterPrivate *priv = filter->priv;
const char *name;
- if (!(name = virNWFilterGetName(priv->handle))) {
- g_warning("Failed to get network_filter name on %p", priv->handle);
+ g_return_val_if_fail(GVIR_IS_NETWORK_FILTER(filter), NULL);
+
+ if (!(name = virNWFilterGetName(filter->priv->handle))) {
+ g_warning("Failed to get network_filter name on %p",
+ filter->priv->handle);
return NULL;
}
@@ -217,9 +219,13 @@ GVirConfigNetworkFilter *gvir_network_filter_get_config
guint flags,
GError **err)
{
- GVirNetworkFilterPrivate *priv = filter->priv;
+ GVirNetworkFilterPrivate *priv;
gchar *xml;
+ g_return_val_if_fail(GVIR_IS_NETWORK_FILTER(filter), NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
+
+ priv = filter->priv;
if (!(xml = virNWFilterGetXMLDesc(priv->handle, flags))) {
gvir_set_error_literal(err, GVIR_NETWORK_FILTER_ERROR,
0,
diff --git a/libvirt-gobject/libvirt-gobject-network.c b/libvirt-gobject/libvirt-gobject-network.c
index 17378ec..9625ece 100644
--- a/libvirt-gobject/libvirt-gobject-network.c
+++ b/libvirt-gobject/libvirt-gobject-network.c
@@ -180,11 +180,12 @@ G_DEFINE_BOXED_TYPE(GVirNetworkHandle, gvir_network_handle,
const gchar *gvir_network_get_name(GVirNetwork *network)
{
- GVirNetworkPrivate *priv = network->priv;
const char *name;
- if (!(name = virNetworkGetName(priv->handle))) {
- g_warning("Failed to get network name on %p", priv->handle);
+ g_return_val_if_fail(GVIR_IS_NETWORK(network), NULL);
+
+ if (!(name = virNetworkGetName(network->priv->handle))) {
+ g_warning("Failed to get network name on %p", network->priv->handle);
return NULL;
}
@@ -212,9 +213,13 @@ GVirConfigNetwork *gvir_network_get_config(GVirNetwork *network,
guint flags,
GError **err)
{
- GVirNetworkPrivate *priv = network->priv;
+ GVirNetworkPrivate *priv;
gchar *xml;
+ g_return_val_if_fail(GVIR_IS_NETWORK(network), NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
+
+ priv = network->priv;
if (!(xml = virNetworkGetXMLDesc(priv->handle, flags))) {
gvir_set_error_literal(err, GVIR_NETWORK_ERROR,
0,
diff --git a/libvirt-gobject/libvirt-gobject-node-device.c b/libvirt-gobject/libvirt-gobject-node-device.c
index 0a4b6a6..eb314ed 100644
--- a/libvirt-gobject/libvirt-gobject-node-device.c
+++ b/libvirt-gobject/libvirt-gobject-node-device.c
@@ -159,11 +159,13 @@ G_DEFINE_BOXED_TYPE(GVirNodeDeviceHandle, gvir_node_device_handle,
const gchar *gvir_node_device_get_name(GVirNodeDevice *device)
{
- GVirNodeDevicePrivate *priv = device->priv;
const char *name;
- if (!(name = virNodeDeviceGetName(priv->handle))) {
- g_warning("Failed to get node_device name on %p", priv->handle);
+ g_return_val_if_fail(GVIR_IS_NODE_DEVICE(device), NULL);
+
+ if (!(name = virNodeDeviceGetName(device->priv->handle))) {
+ g_warning("Failed to get node_device name on %p",
+ device->priv->handle);
return NULL;
}
@@ -185,9 +187,13 @@ GVirConfigNodeDevice *gvir_node_device_get_config(GVirNodeDevice *device,
guint flags,
GError **err)
{
- GVirNodeDevicePrivate *priv = device->priv;
+ GVirNodeDevicePrivate *priv;
gchar *xml;
+ g_return_val_if_fail(GVIR_IS_NODE_DEVICE(device), NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
+
+ priv = device->priv;
if (!(xml = virNodeDeviceGetXMLDesc(priv->handle, flags))) {
gvir_set_error_literal(err, GVIR_NODE_DEVICE_ERROR,
0,
diff --git a/libvirt-gobject/libvirt-gobject-secret.c b/libvirt-gobject/libvirt-gobject-secret.c
index b0aff13..8bfee88 100644
--- a/libvirt-gobject/libvirt-gobject-secret.c
+++ b/libvirt-gobject/libvirt-gobject-secret.c
@@ -201,9 +201,13 @@ GVirConfigSecret *gvir_secret_get_config(GVirSecret *secret,
guint flags,
GError **err)
{
- GVirSecretPrivate *priv = secret->priv;
+ GVirSecretPrivate *priv;
gchar *xml;
+ g_return_val_if_fail(GVIR_IS_SECRET(secret), NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
+
+ priv = secret->priv;
if (!(xml = virSecretGetXMLDesc(priv->handle, flags))) {
gvir_set_error_literal(err, GVIR_SECRET_ERROR,
0,
diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c
index e79c8e5..7f50037 100644
--- a/libvirt-gobject/libvirt-gobject-storage-pool.c
+++ b/libvirt-gobject/libvirt-gobject-storage-pool.c
@@ -211,11 +211,12 @@ G_DEFINE_BOXED_TYPE(GVirStoragePoolInfo, gvir_storage_pool_info,
const gchar *gvir_storage_pool_get_name(GVirStoragePool *pool)
{
- GVirStoragePoolPrivate *priv = pool->priv;
const char *name;
- if (!(name = virStoragePoolGetName(priv->handle))) {
- g_warning("Failed to get storage_pool name on %p", priv->handle);
+ g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), NULL);
+
+ if (!(name = virStoragePoolGetName(pool->priv->handle))) {
+ g_warning("Failed to get storage_pool name on %p", pool->priv->handle);
return NULL;
}
@@ -244,9 +245,13 @@ GVirConfigStoragePool *gvir_storage_pool_get_config(GVirStoragePool *pool,
guint flags,
GError **err)
{
- GVirStoragePoolPrivate *priv = pool->priv;
+ GVirStoragePoolPrivate *priv;
gchar *xml;
+ g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
+
+ priv = pool->priv;
if (!(xml = virStoragePoolGetXMLDesc(priv->handle, flags))) {
gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR,
0,
@@ -271,10 +276,14 @@ GVirConfigStoragePool *gvir_storage_pool_get_config(GVirStoragePool *pool,
GVirStoragePoolInfo *gvir_storage_pool_get_info(GVirStoragePool *pool,
GError **err)
{
- GVirStoragePoolPrivate *priv = pool->priv;
+ GVirStoragePoolPrivate *priv;
virStoragePoolInfo info;
GVirStoragePoolInfo *ret;
+ g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
+
+ priv = pool->priv;
if (virStoragePoolGetInfo(priv->handle, &info) < 0) {
if (err)
*err = gvir_error_new_literal(GVIR_STORAGE_POOL_ERROR,
@@ -346,7 +355,7 @@ gboolean gvir_storage_pool_refresh(GVirStoragePool *pool,
GCancellable *cancellable,
GError **err)
{
- GVirStoragePoolPrivate *priv = pool->priv;
+ GVirStoragePoolPrivate *priv;
GHashTable *vol_hash;
gchar **volumes = NULL;
gint nvolumes = 0;
@@ -355,6 +364,12 @@ gboolean gvir_storage_pool_refresh(GVirStoragePool *pool,
virStoragePoolPtr vpool = NULL;
GError *lerr = NULL;
+ g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE);
+ g_return_val_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable),
+ FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
+ priv = pool->priv;
vpool = priv->handle;
if (virStoragePoolRefresh(vpool, 0) < 0) {
@@ -447,6 +462,9 @@ void gvir_storage_pool_refresh_async(GVirStoragePool *pool,
{
GSimpleAsyncResult *res;
+ g_return_if_fail(GVIR_IS_STORAGE_POOL(pool));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
+
res = g_simple_async_result_new(G_OBJECT(pool),
callback,
user_data,
@@ -495,9 +513,12 @@ static void gvir_storage_vol_ref(gpointer obj, gpointer ignore G_GNUC_UNUSED)
*/
GList *gvir_storage_pool_get_volumes(GVirStoragePool *pool)
{
- GVirStoragePoolPrivate *priv = pool->priv;
+ GVirStoragePoolPrivate *priv;
GList *volumes = NULL;
+ g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), NULL);
+
+ priv = pool->priv;
g_mutex_lock(priv->lock);
if (priv->volumes != NULL) {
volumes = g_hash_table_get_values(priv->volumes);
@@ -520,9 +541,12 @@ GList *gvir_storage_pool_get_volumes(GVirStoragePool *pool)
GVirStorageVol *gvir_storage_pool_get_volume(GVirStoragePool *pool,
const gchar *name)
{
- GVirStoragePoolPrivate *priv = pool->priv;
+ GVirStoragePoolPrivate *priv;
GVirStorageVol *volume;
+ g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), NULL);
+
+ priv = pool->priv;
g_mutex_lock(priv->lock);
volume = g_hash_table_lookup(priv->volumes, name);
if (volume)
@@ -548,12 +572,17 @@ GVirStorageVol *gvir_storage_pool_create_volume
{
const gchar *xml;
virStorageVolPtr handle;
- GVirStoragePoolPrivate *priv = pool->priv;
+ GVirStoragePoolPrivate *priv;
+
+ g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), NULL);
+ g_return_val_if_fail(GVIR_CONFIG_IS_STORAGE_VOL(conf), NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(conf));
g_return_val_if_fail(xml != NULL, NULL);
+ priv = pool->priv;
if (!(handle = virStorageVolCreateXML(priv->handle, xml, 0))) {
gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR,
0,
@@ -593,6 +622,9 @@ gboolean gvir_storage_pool_build (GVirStoragePool *pool,
guint flags,
GError **err)
{
+ g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
if (virStoragePoolBuild(pool->priv->handle, flags)) {
gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR,
0,
@@ -644,6 +676,9 @@ void gvir_storage_pool_build_async (GVirStoragePool *pool,
GSimpleAsyncResult *res;
StoragePoolBuildData *data;
+ g_return_if_fail(GVIR_IS_STORAGE_POOL(pool));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
+
data = g_slice_new0(StoragePoolBuildData);
data->flags = flags;
@@ -675,6 +710,7 @@ gboolean gvir_storage_pool_build_finish(GVirStoragePool *pool,
g_return_val_if_fail(g_simple_async_result_is_valid(result, G_OBJECT(pool),
gvir_storage_pool_build_async),
FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
if (g_simple_async_result_propagate_error(G_SIMPLE_ASYNC_RESULT(result),
err))
@@ -695,6 +731,9 @@ gboolean gvir_storage_pool_start (GVirStoragePool *pool,
guint flags,
GError **err)
{
+ g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
if (virStoragePoolCreate(pool->priv->handle, flags)) {
gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR,
0,
@@ -742,6 +781,9 @@ void gvir_storage_pool_start_async (GVirStoragePool *pool,
GSimpleAsyncResult *res;
StoragePoolBuildData *data;
+ g_return_if_fail(GVIR_IS_STORAGE_POOL(pool));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
+
data = g_slice_new0(StoragePoolBuildData);
data->flags = flags;
@@ -773,6 +815,7 @@ gboolean gvir_storage_pool_start_finish(GVirStoragePool *pool,
g_return_val_if_fail(g_simple_async_result_is_valid(result, G_OBJECT(pool),
gvir_storage_pool_start_async),
FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
if (g_simple_async_result_propagate_error(G_SIMPLE_ASYNC_RESULT(result),
err))
diff --git a/libvirt-gobject/libvirt-gobject-storage-vol.c b/libvirt-gobject/libvirt-gobject-storage-vol.c
index 9e59576..6f60fcd 100644
--- a/libvirt-gobject/libvirt-gobject-storage-vol.c
+++ b/libvirt-gobject/libvirt-gobject-storage-vol.c
@@ -195,11 +195,12 @@ G_DEFINE_BOXED_TYPE(GVirStorageVolInfo, gvir_storage_vol_info,
const gchar *gvir_storage_vol_get_name(GVirStorageVol *vol)
{
- GVirStorageVolPrivate *priv = vol->priv;
const char *name;
- if (!(name = virStorageVolGetName(priv->handle))) {
- g_warning("Failed to get storage_vol name on %p", priv->handle);
+ g_return_val_if_fail(GVIR_IS_STORAGE_VOL(vol), NULL);
+
+ if (!(name = virStorageVolGetName(vol->priv->handle))) {
+ g_warning("Failed to get storage_vol name on %p", vol->priv->handle);
return NULL;
}
@@ -208,13 +209,15 @@ const gchar *gvir_storage_vol_get_name(GVirStorageVol *vol)
const gchar *gvir_storage_vol_get_path(GVirStorageVol *vol, GError **error)
{
- GVirStorageVolPrivate *priv = vol->priv;
const char *path;
- if (!(path = virStorageVolGetPath(priv->handle))) {
+ g_return_val_if_fail(GVIR_IS_STORAGE_VOL(vol), NULL);
+ g_return_val_if_fail(error == NULL || *error == NULL, NULL);
+
+ if (!(path = virStorageVolGetPath(vol->priv->handle))) {
gvir_set_error(error, GVIR_STORAGE_VOL_ERROR, 0,
"Failed to get storage_vol path on %p",
- priv->handle);
+ vol->priv->handle);
return NULL;
}
@@ -234,9 +237,13 @@ GVirConfigStorageVol *gvir_storage_vol_get_config(GVirStorageVol *vol,
guint flags,
GError **err)
{
- GVirStorageVolPrivate *priv = vol->priv;
+ GVirStorageVolPrivate *priv;
gchar *xml;
+ g_return_val_if_fail(GVIR_IS_STORAGE_VOL(vol), NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
+
+ priv = vol->priv;
if (!(xml = virStorageVolGetXMLDesc(priv->handle, flags))) {
gvir_set_error_literal(err, GVIR_STORAGE_VOL_ERROR,
0,
@@ -261,10 +268,14 @@ GVirConfigStorageVol *gvir_storage_vol_get_config(GVirStorageVol *vol,
GVirStorageVolInfo *gvir_storage_vol_get_info(GVirStorageVol *vol,
GError **err)
{
- GVirStorageVolPrivate *priv = vol->priv;
+ GVirStorageVolPrivate *priv;
virStorageVolInfo info;
GVirStorageVolInfo *ret;
+ g_return_val_if_fail(GVIR_IS_STORAGE_VOL(vol), NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, NULL);
+
+ priv = vol->priv;
if (virStorageVolGetInfo(priv->handle, &info) < 0) {
if (err)
*err = gvir_error_new_literal(GVIR_STORAGE_VOL_ERROR,
@@ -295,6 +306,9 @@ gboolean gvir_storage_vol_delete(GVirStorageVol *vol,
guint flags,
GError **err)
{
+ g_return_val_if_fail(GVIR_IS_STORAGE_VOL(vol), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
if (virStorageVolDelete(vol->priv->handle, flags) < 0) {
gvir_set_error_literal(err,
GVIR_STORAGE_VOL_ERROR,
@@ -322,6 +336,9 @@ gboolean gvir_storage_vol_resize(GVirStorageVol *vol,
guint flags,
GError **err)
{
+ g_return_val_if_fail(GVIR_IS_STORAGE_VOL(vol), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
if (virStorageVolResize(vol->priv->handle, capacity, flags) < 0) {
gvir_set_error_literal(err,
GVIR_STORAGE_VOL_ERROR,
diff --git a/libvirt-gobject/libvirt-gobject-stream.c b/libvirt-gobject/libvirt-gobject-stream.c
index 60da4bc..3b98023 100644
--- a/libvirt-gobject/libvirt-gobject-stream.c
+++ b/libvirt-gobject/libvirt-gobject-stream.c
@@ -379,7 +379,9 @@ gvir_stream_receive_all(GVirStream *self,
int r;
g_return_val_if_fail(GVIR_IS_STREAM(self), -1);
+ g_return_val_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable), -1);
g_return_val_if_fail(func != NULL, -1);
+ g_return_val_if_fail(error == NULL || *error == NULL, -1);
r = virStreamRecvAll(self->priv->handle, stream_sink, &helper);
if (r < 0) {
@@ -424,6 +426,8 @@ gssize gvir_stream_send(GVirStream *self,
g_return_val_if_fail(GVIR_IS_STREAM(self), -1);
g_return_val_if_fail(buffer != NULL, -1);
+ g_return_val_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable), -1);
+ g_return_val_if_fail(error == NULL || *error == NULL, -1);
if (g_cancellable_set_error_if_cancelled (cancellable, error))
return -1;
@@ -491,7 +495,9 @@ gvir_stream_send_all(GVirStream *self,
int r;
g_return_val_if_fail(GVIR_IS_STREAM(self), -1);
+ g_return_val_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable), -1);
g_return_val_if_fail(func != NULL, -1);
+ g_return_val_if_fail(error == NULL || *error == NULL, -1);
r = virStreamSendAll(self->priv->handle, stream_source, &helper);
if (r < 0) {
--
1.7.10.1
12 years, 6 months
[libvirt] [PATCH v2 0/2] Rework RPC message buffer
by Michal Privoznik
This patch set tries to fix corner cases where libvirt runs on huge
system, e.g. 4K CPU monster. In these cases, capabilities XML is
enormously big, as we are transferring info about each singe CPU core
(to which NUMA node it belongs, etc.). This XML is bigger than our
RPC limit, therefore users cannot get it as it is dropped on server,
leaving them with inability to connect. Therefore we need to increase
those limits (whole RPC message and RPC string). However, simple
lifting up will work, but increase mem usage.
Therefore I've reworked RPC buffer handling: changed it from
'statically' to dynamically allocated.
So in most cases - when small messages are sent - this will even
decrease our memory consumption. Leaving us flexible for corner cases
described above.
On the other hand, I realize we've had our history with RPC breakage.
So I think I'll require more than 1 ACK before pushing.
diff to v1:
-couple of fixes (1/2)
-increased other limits as well (2/2)
Michal Privoznik (2):
rpc: Switch to dynamically allocated message buffer
rpc: Size up RPC limits
src/remote/remote_protocol.x | 20 +-
src/rpc/virnetclient.c | 16 ++-
src/rpc/virnetmessage.c | 12 ++-
src/rpc/virnetmessage.h | 5 +-
src/rpc/virnetprotocol.x | 6 +-
src/rpc/virnetserverclient.c | 24 +++-
tests/virnetmessagetest.c | 393 +++++++++++++++++++++++-------------------
7 files changed, 279 insertions(+), 197 deletions(-)
--
1.7.8.5
12 years, 6 months
[libvirt] [PATCH v2] [TCK] nwfilter: Add test cases for ipset
by Stefan Berger
Add test cases for ipset support.
Since ipset may not be available on all system, the first line of the XML
file containing the test filter has been extended with a specially formatted
XML comment containing a command line test for whether the test case can be
run at all. The format of that line is:
<!-- #<command line test># -->
If the tests in this line don't succeed, the test case is skipped.
Also add a test case cleaning up the created ipset. Run this test after all
other tests using alphabetical ordering.
---
v2:
- addressed Eric Blake's comments
---
scripts/nwfilter/nwfilter2vmtest.sh | 36
+++++++--
scripts/nwfilter/nwfilterxml2fwallout/ipset-test.fwall | 39
++++++++++
scripts/nwfilter/nwfilterxml2fwallout/zzz-ipset-cleanup.fwall | 1
scripts/nwfilter/nwfilterxml2xmlin/ipset-test.xml | 25
++++++
scripts/nwfilter/nwfilterxml2xmlin/zzz-ipset-cleanup.xml | 5 +
5 files changed, 99 insertions(+), 7 deletions(-)
Index: libvirt-tck/scripts/nwfilter/nwfilterxml2xmlin/ipset-test.xml
===================================================================
--- /dev/null
+++ libvirt-tck/scripts/nwfilter/nwfilterxml2xmlin/ipset-test.xml
@@ -0,0 +1,25 @@
+<!-- #ipset help && iptables -t match-set -h && ipset list tck_test ||
ipset create tck_test hash:ip# -->
+<filter name='tck-testcase' chain='root'>
+ <uuid>5c6d49af-b071-6127-b4ec-6f8ed4b55335</uuid>
+ <rule action='accept' direction='out'>
+ <all ipset='tck_test' ipsetflags='src,dst' />
+ </rule>
+ <rule action='accept' direction='in'>
+ <all state='NONE' ipset='tck_test' ipsetflags='src,dst'
comment='in+NONE'/>
+ </rule>
+ <rule action='accept' direction='out'>
+ <all state='NONE' ipset='tck_test' ipsetflags='src,dst'
comment='out+NONE'/>
+ </rule>
+ <rule action='accept' direction='in'>
+ <all ipset='tck_test' ipsetflags='SRC,DST,SRC' />
+ </rule>
+ <rule action='accept' direction='in'>
+ <all ipset='tck_test' ipsetflags='SRC,dSt,SRC' />
+ </rule>
+ <rule action='accept' direction='in'>
+ <all ipset='$IPSETNAME' ipsetflags='src,dst' />
+ </rule>
+ <rule action='accept' direction='inout'>
+ <all ipset='$IPSETNAME' ipsetflags='src,dst' comment='inout'/>
+ </rule>
+</filter>
Index: libvirt-tck/scripts/nwfilter/nwfilter2vmtest.sh
===================================================================
--- libvirt-tck.orig/scripts/nwfilter/nwfilter2vmtest.sh
+++ libvirt-tck/scripts/nwfilter/nwfilter2vmtest.sh
@@ -107,6 +107,7 @@ checkExpectedOutput() {
ifname="$3"
flags="$4"
skipregex="$5"
+ skiptest="$6"
regex="s/${ORIG_IFNAME}/${ifname}/g"
tmpdir=$(mktmpdir)
@@ -147,6 +148,18 @@ checkExpectedOutput() {
break
fi
+ if [ -n "${skiptest}" ]; then
+ # treat all skips as passes
+ passctr=$(($passctr + 1))
+ [ $(($flags & $FLAG_VERBOSE)) -ne 0 ] && \
+ echo "SKIP ${xmlfile} : ${cmd}"
+ [ $(($flags & $FLAG_LIBVIRT_TEST)) -ne 0 ] && \
+ test_result $(($passctr + $failctr)) "" 0
+ [ $(($flags & $FLAG_TAP_TEST)) -ne 0 ] && \
+ tap_pass $(($passctr + $failctr)) "SKIP: ${xmlfile} :
${skiptest}"
+ break
+ fi
+
diff -w ${tmpfile} ${tmpfile2} >/dev/null
if [ $? -ne 0 ]; then
@@ -197,19 +210,27 @@ doTest() {
flags="$5"
testnum="$6"
ctr=0
+ skiptest=""
if [ ! -r "${xmlfile}" ]; then
echo "FAIL : Cannot access filter XML file ${xmlfile}."
return 1
fi
- ${VIRSH} nwfilter-define "${xmlfile}" > /dev/null
+ # Check whether we can run this test at all
+ cmd=$(sed -n '1 s/^<\!--[ ]*#\(.*\)#[ ]*-->/\1/p' ${xmlfile})
+ if [ -n "${cmd}" ]; then
+ eval "${cmd}" 2>/dev/null 1>/dev/null
+ [ $? -ne 0 ] && skiptest="${cmd}"
+ fi
+
+ [ -z "${skiptest}" ] && ${VIRSH} nwfilter-define "${xmlfile}" > /dev/null
checkExpectedOutput "${xmlfile}" "${fwallfile}" "${vm1name}"
"${flags}" \
- ""
+ "" "${skiptest}"
checkExpectedOutput "${TESTFILTERNAME}" "${TESTVM2FWALLDATA}" \
- "${vm2name}" "${flags}" ""
+ "${vm2name}" "${flags}" "" "${skiptest}"
if [ $(($flags & $FLAG_ATTACH)) -ne 0 ]; then
@@ -234,9 +255,9 @@ EOF
if [ $rc -eq 0 ]; then
checkExpectedOutput "${xmlfile}" "${fwallfile}" "${ATTACH_IFNAME}" \
- "${flags}" "(PRE|POST)ROUTING"
+ "${flags}" "(PRE|POST)ROUTING" "${skiptest}"
checkExpectedOutput "${TESTFILTERNAME}" "${TESTVM2FWALLDATA}" \
- "${vm2name}" "${flags}" "(PRE|POST)ROUTING"
+ "${vm2name}" "${flags}" "(PRE|POST)ROUTING" "${skiptest}"
msg=`${VIRSH} detach-device "${vm1name}" "${tmpfile}"`
if [ $? -ne 0 ]; then
echo "FAIL: Detach of interface failed."
@@ -246,9 +267,9 @@ EOF
# In case of TAP, run the test anyway so we get to the full number
# of tests
checkExpectedOutput "${xmlfile}" "${fwallfile}"
"${ATTACH_IFNAME}" \
- "${flags}" "" #"(PRE|POST)ROUTING"
+ "${flags}" "" "${skiptest}" #"(PRE|POST)ROUTING"
checkExpectedOutput "${TESTFILTERNAME}" "${TESTVM2FWALLDATA}" \
- "${vm2name}" "${flags}" #"(PRE|POST)ROUTING"
+ "${vm2name}" "${flags}" "${skiptest}" #"(PRE|POST)ROUTING"
fi
attachfailctr=$(($attachfailctr + 1))
@@ -357,6 +378,7 @@ createVM() {
<parameter name='C' value='1090'/>
<parameter name='C' value='1100'/>
<parameter name='C' value='1110'/>
+ <parameter name='IPSETNAME' value='tck_test'/>
</filterref>
<target dev='${vmname}'/>
</interface>
Index: libvirt-tck/scripts/nwfilter/nwfilterxml2fwallout/ipset-test.fwall
===================================================================
--- /dev/null
+++ libvirt-tck/scripts/nwfilter/nwfilterxml2fwallout/ipset-test.fwall
@@ -0,0 +1,39 @@
+#iptables -L FI-vnet0 -n
+Chain FI-vnet0 (1 references)
+target prot opt source destination
+RETURN all -- 0.0.0.0/0 0.0.0.0/0 state
NEW,ESTABLISHED ctdir REPLY match-set tck_test src,dst
+RETURN all -- 0.0.0.0/0 0.0.0.0/0 match-set
tck_test src,dst /* out+NONE */
+RETURN all -- 0.0.0.0/0 0.0.0.0/0 state
ESTABLISHED ctdir ORIGINAL match-set tck_test dst,src,dst
+RETURN all -- 0.0.0.0/0 0.0.0.0/0 state
ESTABLISHED ctdir ORIGINAL match-set tck_test dst,src,dst
+RETURN all -- 0.0.0.0/0 0.0.0.0/0 state
ESTABLISHED ctdir ORIGINAL match-set tck_test dst,src
+RETURN all -- 0.0.0.0/0 0.0.0.0/0 match-set
tck_test dst,src /* inout */
+#iptables -L FO-vnet0 -n
+Chain FO-vnet0 (1 references)
+target prot opt source destination
+ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state
ESTABLISHED ctdir ORIGINAL match-set tck_test dst,src
+ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 match-set
tck_test src,dst /* in+NONE */
+ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state
NEW,ESTABLISHED ctdir REPLY match-set tck_test src,dst,src
+ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state
NEW,ESTABLISHED ctdir REPLY match-set tck_test src,dst,src
+ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state
NEW,ESTABLISHED ctdir REPLY match-set tck_test src,dst
+ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 match-set
tck_test src,dst /* inout */
+#iptables -L HI-vnet0 -n
+Chain HI-vnet0 (1 references)
+target prot opt source destination
+RETURN all -- 0.0.0.0/0 0.0.0.0/0 state
NEW,ESTABLISHED ctdir REPLY match-set tck_test src,dst
+RETURN all -- 0.0.0.0/0 0.0.0.0/0 match-set
tck_test src,dst /* out+NONE */
+RETURN all -- 0.0.0.0/0 0.0.0.0/0 state
ESTABLISHED ctdir ORIGINAL match-set tck_test dst,src,dst
+RETURN all -- 0.0.0.0/0 0.0.0.0/0 state
ESTABLISHED ctdir ORIGINAL match-set tck_test dst,src,dst
+RETURN all -- 0.0.0.0/0 0.0.0.0/0 state
ESTABLISHED ctdir ORIGINAL match-set tck_test dst,src
+RETURN all -- 0.0.0.0/0 0.0.0.0/0 match-set
tck_test dst,src /* inout */
+#iptables -L libvirt-host-in -n | grep vnet0 | tr -s " "
+HI-vnet0 all -- 0.0.0.0/0 0.0.0.0/0 [goto] PHYSDEV match --physdev-in vnet0
+#iptables -L libvirt-in -n | grep vnet0 | tr -s " "
+FI-vnet0 all -- 0.0.0.0/0 0.0.0.0/0 [goto] PHYSDEV match --physdev-in vnet0
+#iptables -L libvirt-in-post -n | grep vnet0
+ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 PHYSDEV
match --physdev-in vnet0
+#iptables -L libvirt-out -n | grep vnet0 | tr -s " "
+FO-vnet0 all -- 0.0.0.0/0 0.0.0.0/0 [goto] PHYSDEV match --physdev-out
vnet0
+#ebtables -t nat -L libvirt-O-vnet0 2>/dev/null | grep -v "table:" |
grep -v "^$"
+#ebtables -t nat -L libvirt-I-vnet0 2>/dev/null | grep -v "table:" |
grep -v "^$"
+#ebtables -t nat -L PREROUTING | grep vnet0
+#ebtables -t nat -L POSTROUTING | grep vnet0
Index:
libvirt-tck/scripts/nwfilter/nwfilterxml2fwallout/zzz-ipset-cleanup.fwall
===================================================================
--- /dev/null
+++
libvirt-tck/scripts/nwfilter/nwfilterxml2fwallout/zzz-ipset-cleanup.fwall
@@ -0,0 +1 @@
+#ipset destroy tck_test 2>&1 1>/dev/null
Index: libvirt-tck/scripts/nwfilter/nwfilterxml2xmlin/zzz-ipset-cleanup.xml
===================================================================
--- /dev/null
+++ libvirt-tck/scripts/nwfilter/nwfilterxml2xmlin/zzz-ipset-cleanup.xml
@@ -0,0 +1,5 @@
+<!-- #ipset help && iptables -t match-set -h# -->
+<filter name='tck-testcase' chain='root'>
+ <uuid>5c6d49af-b071-6127-b4ec-6f8ed4b55335</uuid>
+ <!-- used only to cleanup ipset -->
+</filter>
12 years, 6 months