Devel
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- 40085 discussions
29 Nov '11
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
GLib >= 2.31 filters debug messages by default now[1] and provides ways
to output debug log from selected domains only. This patch won't be any
good without defining proper fine-grained log domains though.
http://blogs.gnome.org/mclasen/2011/11/09/better-logging/
---
examples/event-test.c | 4 +--
libvirt-gconfig/libvirt-gconfig-capabilities.c | 6 +----
libvirt-gconfig/libvirt-gconfig-domain-clock.c | 6 +----
libvirt-gconfig/libvirt-gconfig-domain-device.c | 6 +----
libvirt-gconfig/libvirt-gconfig-domain-disk.c | 6 +----
.../libvirt-gconfig-domain-graphics-spice.c | 6 +----
libvirt-gconfig/libvirt-gconfig-domain-graphics.c | 6 +----
libvirt-gconfig/libvirt-gconfig-domain-input.c | 6 +----
.../libvirt-gconfig-domain-interface-network.c | 6 +----
libvirt-gconfig/libvirt-gconfig-domain-interface.c | 6 +----
libvirt-gconfig/libvirt-gconfig-domain-os.c | 6 +----
libvirt-gconfig/libvirt-gconfig-domain-snapshot.c | 6 +----
libvirt-gconfig/libvirt-gconfig-domain-timer.c | 6 +----
libvirt-gconfig/libvirt-gconfig-domain-video.c | 6 +----
libvirt-gconfig/libvirt-gconfig-domain.c | 6 +----
libvirt-gconfig/libvirt-gconfig-interface.c | 6 +----
libvirt-gconfig/libvirt-gconfig-network-filter.c | 6 +----
libvirt-gconfig/libvirt-gconfig-network.c | 6 +----
libvirt-gconfig/libvirt-gconfig-node-device.c | 6 +----
libvirt-gconfig/libvirt-gconfig-object.c | 10 +------
libvirt-gconfig/libvirt-gconfig-secret.c | 6 +----
libvirt-gconfig/libvirt-gconfig-storage-pool.c | 6 +----
libvirt-gconfig/libvirt-gconfig-storage-vol.c | 6 +----
libvirt-glib/libvirt-glib-event.c | 26 ++++++++-----------
libvirt-glib/libvirt-glib-main.c | 10 +-------
libvirt-gobject/libvirt-gobject-connection.c | 12 +++------
libvirt-gobject/libvirt-gobject-domain-device.c | 8 +----
libvirt-gobject/libvirt-gobject-domain-disk.c | 8 +----
libvirt-gobject/libvirt-gobject-domain-interface.c | 8 +----
libvirt-gobject/libvirt-gobject-domain-snapshot.c | 8 +----
libvirt-gobject/libvirt-gobject-domain.c | 8 +----
libvirt-gobject/libvirt-gobject-input-stream.c | 6 +----
libvirt-gobject/libvirt-gobject-interface.c | 8 +----
libvirt-gobject/libvirt-gobject-main.c | 8 ------
libvirt-gobject/libvirt-gobject-manager.c | 8 +----
libvirt-gobject/libvirt-gobject-network-filter.c | 8 +----
libvirt-gobject/libvirt-gobject-network.c | 8 +----
libvirt-gobject/libvirt-gobject-node-device.c | 8 +----
libvirt-gobject/libvirt-gobject-output-stream.c | 6 +----
libvirt-gobject/libvirt-gobject-secret.c | 8 +----
libvirt-gobject/libvirt-gobject-storage-pool.c | 8 +----
libvirt-gobject/libvirt-gobject-storage-vol.c | 8 +----
libvirt-gobject/libvirt-gobject-stream.c | 6 +----
43 files changed, 69 insertions(+), 249 deletions(-)
diff --git a/examples/event-test.c b/examples/event-test.c
index fdd70bf..4fb000e 100644
--- a/examples/event-test.c
+++ b/examples/event-test.c
@@ -6,8 +6,6 @@
#include <libvirt/libvirt.h>
#include <libvirt-glib/libvirt-glib.h>
-#define DEBUG0(fmt) printf("%s:%d :: " fmt "\n", __FUNCTION__, __LINE__)
-#define DEBUG(fmt, ...) printf("%s:%d: " fmt "\n", __FUNCTION__, __LINE__, __VA_ARGS__)
#define STREQ(a,b) (strcmp((a),(b)) == 0)
#ifndef ATTRIBUTE_UNUSED
@@ -171,7 +169,7 @@ int main(int argc, char **argv)
return -1;
}
- DEBUG0("Registering domain event cbs");
+ g_debug("Registering domain event cbs");
/* Add 2 callbacks to prove this works with more than just one */
virConnectDomainEventRegister(dconn, myDomainEventCallback1, NULL, NULL);
diff --git a/libvirt-gconfig/libvirt-gconfig-capabilities.c b/libvirt-gconfig/libvirt-gconfig-capabilities.c
index 70bd33d..b517944 100644
--- a/libvirt-gconfig/libvirt-gconfig-capabilities.c
+++ b/libvirt-gconfig/libvirt-gconfig-capabilities.c
@@ -27,10 +27,6 @@
#include "libvirt-gconfig/libvirt-gconfig.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_CAPABILITIES_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_CAPABILITIES, GVirConfigCapabilitiesPrivate))
@@ -50,7 +46,7 @@ static void gvir_config_capabilities_class_init(GVirConfigCapabilitiesClass *kla
static void gvir_config_capabilities_init(GVirConfigCapabilities *conn)
{
- DEBUG("Init GVirConfigCapabilities=%p", conn);
+ g_debug("Init GVirConfigCapabilities=%p", conn);
conn->priv = GVIR_CONFIG_CAPABILITIES_GET_PRIVATE(conn);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-clock.c b/libvirt-gconfig/libvirt-gconfig-domain-clock.c
index 27d1e67..d092b64 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-clock.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-clock.c
@@ -30,10 +30,6 @@
#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_DOMAIN_CLOCK_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_CLOCK, GVirConfigDomainClockPrivate))
@@ -53,7 +49,7 @@ static void gvir_config_domain_clock_class_init(GVirConfigDomainClockClass *klas
static void gvir_config_domain_clock_init(GVirConfigDomainClock *klock)
{
- DEBUG("Init GVirConfigDomainClock=%p", klock);
+ g_debug("Init GVirConfigDomainClock=%p", klock);
klock->priv = GVIR_CONFIG_DOMAIN_CLOCK_GET_PRIVATE(klock);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-device.c b/libvirt-gconfig/libvirt-gconfig-domain-device.c
index 6dd0df1..1c4e465 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-device.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-device.c
@@ -28,10 +28,6 @@
#include "libvirt-gconfig/libvirt-gconfig.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_DOMAIN_DEVICE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_DEVICE, GVirConfigDomainDevicePrivate))
@@ -51,7 +47,7 @@ static void gvir_config_domain_device_class_init(GVirConfigDomainDeviceClass *kl
static void gvir_config_domain_device_init(GVirConfigDomainDevice *device)
{
- DEBUG("Init GVirConfigDomainDevice=%p", device);
+ g_debug("Init GVirConfigDomainDevice=%p", device);
device->priv = GVIR_CONFIG_DOMAIN_DEVICE_GET_PRIVATE(device);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-disk.c b/libvirt-gconfig/libvirt-gconfig-domain-disk.c
index 8a9d6e6..879afc7 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-disk.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-disk.c
@@ -30,10 +30,6 @@
#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_DOMAIN_DISK_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_DISK, GVirConfigDomainDiskPrivate))
@@ -53,7 +49,7 @@ static void gvir_config_domain_disk_class_init(GVirConfigDomainDiskClass *klass)
static void gvir_config_domain_disk_init(GVirConfigDomainDisk *disk)
{
- DEBUG("Init GVirConfigDomainDisk=%p", disk);
+ g_debug("Init GVirConfigDomainDisk=%p", disk);
disk->priv = GVIR_CONFIG_DOMAIN_DISK_GET_PRIVATE(disk);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
index e5c2ff8..1539009 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
@@ -30,10 +30,6 @@
#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_DOMAIN_GRAPHICS_SPICE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS_SPICE, GVirConfigDomainGraphicsSpicePrivate))
@@ -53,7 +49,7 @@ static void gvir_config_domain_graphics_spice_class_init(GVirConfigDomainGraphic
static void gvir_config_domain_graphics_spice_init(GVirConfigDomainGraphicsSpice *graphics_spice)
{
- DEBUG("Init GVirConfigDomainGraphicsSpice=%p", graphics_spice);
+ g_debug("Init GVirConfigDomainGraphicsSpice=%p", graphics_spice);
graphics_spice->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_SPICE_GET_PRIVATE(graphics_spice);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics.c
index 1c2a2ad..833f693 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics.c
@@ -28,10 +28,6 @@
#include "libvirt-gconfig/libvirt-gconfig.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_DOMAIN_GRAPHICS_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS, GVirConfigDomainGraphicsPrivate))
@@ -51,7 +47,7 @@ static void gvir_config_domain_graphics_class_init(GVirConfigDomainGraphicsClass
static void gvir_config_domain_graphics_init(GVirConfigDomainGraphics *graphics)
{
- DEBUG("Init GVirConfigDomainGraphics=%p", graphics);
+ g_debug("Init GVirConfigDomainGraphics=%p", graphics);
graphics->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_GET_PRIVATE(graphics);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-input.c b/libvirt-gconfig/libvirt-gconfig-domain-input.c
index ad11472..5c9b4ef 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-input.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-input.c
@@ -30,10 +30,6 @@
#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_DOMAIN_INPUT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_INPUT, GVirConfigDomainInputPrivate))
@@ -53,7 +49,7 @@ static void gvir_config_domain_input_class_init(GVirConfigDomainInputClass *klas
static void gvir_config_domain_input_init(GVirConfigDomainInput *device_input)
{
- DEBUG("Init GVirConfigDomainInput=%p", device_input);
+ g_debug("Init GVirConfigDomainInput=%p", device_input);
device_input->priv = GVIR_CONFIG_DOMAIN_INPUT_GET_PRIVATE(device_input);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface-network.c b/libvirt-gconfig/libvirt-gconfig-domain-interface-network.c
index e559df4..02fc2eb 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-interface-network.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface-network.c
@@ -30,10 +30,6 @@
#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_DOMAIN_INTERFACE_NETWORK_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_INTERFACE_NETWORK, GVirConfigDomainInterfaceNetworkPrivate))
@@ -53,7 +49,7 @@ static void gvir_config_domain_interface_network_class_init(GVirConfigDomainInte
static void gvir_config_domain_interface_network_init(GVirConfigDomainInterfaceNetwork *conn)
{
- DEBUG("Init GVirConfigDomainInterfaceNetwork=%p", conn);
+ g_debug("Init GVirConfigDomainInterfaceNetwork=%p", conn);
conn->priv = GVIR_CONFIG_DOMAIN_INTERFACE_NETWORK_GET_PRIVATE(conn);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface.c b/libvirt-gconfig/libvirt-gconfig-domain-interface.c
index 3af98ee..c825fee 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-interface.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-interface.c
@@ -27,10 +27,6 @@
#include "libvirt-gconfig/libvirt-gconfig.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_DOMAIN_INTERFACE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_INTERFACE, GVirConfigDomainInterfacePrivate))
@@ -50,7 +46,7 @@ static void gvir_config_domain_interface_class_init(GVirConfigDomainInterfaceCla
static void gvir_config_domain_interface_init(GVirConfigDomainInterface *interface)
{
- DEBUG("Init GVirConfigDomainInterface=%p", interface);
+ g_debug("Init GVirConfigDomainInterface=%p", interface);
interface->priv = GVIR_CONFIG_DOMAIN_INTERFACE_GET_PRIVATE(interface);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-os.c b/libvirt-gconfig/libvirt-gconfig-domain-os.c
index f1802ae..f5939d8 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-os.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-os.c
@@ -30,10 +30,6 @@
#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_DOMAIN_OS_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_OS, GVirConfigDomainOsPrivate))
@@ -53,7 +49,7 @@ static void gvir_config_domain_os_class_init(GVirConfigDomainOsClass *klass)
static void gvir_config_domain_os_init(GVirConfigDomainOs *os)
{
- DEBUG("Init GVirConfigDomainOs=%p", os);
+ g_debug("Init GVirConfigDomainOs=%p", os);
os->priv = GVIR_CONFIG_DOMAIN_OS_GET_PRIVATE(os);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-snapshot.c b/libvirt-gconfig/libvirt-gconfig-domain-snapshot.c
index 5835e69..421269d 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-snapshot.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-snapshot.c
@@ -27,10 +27,6 @@
#include "libvirt-gconfig/libvirt-gconfig.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_DOMAIN_SNAPSHOT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_SNAPSHOT, GVirConfigDomainSnapshotPrivate))
@@ -50,7 +46,7 @@ static void gvir_config_domain_snapshot_class_init(GVirConfigDomainSnapshotClass
static void gvir_config_domain_snapshot_init(GVirConfigDomainSnapshot *conn)
{
- DEBUG("Init GVirConfigDomainSnapshot=%p", conn);
+ g_debug("Init GVirConfigDomainSnapshot=%p", conn);
conn->priv = GVIR_CONFIG_DOMAIN_SNAPSHOT_GET_PRIVATE(conn);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-timer.c b/libvirt-gconfig/libvirt-gconfig-domain-timer.c
index e03a2a2..c1610fa 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-timer.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-timer.c
@@ -28,10 +28,6 @@
#include "libvirt-gconfig/libvirt-gconfig.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_DOMAIN_TIMER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_TIMER, GVirConfigDomainTimerPrivate))
@@ -51,7 +47,7 @@ static void gvir_config_domain_timer_class_init(GVirConfigDomainTimerClass *klas
static void gvir_config_domain_timer_init(GVirConfigDomainTimer *timer)
{
- DEBUG("Init GVirConfigDomainTimer=%p", timer);
+ g_debug("Init GVirConfigDomainTimer=%p", timer);
timer->priv = GVIR_CONFIG_DOMAIN_TIMER_GET_PRIVATE(timer);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-video.c b/libvirt-gconfig/libvirt-gconfig-domain-video.c
index 8c6c9fb..7c62985 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-video.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-video.c
@@ -30,10 +30,6 @@
#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_DOMAIN_VIDEO_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_VIDEO, GVirConfigDomainVideoPrivate))
@@ -53,7 +49,7 @@ static void gvir_config_domain_video_class_init(GVirConfigDomainVideoClass *klas
static void gvir_config_domain_video_init(GVirConfigDomainVideo *video)
{
- DEBUG("Init GVirConfigDomainVideo=%p", video);
+ g_debug("Init GVirConfigDomainVideo=%p", video);
video->priv = GVIR_CONFIG_DOMAIN_VIDEO_GET_PRIVATE(video);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index 2c21219..8f59dc4 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -29,10 +29,6 @@
#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_DOMAIN_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN, GVirConfigDomainPrivate))
@@ -151,7 +147,7 @@ static void gvir_config_domain_class_init(GVirConfigDomainClass *klass)
static void gvir_config_domain_init(GVirConfigDomain *conn)
{
- DEBUG("Init GVirConfigDomain=%p", conn);
+ g_debug("Init GVirConfigDomain=%p", conn);
conn->priv = GVIR_CONFIG_DOMAIN_GET_PRIVATE(conn);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-interface.c b/libvirt-gconfig/libvirt-gconfig-interface.c
index cffd840..6152c35 100644
--- a/libvirt-gconfig/libvirt-gconfig-interface.c
+++ b/libvirt-gconfig/libvirt-gconfig-interface.c
@@ -27,10 +27,6 @@
#include "libvirt-gconfig/libvirt-gconfig.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_INTERFACE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_INTERFACE, GVirConfigInterfacePrivate))
@@ -50,7 +46,7 @@ static void gvir_config_interface_class_init(GVirConfigInterfaceClass *klass)
static void gvir_config_interface_init(GVirConfigInterface *conn)
{
- DEBUG("Init GVirConfigInterface=%p", conn);
+ g_debug("Init GVirConfigInterface=%p", conn);
conn->priv = GVIR_CONFIG_INTERFACE_GET_PRIVATE(conn);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-network-filter.c b/libvirt-gconfig/libvirt-gconfig-network-filter.c
index dcf9e56..47469ed 100644
--- a/libvirt-gconfig/libvirt-gconfig-network-filter.c
+++ b/libvirt-gconfig/libvirt-gconfig-network-filter.c
@@ -27,10 +27,6 @@
#include "libvirt-gconfig/libvirt-gconfig.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_NETWORK_FILTER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_NETWORK_FILTER, GVirConfigNetworkFilterPrivate))
@@ -50,7 +46,7 @@ static void gvir_config_network_filter_class_init(GVirConfigNetworkFilterClass *
static void gvir_config_network_filter_init(GVirConfigNetworkFilter *conn)
{
- DEBUG("Init GVirConfigNetworkFilter=%p", conn);
+ g_debug("Init GVirConfigNetworkFilter=%p", conn);
conn->priv = GVIR_CONFIG_NETWORK_FILTER_GET_PRIVATE(conn);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-network.c b/libvirt-gconfig/libvirt-gconfig-network.c
index 73092de..9fe4181 100644
--- a/libvirt-gconfig/libvirt-gconfig-network.c
+++ b/libvirt-gconfig/libvirt-gconfig-network.c
@@ -27,10 +27,6 @@
#include "libvirt-gconfig/libvirt-gconfig.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_NETWORK_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_NETWORK, GVirConfigNetworkPrivate))
@@ -50,7 +46,7 @@ static void gvir_config_network_class_init(GVirConfigNetworkClass *klass)
static void gvir_config_network_init(GVirConfigNetwork *conn)
{
- DEBUG("Init GVirConfigNetwork=%p", conn);
+ g_debug("Init GVirConfigNetwork=%p", conn);
conn->priv = GVIR_CONFIG_NETWORK_GET_PRIVATE(conn);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-node-device.c b/libvirt-gconfig/libvirt-gconfig-node-device.c
index fa679b1..f89aeb1 100644
--- a/libvirt-gconfig/libvirt-gconfig-node-device.c
+++ b/libvirt-gconfig/libvirt-gconfig-node-device.c
@@ -27,10 +27,6 @@
#include "libvirt-gconfig/libvirt-gconfig.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_NODE_DEVICE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_NODE_DEVICE, GVirConfigNodeDevicePrivate))
@@ -50,7 +46,7 @@ static void gvir_config_node_device_class_init(GVirConfigNodeDeviceClass *klass)
static void gvir_config_node_device_init(GVirConfigNodeDevice *conn)
{
- DEBUG("Init GVirConfigNodeDevice=%p", conn);
+ g_debug("Init GVirConfigNodeDevice=%p", conn);
conn->priv = GVIR_CONFIG_NODE_DEVICE_GET_PRIVATE(conn);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index edbaf57..714a68a 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -31,12 +31,6 @@
#include "libvirt-gconfig/libvirt-gconfig-helpers-private.h"
#include "libvirt-gconfig/libvirt-gconfig-object-private.h"
-
-//extern gboolean debugFlag;
-gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_OBJECT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_OBJECT, GVirConfigObjectPrivate))
@@ -127,7 +121,7 @@ static void gvir_config_object_finalize(GObject *object)
GVirConfigObject *conn = GVIR_CONFIG_OBJECT(object);
GVirConfigObjectPrivate *priv = conn->priv;
- DEBUG("Finalize GVirConfigObject=%p", conn);
+ g_debug("Finalize GVirConfigObject=%p", conn);
g_free(priv->schema);
@@ -178,7 +172,7 @@ static void gvir_config_object_class_init(GVirConfigObjectClass *klass)
static void gvir_config_object_init(GVirConfigObject *conn)
{
- DEBUG("Init GVirConfigObject=%p", conn);
+ g_debug("Init GVirConfigObject=%p", conn);
conn->priv = GVIR_CONFIG_OBJECT_GET_PRIVATE(conn);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-secret.c b/libvirt-gconfig/libvirt-gconfig-secret.c
index 0c5de85..6f57aaa 100644
--- a/libvirt-gconfig/libvirt-gconfig-secret.c
+++ b/libvirt-gconfig/libvirt-gconfig-secret.c
@@ -27,10 +27,6 @@
#include "libvirt-gconfig/libvirt-gconfig.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_SECRET_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_SECRET, GVirConfigSecretPrivate))
@@ -50,7 +46,7 @@ static void gvir_config_secret_class_init(GVirConfigSecretClass *klass)
static void gvir_config_secret_init(GVirConfigSecret *conn)
{
- DEBUG("Init GVirConfigSecret=%p", conn);
+ g_debug("Init GVirConfigSecret=%p", conn);
conn->priv = GVIR_CONFIG_SECRET_GET_PRIVATE(conn);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-pool.c b/libvirt-gconfig/libvirt-gconfig-storage-pool.c
index aad60ed..c95cf59 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-pool.c
+++ b/libvirt-gconfig/libvirt-gconfig-storage-pool.c
@@ -27,10 +27,6 @@
#include "libvirt-gconfig/libvirt-gconfig.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_STORAGE_POOL_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_STORAGE_POOL, GVirConfigStoragePoolPrivate))
@@ -50,7 +46,7 @@ static void gvir_config_storage_pool_class_init(GVirConfigStoragePoolClass *klas
static void gvir_config_storage_pool_init(GVirConfigStoragePool *conn)
{
- DEBUG("Init GVirConfigStoragePool=%p", conn);
+ g_debug("Init GVirConfigStoragePool=%p", conn);
conn->priv = GVIR_CONFIG_STORAGE_POOL_GET_PRIVATE(conn);
}
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol.c b/libvirt-gconfig/libvirt-gconfig-storage-vol.c
index 4a59b72..5a31c80 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-vol.c
+++ b/libvirt-gconfig/libvirt-gconfig-storage-vol.c
@@ -27,10 +27,6 @@
#include "libvirt-gconfig/libvirt-gconfig.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONFIG_STORAGE_VOL_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_STORAGE_VOL, GVirConfigStorageVolPrivate))
@@ -50,7 +46,7 @@ static void gvir_config_storage_vol_class_init(GVirConfigStorageVolClass *klass)
static void gvir_config_storage_vol_init(GVirConfigStorageVol *conn)
{
- DEBUG("Init GVirConfigStorageVol=%p", conn);
+ g_debug("Init GVirConfigStorageVol=%p", conn);
conn->priv = GVIR_CONFIG_STORAGE_VOL_GET_PRIVATE(conn);
}
diff --git a/libvirt-glib/libvirt-glib-event.c b/libvirt-glib/libvirt-glib-event.c
index 0775632..ac14354 100644
--- a/libvirt-glib/libvirt-glib-event.c
+++ b/libvirt-glib/libvirt-glib-event.c
@@ -31,10 +31,6 @@
#include "libvirt-glib/libvirt-glib.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
struct gvir_event_handle
{
int watch;
@@ -83,7 +79,7 @@ gvir_event_handle_dispatch(GIOChannel *source G_GNUC_UNUSED,
if (condition & G_IO_ERR)
events |= VIR_EVENT_HANDLE_ERROR;
- DEBUG("Dispatch handler %d %d %p\n", data->fd, events, data->opaque);
+ g_debug("Dispatch handler %d %d %p\n", data->fd, events, data->opaque);
(data->cb)(data->watch, data->fd, events, data->opaque);
@@ -119,7 +115,7 @@ gvir_event_handle_add(int fd,
data->channel = g_io_channel_unix_new(fd);
data->ff = ff;
- DEBUG("Add handle %d %d %p\n", data->fd, events, data->opaque);
+ g_debug("Add handle %d %d %p\n", data->fd, events, data->opaque);
data->source = g_io_add_watch(data->channel,
cond,
@@ -168,7 +164,7 @@ gvir_event_handle_update(int watch,
data = gvir_event_handle_find(watch, NULL);
if (!data) {
- DEBUG("Update for missing handle watch %d", watch);
+ g_debug("Update for missing handle watch %d", watch);
goto cleanup;
}
@@ -227,11 +223,11 @@ gvir_event_handle_remove(int watch)
data = gvir_event_handle_find(watch, &idx);
if (!data) {
- DEBUG("Remove of missing watch %d", watch);
+ g_debug("Remove of missing watch %d", watch);
goto cleanup;
}
- DEBUG("Remove handle %d %d\n", watch, data->fd);
+ g_debug("Remove handle %d %d\n", watch, data->fd);
if (!data->source)
goto cleanup;
@@ -253,7 +249,7 @@ static gboolean
gvir_event_timeout_dispatch(void *opaque)
{
struct gvir_event_timeout *data = opaque;
- DEBUG("Dispatch timeout %p %p %d %p\n", data, data->cb, data->timer, data->opaque);
+ g_debug("Dispatch timeout %p %p %d %p\n", data, data->cb, data->timer, data->opaque);
(data->cb)(data->timer, data->opaque);
return TRUE;
@@ -283,7 +279,7 @@ gvir_event_timeout_add(int interval,
g_ptr_array_add(timeouts, data);
- DEBUG("Add timeout %p %d %p %p %d\n", data, interval, cb, opaque, data->timer);
+ g_debug("Add timeout %p %d %p %p %d\n", data, interval, cb, opaque, data->timer);
ret = data->timer;
@@ -329,11 +325,11 @@ gvir_event_timeout_update(int timer,
data = gvir_event_timeout_find(timer, NULL);
if (!data) {
- DEBUG("Update of missing timer %d", timer);
+ g_debug("Update of missing timer %d", timer);
goto cleanup;
}
- DEBUG("Update timeout %p %d %d\n", data, timer, interval);
+ g_debug("Update timeout %p %d %d\n", data, timer, interval);
if (interval >= 0) {
if (data->source)
@@ -379,11 +375,11 @@ gvir_event_timeout_remove(int timer)
data = gvir_event_timeout_find(timer, &idx);
if (!data) {
- DEBUG("Remove of missing timer %d", timer);
+ g_debug("Remove of missing timer %d", timer);
goto cleanup;
}
- DEBUG("Remove timeout %p %d\n", data, timer);
+ g_debug("Remove timeout %p %d\n", data, timer);
if (!data->source)
goto cleanup;
diff --git a/libvirt-glib/libvirt-glib-main.c b/libvirt-glib/libvirt-glib-main.c
index 4dc7d58..8d2f216 100644
--- a/libvirt-glib/libvirt-glib-main.c
+++ b/libvirt-glib/libvirt-glib-main.c
@@ -28,15 +28,11 @@
#include "libvirt-glib-main.h"
-gboolean debugFlag = FALSE;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
static void
gvir_error_func(gpointer opaque G_GNUC_UNUSED,
virErrorPtr err)
{
- DEBUG("Error: %s", err->message);
+ g_debug("Error: %s", err->message);
}
@@ -55,10 +51,6 @@ gboolean gvir_init_check(int *argc G_GNUC_UNUSED,
char ***argv G_GNUC_UNUSED,
GError **err G_GNUC_UNUSED)
{
- char *debugEnv = getenv("LIBVIRT_GLIB_DEBUG");
- if (debugEnv && *debugEnv && *debugEnv != '0')
- debugFlag = 1;
-
virSetErrorFunc(NULL, gvir_error_func);
if (!g_thread_supported())
g_thread_init(NULL);
diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
index a258847..ee0fb1b 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -30,10 +30,6 @@
#include "libvirt-gobject/libvirt-gobject.h"
#include "libvirt-gobject-compat.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_CONNECTION_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONNECTION, GVirConnectionPrivate))
@@ -128,7 +124,7 @@ static void gvir_connection_finalize(GObject *object)
GVirConnection *conn = GVIR_CONNECTION(object);
GVirConnectionPrivate *priv = conn->priv;
- DEBUG("Finalize GVirConnection=%p", conn);
+ g_debug("Finalize GVirConnection=%p", conn);
if (gvir_connection_is_open(conn))
gvir_connection_close(conn);
@@ -230,7 +226,7 @@ static void gvir_connection_init(GVirConnection *conn)
{
GVirConnectionPrivate *priv;
- DEBUG("Init GVirConnection=%p", conn);
+ g_debug("Init GVirConnection=%p", conn);
priv = conn->priv = GVIR_CONNECTION_GET_PRIVATE(conn);
@@ -270,7 +266,7 @@ static int domain_event_cb(virConnectPtr conn G_GNUC_UNUSED,
return 0;
}
- DEBUG("%s: %s event:%d, detail:%d", G_STRFUNC, uuid, event, detail);
+ g_debug("%s: %s event:%d, detail:%d", G_STRFUNC, uuid, event, detail);
g_mutex_lock(priv->lock);
gdom = g_hash_table_lookup(priv->domains, uuid);
@@ -499,7 +495,7 @@ gboolean gvir_connection_is_open(GVirConnection *conn)
void gvir_connection_close(GVirConnection *conn)
{
GVirConnectionPrivate *priv = conn->priv;
- DEBUG("Close GVirConnection=%p", conn);
+ g_debug("Close GVirConnection=%p", conn);
g_mutex_lock(priv->lock);
diff --git a/libvirt-gobject/libvirt-gobject-domain-device.c b/libvirt-gobject/libvirt-gobject-domain-device.c
index ae03489..4264c65 100644
--- a/libvirt-gobject/libvirt-gobject-domain-device.c
+++ b/libvirt-gobject/libvirt-gobject-domain-device.c
@@ -30,10 +30,6 @@
#include "libvirt-gobject/libvirt-gobject-domain-device-private.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_DOMAIN_DEVICE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_DOMAIN_DEVICE, GVirDomainDevicePrivate))
@@ -93,7 +89,7 @@ static void gvir_domain_device_finalize(GObject *object)
GVirDomainDevice *self = GVIR_DOMAIN_DEVICE(object);
GVirDomainDevicePrivate *priv = self->priv;
- DEBUG("Finalize GVirDomainDevice=%p", self);
+ g_debug("Finalize GVirDomainDevice=%p", self);
g_clear_object(&priv->domain);
@@ -123,7 +119,7 @@ static void gvir_domain_device_class_init(GVirDomainDeviceClass *klass)
static void gvir_domain_device_init(GVirDomainDevice *self)
{
- DEBUG("Init GVirDomainDevice=%p", self);
+ g_debug("Init GVirDomainDevice=%p", self);
self->priv = GVIR_DOMAIN_DEVICE_GET_PRIVATE(self);
}
diff --git a/libvirt-gobject/libvirt-gobject-domain-disk.c b/libvirt-gobject/libvirt-gobject-domain-disk.c
index b8f9dbb..3659758 100644
--- a/libvirt-gobject/libvirt-gobject-domain-disk.c
+++ b/libvirt-gobject/libvirt-gobject-domain-disk.c
@@ -31,10 +31,6 @@
#include "libvirt-gobject/libvirt-gobject-domain-device-private.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_DOMAIN_DISK_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_DOMAIN_DISK, GVirDomainDiskPrivate))
@@ -103,7 +99,7 @@ static void gvir_domain_disk_finalize(GObject *object)
GVirDomainDisk *self = GVIR_DOMAIN_DISK(object);
GVirDomainDiskPrivate *priv = self->priv;
- DEBUG("Finalize GVirDomainDisk=%p", self);
+ g_debug("Finalize GVirDomainDisk=%p", self);
g_free(priv->path);
@@ -133,7 +129,7 @@ static void gvir_domain_disk_class_init(GVirDomainDiskClass *klass)
static void gvir_domain_disk_init(GVirDomainDisk *self)
{
- DEBUG("Init GVirDomainDisk=%p", self);
+ g_debug("Init GVirDomainDisk=%p", self);
self->priv = GVIR_DOMAIN_DISK_GET_PRIVATE(self);
}
diff --git a/libvirt-gobject/libvirt-gobject-domain-interface.c b/libvirt-gobject/libvirt-gobject-domain-interface.c
index a6720c8..9f6ce8d 100644
--- a/libvirt-gobject/libvirt-gobject-domain-interface.c
+++ b/libvirt-gobject/libvirt-gobject-domain-interface.c
@@ -31,10 +31,6 @@
#include "libvirt-gobject/libvirt-gobject-domain-device-private.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_DOMAIN_INTERFACE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_DOMAIN_INTERFACE, GVirDomainInterfacePrivate))
@@ -103,7 +99,7 @@ static void gvir_domain_interface_finalize(GObject *object)
GVirDomainInterface *self = GVIR_DOMAIN_INTERFACE(object);
GVirDomainInterfacePrivate *priv = self->priv;
- DEBUG("Finalize GVirDomainInterface=%p", self);
+ g_debug("Finalize GVirDomainInterface=%p", self);
g_free(priv->path);
@@ -133,7 +129,7 @@ static void gvir_domain_interface_class_init(GVirDomainInterfaceClass *klass)
static void gvir_domain_interface_init(GVirDomainInterface *self)
{
- DEBUG("Init GVirDomainInterface=%p", self);
+ g_debug("Init GVirDomainInterface=%p", self);
self->priv = GVIR_DOMAIN_INTERFACE_GET_PRIVATE(self);
}
diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
index afd1e96..578e348 100644
--- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c
+++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
@@ -30,10 +30,6 @@
#include "libvirt-gobject/libvirt-gobject.h"
#include "libvirt-gobject-compat.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_DOMAIN_SNAPSHOT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_DOMAIN_SNAPSHOT, GVirDomainSnapshotPrivate))
@@ -105,7 +101,7 @@ static void gvir_domain_snapshot_finalize(GObject *object)
GVirDomainSnapshot *conn = GVIR_DOMAIN_SNAPSHOT(object);
GVirDomainSnapshotPrivate *priv = conn->priv;
- DEBUG("Finalize GVirDomainSnapshot=%p", conn);
+ g_debug("Finalize GVirDomainSnapshot=%p", conn);
virDomainSnapshotFree(priv->handle);
@@ -140,7 +136,7 @@ static void gvir_domain_snapshot_class_init(GVirDomainSnapshotClass *klass)
static void gvir_domain_snapshot_init(GVirDomainSnapshot *conn)
{
- DEBUG("Init GVirDomainSnapshot=%p", conn);
+ g_debug("Init GVirDomainSnapshot=%p", conn);
conn->priv = GVIR_DOMAIN_SNAPSHOT_GET_PRIVATE(conn);
}
diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index 464d287..506f5fd 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -30,10 +30,6 @@
#include "libvirt-gobject/libvirt-gobject.h"
#include "libvirt-gobject-compat.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_DOMAIN_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_DOMAIN, GVirDomainPrivate))
@@ -116,7 +112,7 @@ static void gvir_domain_finalize(GObject *object)
GVirDomain *conn = GVIR_DOMAIN(object);
GVirDomainPrivate *priv = conn->priv;
- DEBUG("Finalize GVirDomain=%p", conn);
+ g_debug("Finalize GVirDomain=%p", conn);
virDomainFree(priv->handle);
@@ -215,7 +211,7 @@ static void gvir_domain_class_init(GVirDomainClass *klass)
static void gvir_domain_init(GVirDomain *conn)
{
- DEBUG("Init GVirDomain=%p", conn);
+ g_debug("Init GVirDomain=%p", conn);
conn->priv = GVIR_DOMAIN_GET_PRIVATE(conn);
}
diff --git a/libvirt-gobject/libvirt-gobject-input-stream.c b/libvirt-gobject/libvirt-gobject-input-stream.c
index 39459c4..3519aaf 100644
--- a/libvirt-gobject/libvirt-gobject-input-stream.c
+++ b/libvirt-gobject/libvirt-gobject-input-stream.c
@@ -30,10 +30,6 @@
#include "libvirt-gobject/libvirt-gobject.h"
#include "libvirt-gobject-input-stream.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define gvir_input_stream_get_type _gvir_input_stream_get_type
G_DEFINE_TYPE(GVirInputStream, gvir_input_stream, G_TYPE_INPUT_STREAM);
@@ -92,7 +88,7 @@ static void gvir_input_stream_finalize(GObject *object)
{
GVirInputStream *stream = GVIR_INPUT_STREAM(object);
- DEBUG("Finalize input stream GVirStream=%p", stream->priv->stream);
+ g_debug("Finalize input stream GVirStream=%p", stream->priv->stream);
stream->priv->stream = NULL; // unowned
if (G_OBJECT_CLASS(gvir_input_stream_parent_class)->finalize)
diff --git a/libvirt-gobject/libvirt-gobject-interface.c b/libvirt-gobject/libvirt-gobject-interface.c
index 3be633c..07f857c 100644
--- a/libvirt-gobject/libvirt-gobject-interface.c
+++ b/libvirt-gobject/libvirt-gobject-interface.c
@@ -29,10 +29,6 @@
#include "libvirt-glib/libvirt-glib.h"
#include "libvirt-gobject/libvirt-gobject.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_INTERFACE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_INTERFACE, GVirInterfacePrivate))
@@ -104,7 +100,7 @@ static void gvir_interface_finalize(GObject *object)
GVirInterface *conn = GVIR_INTERFACE(object);
GVirInterfacePrivate *priv = conn->priv;
- DEBUG("Finalize GVirInterface=%p", conn);
+ g_debug("Finalize GVirInterface=%p", conn);
virInterfaceFree(priv->handle);
@@ -139,7 +135,7 @@ static void gvir_interface_class_init(GVirInterfaceClass *klass)
static void gvir_interface_init(GVirInterface *conn)
{
- DEBUG("Init GVirInterface=%p", conn);
+ g_debug("Init GVirInterface=%p", conn);
conn->priv = GVIR_INTERFACE_GET_PRIVATE(conn);
}
diff --git a/libvirt-gobject/libvirt-gobject-main.c b/libvirt-gobject/libvirt-gobject-main.c
index b29552c..0b90b2a 100644
--- a/libvirt-gobject/libvirt-gobject-main.c
+++ b/libvirt-gobject/libvirt-gobject-main.c
@@ -28,10 +28,6 @@
#include "libvirt-glib/libvirt-glib.h"
#include "libvirt-gobject/libvirt-gobject.h"
-gboolean debugFlag = FALSE;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
/**
* gvir_init_object:
* @argc: (inout): pointer to application's argc
@@ -58,10 +54,6 @@ gboolean gvir_init_object_check(int *argc,
char ***argv,
GError **err)
{
- char *debugEnv = getenv("LIBVIRT_GOBJECT_DEBUG");
- if (debugEnv && *debugEnv && *debugEnv != '0')
- debugFlag = 1;
-
g_type_init();
gvir_event_register();
diff --git a/libvirt-gobject/libvirt-gobject-manager.c b/libvirt-gobject/libvirt-gobject-manager.c
index 5f3a11a..35308ca 100644
--- a/libvirt-gobject/libvirt-gobject-manager.c
+++ b/libvirt-gobject/libvirt-gobject-manager.c
@@ -29,10 +29,6 @@
#include "libvirt-glib/libvirt-glib.h"
#include "libvirt-gobject/libvirt-gobject.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_MANAGER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_MANAGER, GVirManagerPrivate))
@@ -66,7 +62,7 @@ static void gvir_manager_finalize(GObject *object)
GVirManager *man = GVIR_MANAGER(object);
GVirManagerPrivate *priv = man->priv;
- DEBUG("Finalize GVirManager=%p", man);
+ g_debug("Finalize GVirManager=%p", man);
GList *tmp = priv->connections;
while (tmp) {
@@ -115,7 +111,7 @@ static void gvir_manager_init(GVirManager *conn)
{
GVirManagerPrivate *priv;
- DEBUG("Init GVirManager=%p", conn);
+ g_debug("Init GVirManager=%p", conn);
priv = conn->priv = GVIR_MANAGER_GET_PRIVATE(conn);
diff --git a/libvirt-gobject/libvirt-gobject-network-filter.c b/libvirt-gobject/libvirt-gobject-network-filter.c
index 01e9636..3a66590 100644
--- a/libvirt-gobject/libvirt-gobject-network-filter.c
+++ b/libvirt-gobject/libvirt-gobject-network-filter.c
@@ -30,10 +30,6 @@
#include "libvirt-gobject/libvirt-gobject.h"
#include "libvirt-gobject-compat.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_NETWORK_FILTER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_NETWORK_FILTER, GVirNetworkFilterPrivate))
@@ -106,7 +102,7 @@ static void gvir_network_filter_finalize(GObject *object)
GVirNetworkFilter *nf = GVIR_NETWORK_FILTER(object);
GVirNetworkFilterPrivate *priv = nf->priv;
- DEBUG("Finalize GVirNetworkFilter=%p", nf);
+ g_debug("Finalize GVirNetworkFilter=%p", nf);
virNWFilterFree(priv->handle);
@@ -156,7 +152,7 @@ static void gvir_network_filter_class_init(GVirNetworkFilterClass *klass)
static void gvir_network_filter_init(GVirNetworkFilter *conn)
{
- DEBUG("Init GVirNetworkFilter=%p", conn);
+ g_debug("Init GVirNetworkFilter=%p", conn);
conn->priv = GVIR_NETWORK_FILTER_GET_PRIVATE(conn);
}
diff --git a/libvirt-gobject/libvirt-gobject-network.c b/libvirt-gobject/libvirt-gobject-network.c
index 3c49117..662fc2f 100644
--- a/libvirt-gobject/libvirt-gobject-network.c
+++ b/libvirt-gobject/libvirt-gobject-network.c
@@ -30,10 +30,6 @@
#include "libvirt-gobject/libvirt-gobject.h"
#include "libvirt-gobject-compat.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_NETWORK_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_NETWORK, GVirNetworkPrivate))
@@ -106,7 +102,7 @@ static void gvir_network_finalize(GObject *object)
GVirNetwork *conn = GVIR_NETWORK(object);
GVirNetworkPrivate *priv = conn->priv;
- DEBUG("Finalize GVirNetwork=%p", conn);
+ g_debug("Finalize GVirNetwork=%p", conn);
virNetworkFree(priv->handle);
@@ -154,7 +150,7 @@ static void gvir_network_class_init(GVirNetworkClass *klass)
static void gvir_network_init(GVirNetwork *conn)
{
- DEBUG("Init GVirNetwork=%p", conn);
+ g_debug("Init GVirNetwork=%p", conn);
conn->priv = GVIR_NETWORK_GET_PRIVATE(conn);
}
diff --git a/libvirt-gobject/libvirt-gobject-node-device.c b/libvirt-gobject/libvirt-gobject-node-device.c
index 04d7d04..3d1809c 100644
--- a/libvirt-gobject/libvirt-gobject-node-device.c
+++ b/libvirt-gobject/libvirt-gobject-node-device.c
@@ -30,10 +30,6 @@
#include "libvirt-gobject/libvirt-gobject.h"
#include "libvirt-gobject-compat.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_NODE_DEVICE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_NODE_DEVICE, GVirNodeDevicePrivate))
@@ -105,7 +101,7 @@ static void gvir_node_device_finalize(GObject *object)
GVirNodeDevice *conn = GVIR_NODE_DEVICE(object);
GVirNodeDevicePrivate *priv = conn->priv;
- DEBUG("Finalize GVirNodeDevice=%p", conn);
+ g_debug("Finalize GVirNodeDevice=%p", conn);
virNodeDeviceFree(priv->handle);
@@ -140,7 +136,7 @@ static void gvir_node_device_class_init(GVirNodeDeviceClass *klass)
static void gvir_node_device_init(GVirNodeDevice *conn)
{
- DEBUG("Init GVirNodeDevice=%p", conn);
+ g_debug("Init GVirNodeDevice=%p", conn);
conn->priv = GVIR_NODE_DEVICE_GET_PRIVATE(conn);
}
diff --git a/libvirt-gobject/libvirt-gobject-output-stream.c b/libvirt-gobject/libvirt-gobject-output-stream.c
index 30ee519..78d08a5 100644
--- a/libvirt-gobject/libvirt-gobject-output-stream.c
+++ b/libvirt-gobject/libvirt-gobject-output-stream.c
@@ -30,10 +30,6 @@
#include "libvirt-gobject/libvirt-gobject.h"
#include "libvirt-gobject-output-stream.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define gvir_output_stream_get_type _gvir_output_stream_get_type
G_DEFINE_TYPE(GVirOutputStream, gvir_output_stream, G_TYPE_OUTPUT_STREAM);
@@ -92,7 +88,7 @@ static void gvir_output_stream_finalize(GObject *object)
{
GVirOutputStream *stream = GVIR_OUTPUT_STREAM(object);
- DEBUG("Finalize output stream GVirStream=%p", stream->priv->stream);
+ g_debug("Finalize output stream GVirStream=%p", stream->priv->stream);
stream->priv->stream = NULL; // unowned
if (G_OBJECT_CLASS(gvir_output_stream_parent_class)->finalize)
diff --git a/libvirt-gobject/libvirt-gobject-secret.c b/libvirt-gobject/libvirt-gobject-secret.c
index f2fd9a8..f2bb611 100644
--- a/libvirt-gobject/libvirt-gobject-secret.c
+++ b/libvirt-gobject/libvirt-gobject-secret.c
@@ -30,10 +30,6 @@
#include "libvirt-gobject/libvirt-gobject.h"
#include "libvirt-gobject-compat.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_SECRET_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_SECRET, GVirSecretPrivate))
@@ -106,7 +102,7 @@ static void gvir_secret_finalize(GObject *object)
GVirSecret *conn = GVIR_SECRET(object);
GVirSecretPrivate *priv = conn->priv;
- DEBUG("Finalize GVirSecret=%p", conn);
+ g_debug("Finalize GVirSecret=%p", conn);
virSecretFree(priv->handle);
@@ -156,7 +152,7 @@ static void gvir_secret_class_init(GVirSecretClass *klass)
static void gvir_secret_init(GVirSecret *conn)
{
- DEBUG("Init GVirSecret=%p", conn);
+ g_debug("Init GVirSecret=%p", conn);
conn->priv = GVIR_SECRET_GET_PRIVATE(conn);
}
diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c
index cb69e7e..da8ada5 100644
--- a/libvirt-gobject/libvirt-gobject-storage-pool.c
+++ b/libvirt-gobject/libvirt-gobject-storage-pool.c
@@ -30,10 +30,6 @@
#include "libvirt-gobject/libvirt-gobject.h"
#include "libvirt-gobject-compat.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_STORAGE_POOL_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_STORAGE_POOL, GVirStoragePoolPrivate))
@@ -109,7 +105,7 @@ static void gvir_storage_pool_finalize(GObject *object)
GVirStoragePool *pool = GVIR_STORAGE_POOL(object);
GVirStoragePoolPrivate *priv = pool->priv;
- DEBUG("Finalize GVirStoragePool=%p", pool);
+ g_debug("Finalize GVirStoragePool=%p", pool);
if (priv->volumes) {
g_hash_table_unref(priv->volumes);
@@ -168,7 +164,7 @@ static void gvir_storage_pool_init(GVirStoragePool *pool)
{
GVirStoragePoolPrivate *priv;
- DEBUG("Init GVirStoragePool=%p", pool);
+ g_debug("Init GVirStoragePool=%p", pool);
priv = pool->priv = GVIR_STORAGE_POOL_GET_PRIVATE(pool);
diff --git a/libvirt-gobject/libvirt-gobject-storage-vol.c b/libvirt-gobject/libvirt-gobject-storage-vol.c
index 0c8cb09..6340ad7 100644
--- a/libvirt-gobject/libvirt-gobject-storage-vol.c
+++ b/libvirt-gobject/libvirt-gobject-storage-vol.c
@@ -30,10 +30,6 @@
#include "libvirt-gobject/libvirt-gobject.h"
#include "libvirt-gobject-compat.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_STORAGE_VOL_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_STORAGE_VOL, GVirStorageVolPrivate))
@@ -105,7 +101,7 @@ static void gvir_storage_vol_finalize(GObject *object)
GVirStorageVol *conn = GVIR_STORAGE_VOL(object);
GVirStorageVolPrivate *priv = conn->priv;
- DEBUG("Finalize GVirStorageVol=%p", conn);
+ g_debug("Finalize GVirStorageVol=%p", conn);
virStorageVolFree(priv->handle);
@@ -140,7 +136,7 @@ static void gvir_storage_vol_class_init(GVirStorageVolClass *klass)
static void gvir_storage_vol_init(GVirStorageVol *conn)
{
- DEBUG("Init GVirStorageVol=%p", conn);
+ g_debug("Init GVirStorageVol=%p", conn);
conn->priv = GVIR_STORAGE_VOL_GET_PRIVATE(conn);
}
diff --git a/libvirt-gobject/libvirt-gobject-stream.c b/libvirt-gobject/libvirt-gobject-stream.c
index 0d1c2d1..080a697 100644
--- a/libvirt-gobject/libvirt-gobject-stream.c
+++ b/libvirt-gobject/libvirt-gobject-stream.c
@@ -34,10 +34,6 @@
#include "libvirt-gobject/libvirt-gobject-input-stream.h"
#include "libvirt-gobject/libvirt-gobject-output-stream.h"
-extern gboolean debugFlag;
-
-#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
-
#define GVIR_STREAM_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_STREAM, GVirStreamPrivate))
@@ -187,7 +183,7 @@ static void gvir_stream_finalize(GObject *object)
GVirStream *self = GVIR_STREAM(object);
GVirStreamPrivate *priv = self->priv;
- DEBUG("Finalize GVirStream=%p", self);
+ g_debug("Finalize GVirStream=%p", self);
if (self->priv->input_stream)
g_object_unref(self->priv->input_stream);
--
1.7.7.3
2
2
---
Pushed under trivial rule
src/util/virnetdevbandwidth.c | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/src/util/virnetdevbandwidth.c b/src/util/virnetdevbandwidth.c
index 10db1ff..b9bd2e3 100644
--- a/src/util/virnetdevbandwidth.c
+++ b/src/util/virnetdevbandwidth.c
@@ -90,8 +90,8 @@ virNetDevBandwidthSet(const char *ifname,
virCommandFree(cmd);
cmd = virCommandNew(TC);
- virCommandAddArgList(cmd,"class", "add", "dev", ifname, "parent",
- "1:", "classid", "1:1", "htb", NULL);
+ virCommandAddArgList(cmd,"class", "add", "dev", ifname, "parent",
+ "1:", "classid", "1:1", "htb", NULL);
virCommandAddArgList(cmd, "rate", average, NULL);
if (peak)
@@ -104,9 +104,9 @@ virNetDevBandwidthSet(const char *ifname,
virCommandFree(cmd);
cmd = virCommandNew(TC);
- virCommandAddArgList(cmd,"filter", "add", "dev", ifname, "parent",
- "1:0", "protocol", "ip", "handle", "1", "fw",
- "flowid", "1", NULL);
+ virCommandAddArgList(cmd,"filter", "add", "dev", ifname, "parent",
+ "1:0", "protocol", "ip", "handle", "1", "fw",
+ "flowid", "1", NULL);
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
@@ -243,23 +243,23 @@ bool
virNetDevBandwidthEqual(virNetDevBandwidthPtr a,
virNetDevBandwidthPtr b)
{
- if (!a && !b)
- return true;
+ if (!a && !b)
+ return true;
- if (!a || !b)
- return false;
+ if (!a || !b)
+ return false;
- /* in */
- if (a->in->average != b->in->average ||
- a->in->peak != b->in->peak ||
- a->in->burst != b->in->burst)
- return false;
+ /* in */
+ if (a->in->average != b->in->average ||
+ a->in->peak != b->in->peak ||
+ a->in->burst != b->in->burst)
+ return false;
- /*out*/
- if (a->out->average != b->out->average ||
- a->out->peak != b->out->peak ||
- a->out->burst != b->out->burst)
- return false;
+ /*out*/
+ if (a->out->average != b->out->average ||
+ a->out->peak != b->out->peak ||
+ a->out->burst != b->out->burst)
+ return false;
- return true;
+ return true;
}
--
1.7.3.4
1
0
---
tools/virsh.pod | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index f5183b4..d94e599 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -977,7 +977,7 @@ Change the maximum memory allocation limit for a guest domain.
If I<--live> is specified, affect a running guest.
If I<--config> is specified, affect the next boot of a persistent guest.
If I<--current> is specified, affect the current guest state.
-Both I<--live> and I<--current> flags may be given, but I<--current> is
+Both I<--live> and I<--config> flags may be given, but I<--current> is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
@@ -1003,7 +1003,7 @@ I<--min-guarantee> is supported only by ESX hypervisor.
If I<--live> is specified, affect a running guest.
If I<--config> is specified, affect the next boot of a persistent guest.
If I<--current> is specified, affect the current guest state.
-Both I<--live> and I<--current> flags may be given, but I<--current> is
+Both I<--live> and I<--config> flags may be given, but I<--current> is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
@@ -1048,7 +1048,7 @@ I<--weight> is in range [100, 1000].
If I<--live> is specified, affect a running guest.
If I<--config> is specified, affect the next boot of a persistent guest.
If I<--current> is specified, affect the current guest state.
-Both I<--live> and I<--current> flags may be given, but I<--current> is
+Both I<--live> and I<--config> flags may be given, but I<--current> is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
--
1.7.8.rc4
2
2
29 Nov '11
---
src/util/cgroup.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/cgroup.c b/src/util/cgroup.c
index c8d1f33..71dedeb 100644
--- a/src/util/cgroup.c
+++ b/src/util/cgroup.c
@@ -1474,14 +1474,14 @@ int virCgroupGetCpuacctUsage(virCgroupPtr group, unsigned long long *usage)
int virCgroupSetFreezerState(virCgroupPtr group, const char *state)
{
return virCgroupSetValueStr(group,
- VIR_CGROUP_CONTROLLER_CPU,
+ VIR_CGROUP_CONTROLLER_FREEZER,
"freezer.state", state);
}
int virCgroupGetFreezerState(virCgroupPtr group, char **state)
{
return virCgroupGetValueStr(group,
- VIR_CGROUP_CONTROLLER_CPU,
+ VIR_CGROUP_CONTROLLER_FREEZER,
"freezer.state", state);
}
--
1.7.8.rc4
2
2
[libvirt] [PATCH] examples: Correct the example command to use testnode.xml
by Osier Yang 29 Nov '11
by Osier Yang 29 Nov '11
29 Nov '11
* s/-connection/-c/
* Removes the redundant '/'.
* Add "absolute" so that it's more clear.
Pushed under trivial rule.
---
examples/xml/test/testnode.xml | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/examples/xml/test/testnode.xml b/examples/xml/test/testnode.xml
index adc5440..001e353 100644
--- a/examples/xml/test/testnode.xml
+++ b/examples/xml/test/testnode.xml
@@ -4,7 +4,7 @@
of applications using libvirt. To use this with virsh, run something
like:
- virsh -connect test:////path/to/this/dir/testnode.xml nodeinfo
+ virsh -c test://absolute/path/to/this/dir/testnode.xml nodeinfo
-->
<domain file="testdomfv0.xml"/>
--
1.7.7.3
2
1
[libvirt] [ PATCH v5 0/4] API to invoke S3/S4 on a host and also resume from within libvirt
by Srivatsa S. Bhat 29 Nov '11
by Srivatsa S. Bhat 29 Nov '11
29 Nov '11
This patchset adds a new API to put a host to a suspended state
(Suspend-to-RAM, Suspend-to-Disk or Hybrid-Suspend) and setup a timed resume
to get the host back online, from within libvirt.
This uses the RTC wakeup mechanism to set up a timer alarm before suspending
the host, so that in-band resume is facilitated by the firing of the RTC
alarm, which wakes up the host.
This patch applies on top of the Hybrid-Suspend patch posted in [1].
v5:
* Added MIN_TIME_REQ_FOR_SUSPEND.
* Incorporated the review comments in [3].
v4:
* Applies on top of the Hybrid-Suspend patch posted in [1].
* Incorporated the review comments in [2].
v3:
* Rebased to libvirt 0.9.7
* Added a check to see if alarmTime (suspend duration) is within an
acceptable range.
v2:
* Added an init function which finds out if S3/S4 is supported by the host,
upon the first request to suspend/hibernate.
* Added synchronization/locking to ensure that only one suspend operation
is active at a time.
v1: http://www.redhat.com/archives/libvir-list/2011-September/msg00830.html
v2: http://comments.gmane.org/gmane.comp.emulators.libvirt/46729
References:
[1]. http://www.redhat.com/archives/libvir-list/2011-November/msg01407.html
[2]. http://thread.gmane.org/gmane.comp.emulators.libvirt/47950
[3]. http://thread.gmane.org/gmane.comp.emulators.libvirt/49054
Srivatsa S. Bhat (4):
Add a public API to invoke suspend/resume on the host
Add the remote protocol implementation for virNodeSuspendForDuration
Implement the core API to suspend/resume the host
Add virsh command to initiate suspend on the host
include/libvirt/libvirt.h.in | 16 ++
src/Makefile.am | 1
src/driver.h | 6 +
src/libvirt.c | 65 ++++++++++
src/libvirt_private.syms | 5 +
src/libvirt_public.syms | 5 +
src/lxc/lxc_driver.c | 2
src/qemu/qemu_driver.c | 2
src/remote/remote_driver.c | 1
src/remote/remote_protocol.x | 10 +-
src/uml/uml_driver.c | 2
src/util/virnodesuspend.c | 269 ++++++++++++++++++++++++++++++++++++++++++
src/util/virnodesuspend.h | 36 ++++++
src/xen/xen_driver.c | 2
tools/virsh.c | 64 ++++++++++
tools/virsh.pod | 7 +
16 files changed, 491 insertions(+), 2 deletions(-)
create mode 100644 src/util/virnodesuspend.c
create mode 100644 src/util/virnodesuspend.h
3
10
[libvirt] [PATCH] Add 'Hybrid-Suspend' power management discovery for the host
by Srivatsa S. Bhat 28 Nov '11
by Srivatsa S. Bhat 28 Nov '11
28 Nov '11
Some systems support a feature known as 'Hybrid-Suspend', apart from the
usual system-wide sleep states such as Suspend-to-RAM (S3) or Suspend-to-Disk
(S4). Add the functionality to discover this power management feature and
export it in the capabilities XML under the <power_management> tag.
This addition was suggested in [1].
References:
1. http://www.redhat.com/archives/libvir-list/2011-November/msg01298.html
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat(a)linux.vnet.ibm.com>
---
docs/formatcaps.html.in | 12 +++--
docs/schemas/capability.rng | 5 ++
src/conf/capabilities.c | 2 -
src/util/util.c | 99 ++++++++++++++++++++++++++++++-------------
src/util/util.h | 8 ++-
5 files changed, 88 insertions(+), 38 deletions(-)
diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in
index ce6f9a6..c5fb925 100644
--- a/docs/formatcaps.html.in
+++ b/docs/formatcaps.html.in
@@ -31,6 +31,7 @@ BIOS you will see</p>
<power_management>
<S3/>
<S4/>
+ <Hybrid-Suspend/>
<power_management/>
</host></span>
@@ -70,11 +71,12 @@ the host platform, but other information may be available, it shows the CPU arch
topology, model name, and additional features which are not included in the model but the
CPU provides them. Features of the chip are shown within the feature block (the block is
similar to what you will find in a Xen fully virtualized domain description). Further,
-the power management features supported by the host are shown, such as Suspend-to-RAM (S3)
-and Suspend-to-Disk (S4). In case the query for power management features succeeded but the
-host does not support any such feature, then an empty <power_management/>
-tag will be shown. Otherwise, if the query itself failed, no such tag will
-be displayed (i.e., there will not be any power_management block or empty tag in the XML).</p>
+the power management features supported by the host are shown, such as Suspend-to-RAM (S3),
+Suspend-to-Disk (S4) and Hybrid-Suspend (a combination of S3 and S4).
+In case the query for power management features succeeded but the host does not support
+any such feature, then an empty <power_management/> tag will be shown. Otherwise,
+if the query itself failed, no such tag will be displayed (i.e., there will not be any
+power_management block or empty tag in the XML).</p>
<p>The second block (in blue) indicates the paravirtualization support of the
Xen support, you will see the os_type of xen to indicate a paravirtual
kernel, then architecture information and potential features.</p>
diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng
index 645769e..6cf2188 100644
--- a/docs/schemas/capability.rng
+++ b/docs/schemas/capability.rng
@@ -121,6 +121,11 @@
<empty/>
</element>
</optional>
+ <optional>
+ <element name='Hybrid-Suspend'>
+ <empty/>
+ </element>
+ </optional>
</interleave>
</element>
</define>
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 87b60b0..8468861 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -35,7 +35,7 @@
#define VIR_FROM_THIS VIR_FROM_CAPABILITIES
VIR_ENUM_IMPL(virHostPMCapability, VIR_HOST_PM_LAST,
- "S3", "S4")
+ "S3", "S4", "Hybrid-Suspend")
/**
* virCapabilitiesNew:
diff --git a/src/util/util.c b/src/util/util.c
index ce697fb..ccd1a0e 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -2623,47 +2623,50 @@ virTypedParameterArrayClear(virTypedParameterPtr params, int nparams)
}
/**
- * Get the Power Management Capabilities of the host system.
- * The script 'pm-is-supported' (from the pm-utils package) is run
- * to find out all the power management features supported by the host,
- * such as Suspend-to-RAM (S3) and Suspend-to-Disk (S4).
+ * virDiscoverHostPMFeature:
+ * @bitmask: The bitmask which should be populated with the result of
+ * the query
+ * @feature: The power management feature to check whether it is supported
+ * by the host. Values could be:
+ * VIR_HOST_PM_S3 for Suspend-to-RAM
+ * VIR_HOST_PM_S4 for Suspend-to-Disk
+ * VIR_HOST_PM_HYBRID_SUSPEND for Hybrid-Suspend
*
- * @bitmask: Pointer to the bitmask which will be set appropriately to
- * indicate all the supported host power management features.
+ * Run the script 'pm-is-supported' (from the pm-utils package)
+ * to find out if @feature is supported by the host.
*
- * Returns 0 if the query was successful, -1 upon failure.
+ * Returns 0 if the query was successful, -1 on failure.
*/
int
-virGetPMCapabilities(unsigned int *bitmask)
+virDiscoverHostPMFeature(unsigned int *bitmask, unsigned int feature)
{
- int ret = -1;
- int status;
virCommandPtr cmd;
+ int status;
+ int ret = -1;
- *bitmask = 0;
-
- /* Check support for Suspend-to-RAM (S3) */
- cmd = virCommandNewArgList("pm-is-supported", "--suspend", NULL);
- if (virCommandRun(cmd, &status) < 0)
- goto cleanup;
-
- /* Check return code of command == 0 for success
- * (i.e., the PM capability is supported)
- */
- if (status == 0)
- *bitmask |= 1U << VIR_HOST_PM_S3;
- virCommandFree(cmd);
+ switch (feature) {
+ case VIR_HOST_PM_S3:
+ cmd = virCommandNewArgList("pm-is-supported", "--suspend", NULL);
+ break;
+ case VIR_HOST_PM_S4:
+ cmd = virCommandNewArgList("pm-is-supported", "--hibernate", NULL);
+ break;
+ case VIR_HOST_PM_HYBRID_SUSPEND:
+ cmd = virCommandNewArgList("pm-is-supported", "--suspend-hybrid", NULL);
+ break;
+ default:
+ return ret;
+ }
- /* Check support for Suspend-to-Disk (S4) */
- cmd = virCommandNewArgList("pm-is-supported", "--hibernate", NULL);
if (virCommandRun(cmd, &status) < 0)
goto cleanup;
- /* Check return code of command == 0 for success
- * (i.e., the PM capability is supported)
- */
+ /*
+ * Check return code of command == 0 for success
+ * (i.e., the PM capability is supported)
+ */
if (status == 0)
- *bitmask |= 1U << VIR_HOST_PM_S4;
+ *bitmask |= 1U << feature;
ret = 0;
@@ -2671,3 +2674,41 @@ cleanup:
virCommandFree(cmd);
return ret;
}
+
+/**
+ * virGetPMCapabilities:
+ *
+ * Get the Power Management Capabilities that the host system supports,
+ * such as Suspend-to-RAM (S3), Suspend-to-Disk (S4) and Hybrid-Suspend
+ * (a combination of S3 and S4).
+ *
+ * @bitmask: Pointer to the bitmask which will be set appropriately to
+ * indicate all the supported host power management features.
+ *
+ * Returns 0 if the query was successful, -1 on failure.
+ */
+int
+virGetPMCapabilities(unsigned int *bitmask)
+{
+ int ret;
+
+ *bitmask = 0;
+
+ /* Check support for Suspend-to-RAM (S3) */
+ ret = virDiscoverHostPMFeature(bitmask, VIR_HOST_PM_S3);
+ if (ret < 0)
+ return -1;
+
+ /* Check support for Suspend-to-Disk (S4) */
+ ret = virDiscoverHostPMFeature(bitmask, VIR_HOST_PM_S4);
+ if (ret < 0)
+ return -1;
+
+ /* Check support for Hybrid-Suspend */
+ ret = virDiscoverHostPMFeature(bitmask, VIR_HOST_PM_HYBRID_SUSPEND);
+ if (ret < 0)
+ return -1;
+
+ return 0;
+}
+
diff --git a/src/util/util.h b/src/util/util.h
index 5afcf58..eda60d2 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -264,14 +264,16 @@ void virTypedParameterArrayClear(virTypedParameterPtr params, int nparams);
/* Power Management Capabilities of the host system */
enum virHostPMCapability {
- VIR_HOST_PM_S3, /* Suspend-to-RAM */
- VIR_HOST_PM_S4, /* Suspend-to-Disk */
+ VIR_HOST_PM_S3, /* Suspend-to-RAM */
+ VIR_HOST_PM_S4, /* Suspend-to-Disk */
+ VIR_HOST_PM_HYBRID_SUSPEND, /* Hybrid-Suspend */
VIR_HOST_PM_LAST
};
VIR_ENUM_DECL(virHostPMCapability)
-int virGetPMCapabilities(unsigned int *);
+int virDiscoverHostPMFeature(unsigned int *bitmask, unsigned int feature);
+int virGetPMCapabilities(unsigned int *bitmask);
#endif /* __VIR_UTIL_H__ */
3
4
[libvirt] [PATCH] rpc: Really send non-blocking calls while waiting for another call
by Jiri Denemark 28 Nov '11
by Jiri Denemark 28 Nov '11
28 Nov '11
When another thread was dispatching while we wanted to send a
non-blocking call, we correctly queued the call and woke up the thread
but the thread just threw the call away since it forgot to recheck if
its socket was writable.
---
src/rpc/virnetclient.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index aad7f5d..a738129 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -1381,6 +1381,16 @@ static int virNetClientIOEventLoop(virNetClientPtr client,
_("read on wakeup fd failed"));
goto error;
}
+
+ /* If we were woken up because a new non-blocking call was queued,
+ * we need to re-poll to check if we can send it.
+ */
+ if (virNetClientCallMatchPredicate(client->waitDispatch,
+ virNetClientIOEventLoopWantNonBlock,
+ NULL)) {
+ VIR_DEBUG("New non-blocking call arrived; repolling");
+ continue;
+ }
}
if (ret < 0) {
--
1.7.8.rc3
2
2
[libvirt] [PATCH 3/8] Implement virDomain{Set, Get}BlockIoTune for the qemu driver
by Lei Li 28 Nov '11
by Lei Li 28 Nov '11
28 Nov '11
Implement the block I/O throttle setting and getting support to qemu
driver.
Signed-off-by: Lei Li <lilei(a)linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy(a)linux.vnet.ibm.com>
---
src/qemu/qemu_driver.c | 342 ++++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_monitor.c | 37 +++++
src/qemu/qemu_monitor.h | 22 +++
src/qemu/qemu_monitor_json.c | 186 +++++++++++++++++++++++
src/qemu/qemu_monitor_json.h | 10 ++
src/qemu/qemu_monitor_text.c | 165 ++++++++++++++++++++
src/qemu/qemu_monitor_text.h | 10 ++
7 files changed, 772 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5f4a18d..0a4eaa9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -94,6 +94,8 @@
#define QEMU_NB_MEM_PARAM 3
+#define QEMU_NB_BLKIOTHROTTLE_PARAM 6
+
#if HAVE_LINUX_KVM_H
# include <linux/kvm.h>
#endif
@@ -10775,6 +10777,344 @@ cleanup:
return ret;
}
+static int
+qemuDomainSetBlockIoTune(virDomainPtr dom,
+ const char *disk,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags)
+{
+ struct qemud_driver *driver = dom->conn->privateData;
+ virDomainObjPtr vm = NULL;
+ qemuDomainObjPrivatePtr priv;
+ virDomainDefPtr persistentDef = NULL;
+ virDomainBlockIoTuneInfo info;
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ const char *device = NULL;
+ int ret = -1;
+ int i;
+ bool isActive;
+
+ virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+ VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+ memset(&info, 0, sizeof(info));
+
+ qemuDriverLock(driver);
+ virUUIDFormat(dom->uuid, uuidstr);
+ vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ if (!vm) {
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
+ goto cleanup;
+ }
+
+ device = qemuDiskPathToAlias(vm, disk);
+ if (!device) {
+ goto cleanup;
+ }
+
+ if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+ goto cleanup;
+
+ isActive = virDomainObjIsActive(vm);
+
+ if (flags == VIR_DOMAIN_AFFECT_CURRENT) {
+ if (isActive)
+ flags = VIR_DOMAIN_AFFECT_LIVE;
+ else
+ flags = VIR_DOMAIN_AFFECT_CONFIG;
+ }
+
+ if (!isActive && (flags & VIR_DOMAIN_AFFECT_LIVE)) {
+ qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("domain is not running"));
+ goto endjob;
+ }
+
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+ if (!vm->persistent) {
+ qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot change persistent config of a transient domain"));
+ goto endjob;
+ }
+ if (!(persistentDef = virDomainObjGetPersistentDef(driver->caps, vm)))
+ goto endjob;
+ }
+
+ for (i = 0; i < nparams; i++) {
+ virTypedParameterPtr param = ¶ms[i];
+
+ if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC)) {
+
+ info.total_bytes_sec = params[i].value.ul;
+ } else if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC)) {
+ info.read_bytes_sec = params[i].value.ul;
+ } else if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC)) {
+ info.write_bytes_sec = params[i].value.ul;
+ } else if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC)) {
+ info.total_iops_sec = params[i].value.ul;
+ } else if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC)) {
+ info.read_iops_sec = params[i].value.ul;
+ } else if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC)) {
+ info.write_iops_sec = params[i].value.ul;
+ } else {
+ qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Unrecognized parameter"));
+ goto endjob;
+ }
+ }
+
+ if ((info.total_bytes_sec && info.read_bytes_sec) ||
+ (info.total_bytes_sec && info.write_bytes_sec)) {
+ qemuReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("total and read/write of bytes_sec cannot be set at the same time"));
+ goto endjob;
+ }
+
+ if ((info.total_iops_sec && info.read_iops_sec) ||
+ (info.total_iops_sec && info.write_iops_sec)) {
+ qemuReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("total and read/write of iops_sec cannot be set at the same time"));
+ goto endjob;
+ }
+
+ if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+ priv = vm->privateData;
+ qemuDomainObjEnterMonitorWithDriver(driver, vm);
+ ret = qemuMonitorSetBlockIoThrottle(priv->mon, device, &info, 1);
+ qemuDomainObjExitMonitorWithDriver(driver, vm);
+ }
+
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+ sa_assert(persistentDef);
+ int idx = virDomainDiskIndexByName(vm->def, disk, true);
+ if (i < 0)
+ goto endjob;
+ persistentDef->disks[idx]->blkdeviotune.total_bytes_sec = info.total_bytes_sec;
+ persistentDef->disks[idx]->blkdeviotune.read_bytes_sec = info.read_bytes_sec;
+ persistentDef->disks[idx]->blkdeviotune.write_bytes_sec = info.write_bytes_sec;
+ persistentDef->disks[idx]->blkdeviotune.total_iops_sec = info.total_iops_sec;
+ persistentDef->disks[idx]->blkdeviotune.read_iops_sec = info.read_iops_sec;
+ persistentDef->disks[idx]->blkdeviotune.write_iops_sec = info.write_iops_sec;
+ persistentDef->disks[idx]->blkdeviotune.mark = 1;
+ }
+
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+ ret = virDomainSaveConfig(driver->configDir, persistentDef);
+ if (ret < 0) {
+ qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Write to config file failed"));
+ goto endjob;
+ }
+ }
+
+endjob:
+ if (qemuDomainObjEndJob(driver, vm) == 0)
+ vm = NULL;
+
+cleanup:
+ VIR_FREE(device);
+ if (vm)
+ virDomainObjUnlock(vm);
+ qemuDriverUnlock(driver);
+ return ret;
+}
+
+static int
+qemuDomainGetBlockIoTune(virDomainPtr dom,
+ const char *disk,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags)
+{
+ struct qemud_driver *driver = dom->conn->privateData;
+ virDomainObjPtr vm = NULL;
+ qemuDomainObjPrivatePtr priv;
+ virDomainDefPtr persistentDef = NULL;
+ virDomainBlockIoTuneInfo reply;
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ const char *device = NULL;
+ int ret = -1;
+ int i;
+ bool isActive;
+
+ virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+ VIR_DOMAIN_AFFECT_CONFIG |
+ VIR_TYPED_PARAM_STRING_OKAY, -1);
+
+ /* We don't return strings, and thus trivially support this flag. */
+ flags &= ~VIR_TYPED_PARAM_STRING_OKAY;
+
+ qemuDriverLock(driver);
+ virUUIDFormat(dom->uuid, uuidstr);
+ vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ if (!vm) {
+ qemuReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
+ goto cleanup;
+ }
+
+ device = qemuDiskPathToAlias(vm, disk);
+
+ if (!device) {
+ goto cleanup;
+ }
+
+ if (qemuDomainObjBeginJobWithDriver(driver, vm, QEMU_JOB_MODIFY) < 0)
+ goto cleanup;
+
+ isActive = virDomainObjIsActive(vm);
+
+ if (flags == VIR_DOMAIN_AFFECT_CURRENT) {
+ if (isActive)
+ flags = VIR_DOMAIN_AFFECT_LIVE;
+ else
+ flags = VIR_DOMAIN_AFFECT_CONFIG;
+ }
+
+ if ((flags & VIR_DOMAIN_AFFECT_LIVE) && (flags & VIR_DOMAIN_AFFECT_CONFIG)) {
+ qemuReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Cannot query with --live and --config together"));
+ goto endjob;
+ }
+
+ if (!isActive && (flags & VIR_DOMAIN_AFFECT_LIVE)) {
+ qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("domain is not running"));
+ goto endjob;
+ }
+
+ if ((*nparams) == 0) {
+ /* Current number of parameters supported by QEMU Block I/O Throttling */
+ *nparams = QEMU_NB_BLKIOTHROTTLE_PARAM;
+ ret = 0;
+ goto endjob;
+ }
+
+ if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+ priv = vm->privateData;
+ qemuDomainObjEnterMonitorWithDriver(driver, vm);
+ ret = qemuMonitorGetBlockIoThrottle(priv->mon, device, &reply, 0);
+ qemuDomainObjExitMonitorWithDriver(driver, vm);
+ }
+
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+ if (!vm->persistent) {
+ qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("domain is transient"));
+ goto endjob;
+ }
+ if (!(persistentDef = virDomainObjGetPersistentDef(driver->caps, vm)))
+ goto endjob;
+
+ sa_assert(persistentDef);
+ int idx = virDomainDiskIndexByName(vm->def, disk, true);
+ if (idx < 0)
+ goto endjob;
+ reply.total_bytes_sec = persistentDef->disks[idx]->blkdeviotune.total_bytes_sec;
+ reply.read_bytes_sec = persistentDef->disks[idx]->blkdeviotune.read_bytes_sec;
+ reply.write_bytes_sec = persistentDef->disks[idx]->blkdeviotune.write_bytes_sec;
+ reply.total_iops_sec = persistentDef->disks[idx]->blkdeviotune.total_iops_sec;
+ reply.read_iops_sec = persistentDef->disks[idx]->blkdeviotune.read_iops_sec;
+ reply.write_iops_sec = persistentDef->disks[idx]->blkdeviotune.write_iops_sec;
+ ret = 0;
+ }
+
+ if ((ret != 0) && ((*nparams) < QEMU_NB_BLKIOTHROTTLE_PARAM)) {
+ qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Cannot get block I/O parameters"));
+ goto endjob;
+ }
+
+ for (i = 0; i < QEMU_NB_BLKIOTHROTTLE_PARAM; i++) {
+ virTypedParameterPtr param = ¶ms[i];
+ param->value.ul = 0;
+ param->type = VIR_TYPED_PARAM_ULLONG;
+
+ switch(i) {
+ case 0:
+ if (virStrcpyStatic(param->field,
+ VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC) == NULL) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Field name '%s' too long"),
+ VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC);
+ goto endjob;
+ }
+ param->value.ul = reply.total_bytes_sec;
+ break;
+
+ case 1:
+ if (virStrcpyStatic(param->field,
+ VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC) == NULL) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Field name '%s' too long"),
+ VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC);
+ goto endjob;
+ }
+ param->value.ul = reply.read_bytes_sec;
+ break;
+
+ case 2:
+ if (virStrcpyStatic(param->field,
+ VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC) == NULL) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Field name '%s' too long"),
+ VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC);
+ goto endjob;
+ }
+ param->value.ul = reply.write_bytes_sec;
+ break;
+
+ case 3:
+ if (virStrcpyStatic(param->field,
+ VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC) == NULL) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Field name '%s' too long"),
+ VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC);
+ goto endjob;
+ }
+ param->value.ul = reply.total_iops_sec;
+ break;
+
+ case 4:
+ if (virStrcpyStatic(param->field,
+ VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC) == NULL) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Field name '%s' too long"),
+ VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC);
+ goto endjob;
+ }
+ param->value.ul = reply.read_iops_sec;
+ break;
+
+ case 5:
+ if (virStrcpyStatic(param->field,
+ VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC) == NULL) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Field name '%s' too long"),
+ VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC);
+ goto endjob;
+ }
+ param->value.ul = reply.write_iops_sec;
+ break;
+ default:
+ break;
+ }
+ }
+ ret = 0;
+
+endjob:
+ if (qemuDomainObjEndJob(driver, vm) == 0)
+ vm = NULL;
+
+cleanup:
+ VIR_FREE(device);
+ if (vm)
+ virDomainObjUnlock(vm);
+ qemuDriverUnlock(driver);
+ return ret;
+}
static virDriver qemuDriver = {
.no = VIR_DRV_QEMU,
@@ -10919,6 +11259,8 @@ static virDriver qemuDriver = {
.domainGetBlockJobInfo = qemuDomainGetBlockJobInfo, /* 0.9.4 */
.domainBlockJobSetSpeed = qemuDomainBlockJobSetSpeed, /* 0.9.4 */
.domainBlockPull = qemuDomainBlockPull, /* 0.9.4 */
+ .domainSetBlockIoTune = qemuDomainSetBlockIoTune, /* 0.9.8 */
+ .domainGetBlockIoTune = qemuDomainGetBlockIoTune, /* 0.9.8 */
};
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 73e5ea9..c0b711f 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2567,6 +2567,43 @@ int qemuMonitorBlockJob(qemuMonitorPtr mon,
return ret;
}
+int qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon,
+ const char *device,
+ virDomainBlockIoTuneInfoPtr info,
+ unsigned int flags)
+{
+ int ret;
+
+ VIR_DEBUG("mon=%p, device=%p, info=%p, flags=%x",
+ mon, device, info, flags);
+
+ if (mon->json) {
+ ret = qemuMonitorJSONSetBlockIoThrottle(mon, device, info, flags);
+ } else {
+ ret = qemuMonitorTextSetBlockIoThrottle(mon, device, info, flags);
+ }
+ return ret;
+}
+
+int qemuMonitorGetBlockIoThrottle(qemuMonitorPtr mon,
+ const char *device,
+ virDomainBlockIoTuneInfoPtr reply,
+ unsigned int flags)
+{
+ int ret;
+
+ VIR_DEBUG("mon=%p, device=%p, reply=%p, flags=%x",
+ mon, device, reply, flags);
+
+ if (mon->json) {
+ ret = qemuMonitorJSONGetBlockIoThrottle(mon, device, reply, flags);
+ } else {
+ ret = qemuMonitorTextGetBlockIoThrottle(mon, device, reply, flags);
+ }
+ return ret;
+}
+
+
int qemuMonitorVMStatusToPausedReason(const char *status)
{
int st;
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 883e0aa..48c6db0 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -521,6 +521,28 @@ int qemuMonitorOpenGraphics(qemuMonitorPtr mon,
const char *fdname,
bool skipauth);
+
+typedef struct _virDomainBlockIoTuneInfo virDomainBlockIoTuneInfo;
+struct _virDomainBlockIoTuneInfo {
+ unsigned long long total_bytes_sec;
+ unsigned long long read_bytes_sec;
+ unsigned long long write_bytes_sec;
+ unsigned long long total_iops_sec;
+ unsigned long long read_iops_sec;
+ unsigned long long write_iops_sec;
+};
+typedef virDomainBlockIoTuneInfo *virDomainBlockIoTuneInfoPtr;
+
+int qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon,
+ const char *device,
+ virDomainBlockIoTuneInfoPtr info,
+ unsigned int flags);
+
+int qemuMonitorGetBlockIoThrottle(qemuMonitorPtr mon,
+ const char *device,
+ virDomainBlockIoTuneInfoPtr reply,
+ unsigned int flags);
+
/**
* When running two dd process and using <> redirection, we need a
* shell that will not truncate files. These two strings serve that
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 56a62db..925031e 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -3276,3 +3276,189 @@ int qemuMonitorJSONOpenGraphics(qemuMonitorPtr mon,
virJSONValueFree(reply);
return ret;
}
+
+
+static int
+qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr result,
+ const char *device,
+ virDomainBlockIoTuneInfoPtr reply)
+{
+ virJSONValuePtr io_throttle;
+ int ret = -1;
+ int i;
+ int found = 0;
+
+ io_throttle = virJSONValueObjectGet(result, "return");
+
+ if (!io_throttle || io_throttle->type != VIR_JSON_TYPE_ARRAY) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _(" block_io_throttle reply was missing device list "));
+ goto cleanup;
+ }
+
+ for (i = 0; i < virJSONValueArraySize(io_throttle); i++) {
+ virJSONValuePtr temp_dev = virJSONValueArrayGet(io_throttle, i);
+ virJSONValuePtr inserted;
+ const char *current_dev;
+
+ if (!temp_dev || temp_dev->type != VIR_JSON_TYPE_OBJECT) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("block io throttle device entry was not in expected format"));
+ goto cleanup;
+ }
+
+ if ((current_dev = virJSONValueObjectGetString(temp_dev, "device")) == NULL) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("block io throttle device entry was not in expected format"));
+ goto cleanup;
+ }
+
+ if(STRPREFIX(current_dev, QEMU_DRIVE_HOST_PREFIX))
+ current_dev += strlen(QEMU_DRIVE_HOST_PREFIX);
+
+ if (STREQ(current_dev, device))
+ continue;
+
+ found = 1;
+ if ((inserted = virJSONValueObjectGet(temp_dev, "inserted")) == NULL ||
+ inserted->type != VIR_JSON_TYPE_OBJECT) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("block io throttle inserted entry was not in expected format"));
+ goto cleanup;
+ }
+
+ if (virJSONValueObjectGetNumberUlong(inserted, "bps", &reply->total_bytes_sec) < 0) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot read %s"), "total_bytes_sec");
+ goto cleanup;
+ }
+
+ if (virJSONValueObjectGetNumberUlong(inserted, "bps_rd", &reply->read_bytes_sec) < 0) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot read %s"), "read_bytes_sec");
+ goto cleanup;
+ }
+
+ if (virJSONValueObjectGetNumberUlong(inserted, "bps_wr", &reply->write_bytes_sec) < 0) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot read %s"), "write_bytes_sec");
+ goto cleanup;
+ }
+
+ if (virJSONValueObjectGetNumberUlong(inserted, "iops", &reply->total_iops_sec) < 0) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot read %s"), "total_iops_sec");
+ goto cleanup;
+ }
+
+ if (virJSONValueObjectGetNumberUlong(inserted, "iops_rd", &reply->read_iops_sec) < 0) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot read %s"), "read_iops_sec");
+ goto cleanup;
+ }
+
+ if (virJSONValueObjectGetNumberUlong(inserted, "iops_wr", &reply->write_iops_sec) < 0) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot read %s"), "write_iops_sec");
+ goto cleanup;
+ }
+ break;
+ }
+
+ if (!found) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot found info for device '%s'"),
+ device);
+ goto cleanup;
+ }
+ ret = 0;
+
+cleanup:
+ return ret;
+}
+
+int qemuMonitorJSONSetBlockIoThrottle(qemuMonitorPtr mon,
+ const char *device,
+ virDomainBlockIoTuneInfoPtr info,
+ unsigned int flags)
+{
+ int ret = -1;
+ virJSONValuePtr cmd = NULL;
+ virJSONValuePtr result = NULL;
+
+ if (flags) {
+ cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle",
+ "s:device", device,
+ "U:bps", info->total_bytes_sec,
+ "U:bps_rd", info->read_bytes_sec,
+ "U:bps_wr", info->write_bytes_sec,
+ "U:iops", info->total_iops_sec,
+ "U:iops_rd", info->read_iops_sec,
+ "U:iops_wr", info->write_iops_sec,
+ NULL);
+ }
+
+ if (!cmd)
+ return -1;
+
+ ret = qemuMonitorJSONCommand(mon, cmd, &result);
+
+ if (ret == 0 && virJSONValueObjectHasKey(result, "error")) {
+ if (qemuMonitorJSONHasError(result, "DeviceNotActive"))
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ _("No active operation on device: %s"), device);
+ else if (qemuMonitorJSONHasError(result, "NotSupported"))
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ _("Operation is not supported for device: %s"), device);
+ else
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unexpected error"));
+ ret = -1;
+ }
+
+ virJSONValueFree(cmd);
+ virJSONValueFree(result);
+ return ret;
+}
+
+int qemuMonitorJSONGetBlockIoThrottle(qemuMonitorPtr mon,
+ const char *device,
+ virDomainBlockIoTuneInfoPtr reply,
+ unsigned int flags)
+{
+ int ret = -1;
+ virJSONValuePtr cmd = NULL;
+ virJSONValuePtr result = NULL;
+
+ if (!flags) {
+ cmd = qemuMonitorJSONMakeCommand("query-block",
+ NULL);
+ }
+
+ if (!cmd) {
+ return -1;
+ }
+
+ ret = qemuMonitorJSONCommand(mon, cmd, &result);
+
+ if (ret == 0 && virJSONValueObjectHasKey(result, "error")) {
+ if (qemuMonitorJSONHasError(result, "DeviceNotActive"))
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ _("No active operation on device: %s"), device);
+ else if (qemuMonitorJSONHasError(result, "NotSupported"))
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ _("Operation is not supported for device: %s"), device);
+ else
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unexpected error"));
+ ret = -1;
+ }
+
+ if (ret == 0 && !flags)
+ ret = qemuMonitorJSONBlockIoThrottleInfo(result, device, reply);
+
+ virJSONValueFree(cmd);
+ virJSONValueFree(result);
+ return ret;
+}
+
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index f10d7d2..bf12dc5 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -255,4 +255,14 @@ int qemuMonitorJSONOpenGraphics(qemuMonitorPtr mon,
const char *fdname,
bool skipauth);
+int qemuMonitorJSONSetBlockIoThrottle(qemuMonitorPtr mon,
+ const char *device,
+ virDomainBlockIoTuneInfoPtr info,
+ unsigned int flags);
+
+int qemuMonitorJSONGetBlockIoThrottle(qemuMonitorPtr mon,
+ const char *device,
+ virDomainBlockIoTuneInfoPtr reply,
+ unsigned int flags);
+
#endif /* QEMU_MONITOR_JSON_H */
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 5de4d24..0ccc111 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -3429,3 +3429,168 @@ cleanup:
VIR_FREE(cmd);
return ret;
}
+
+
+int qemuMonitorTextSetBlockIoThrottle(qemuMonitorPtr mon,
+ const char *device,
+ virDomainBlockIoTuneInfoPtr info,
+ unsigned int flags)
+{
+ char *cmd = NULL;
+ char *result = NULL;
+ int ret = 0;
+ const char *cmd_name = NULL;
+
+ /* For the not specified fields, 0 by default */
+ if (flags) {
+ cmd_name = "block_set_io_throttle";
+ ret = virAsprintf(&cmd, "%s %s %llu %llu %llu %llu %llu %llu", cmd_name,
+ device, info->total_bytes_sec, info->read_bytes_sec,
+ info->write_bytes_sec, info->total_iops_sec,
+ info->read_iops_sec, info->write_iops_sec);
+ }
+
+ if (ret < 0) {
+ virReportOOMError();
+ return -1;
+ }
+
+ if (qemuMonitorHMPCommand(mon, cmd, &result) < 0) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot run monitor command"));
+ ret = -1;
+ goto cleanup;
+ }
+
+ if (qemuMonitorTextCommandNotFound(cmd_name, result)) {
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ _("Command '%s' is not found"), cmd_name);
+ ret = -1;
+ goto cleanup;
+ }
+
+cleanup:
+ VIR_FREE(cmd);
+ VIR_FREE(result);
+ return ret;
+}
+
+static int qemuMonitorTextParseBlockIoThrottle(const char *result,
+ const char *device,
+ virDomainBlockIoTuneInfoPtr reply)
+{
+ char *dummy = NULL;
+ int ret = -1;
+ const char *p, *eol;
+ int devnamelen = strlen(device);
+
+ p = result;
+
+ while (*p) {
+ if (STRPREFIX(p, QEMU_DRIVE_HOST_PREFIX))
+ p += strlen(QEMU_DRIVE_HOST_PREFIX);
+
+ if (STREQLEN(p, device, devnamelen) &&
+ p[devnamelen] == ':' && p[devnamelen+1] == ' ') {
+
+ eol = strchr(p, '\n');
+ if (!eol)
+ eol = p + strlen(p);
+
+ p += devnamelen + 2; /*Skip to first label. */
+
+ while (*p) {
+ if (STRPREFIX(p, "bps=")) {
+ p += strlen("bps=");
+ if (virStrToLong_ull(p, &dummy, 10, &reply->total_bytes_sec) == -1)
+ VIR_DEBUG("error reading total_bytes_sec: %s", p);
+ } else if (STRPREFIX(p, "bps_rd=")) {
+ p += strlen("bps_rd=");
+ if (virStrToLong_ull(p, &dummy, 10, &reply->read_bytes_sec) == -1)
+ VIR_DEBUG("error reading read_bytes_sec: %s", p);
+ } else if (STRPREFIX(p, "bps_wr=")) {
+ p += strlen("bps_wr=");
+ if (virStrToLong_ull(p, &dummy, 10, &reply->write_bytes_sec) == -1)
+ VIR_DEBUG("error reading write_bytes_sec: %s", p);
+ } else if (STRPREFIX(p, "iops=")) {
+ p += strlen("iops=");
+ if (virStrToLong_ull(p, &dummy, 10, &reply->total_iops_sec) == -1)
+ VIR_DEBUG("error reading total_iops_sec: %s", p);
+ } else if (STRPREFIX(p, "iops_rd=")) {
+ p += strlen("iops_rd=");
+ if (virStrToLong_ull(p, &dummy, 10, &reply->read_iops_sec) == -1)
+ VIR_DEBUG("error reading read_iops_sec: %s", p);
+ } else if (STRPREFIX(p, "iops_wr=")) {
+ p += strlen("iops_wr=");
+ if (virStrToLong_ull(p, &dummy, 10, &reply->write_iops_sec) == -1)
+ VIR_DEBUG("error reading write_iops_sec: %s", p);
+ } else {
+ VIR_DEBUG(" unknown block info %s", p);
+ }
+
+ /* Skip to next label. */
+ p = strchr (p, ' ');
+ if (!p || p >= eol)
+ break;
+ p++;
+ }
+ ret = 0;
+ goto cleanup;
+ }
+
+ /* Skip to next line. */
+ p = strchr (p, '\n');
+ if (!p)
+ break;
+ p++;
+ }
+
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ _("No info for device '%s'"), device);
+
+cleanup:
+ return ret;
+}
+
+int qemuMonitorTextGetBlockIoThrottle(qemuMonitorPtr mon,
+ const char *device,
+ virDomainBlockIoTuneInfoPtr reply,
+ unsigned int flags)
+{
+ char *cmd = NULL;
+ char *result = NULL;
+ int ret = 0;
+ const char *cmd_name = NULL;
+
+ if (flags) {
+ cmd_name = "info block";
+ ret = virAsprintf(&cmd, "%s", cmd_name);
+ }
+
+ if (ret < 0) {
+ virReportOOMError();
+ return -1;
+ }
+
+ if (qemuMonitorHMPCommand(mon, cmd, &result) < 0) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot run monitor command"));
+ ret = -1;
+ goto cleanup;
+ }
+
+ if (qemuMonitorTextCommandNotFound(cmd_name, result)) {
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ _("Command '%s' is not found"), cmd_name);
+ ret = -1;
+ goto cleanup;
+ }
+
+ ret = qemuMonitorTextParseBlockIoThrottle(result, device, reply);
+
+cleanup:
+ VIR_FREE(cmd);
+ VIR_FREE(result);
+ return ret;
+}
+
diff --git a/src/qemu/qemu_monitor_text.h b/src/qemu/qemu_monitor_text.h
index f32fce0..1c47d39 100644
--- a/src/qemu/qemu_monitor_text.h
+++ b/src/qemu/qemu_monitor_text.h
@@ -248,4 +248,14 @@ int qemuMonitorTextOpenGraphics(qemuMonitorPtr mon,
const char *fdname,
bool skipauth);
+int qemuMonitorTextSetBlockIoThrottle(qemuMonitorPtr mon,
+ const char *device,
+ virDomainBlockIoTuneInfoPtr info,
+ unsigned int flags);
+
+int qemuMonitorTextGetBlockIoThrottle(qemuMonitorPtr mon,
+ const char *device,
+ virDomainBlockIoTuneInfoPtr reply,
+ unsigned int flags);
+
#endif /* QEMU_MONITOR_TEXT_H */
--
1.7.1
3
4
28 Nov '11
This patch series introduce new API "virDomainBlockResize" to expose
qemu monitor command "block_size", which is for resizing the a block
device while the domain is running.
The prototype for the new API is:
int
virDomainBlockResize (virDomainPtr dom,
const char *path,
unsigned long long size,
unsigned int flags)
* "@path" is the absolute path of the block device, which can be
extraced from domain xml.
* The units for "@size" is kilobytes, which might be not quite properly.
(qemu HMP uses Megabytes as the default units, QMP uses Bytes as the
default units, so it means we need to divice "@size" by 1024 for HMP,
and multiply "@size" by 1024 for QMP. On the other hand, we need to
check the overflowing). Any ideas on this is welcomed.
* "@flags" is unused currently.
[PATCH 1/5] block_resize: Define the new API
[PATCH 2/5] block_resize: Wire up the remote protocol
[PATCH 3/5] block_resize: Implement qemu monitor functions
[PATCH 4/5] block_resize: Implement qemu driver method
[PATCH 5/5] block_resize: Expose the new API to virsh
3
8