Emit a signal when switching to the PMSUSPENDED state, and add
an enum entry to describe this state. This avoids runtime warnings
with newer libvirt.
---
libvirt-gobject/libvirt-gobject-connection.c | 7 +++++++
libvirt-gobject/libvirt-gobject-domain.c | 11 +++++++++++
libvirt-gobject/libvirt-gobject-domain.h | 19 +++++++++++--------
3 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-connection.c
b/libvirt-gobject/libvirt-gobject-connection.c
index 428ae38..ad7aa07 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -389,6 +389,13 @@ static int domain_event_cb(virConnectPtr conn G_GNUC_UNUSED,
case VIR_DOMAIN_EVENT_SHUTDOWN:
break;
+ case VIR_DOMAIN_EVENT_PMSUSPENDED:
+ if (detail == VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY)
+ g_signal_emit_by_name(gdom, "pmsuspended::memory");
+ else
+ g_warn_if_reached();
+ break;
+
default:
g_warn_if_reached();
}
diff --git a/libvirt-gobject/libvirt-gobject-domain.c
b/libvirt-gobject/libvirt-gobject-domain.c
index bcfad2a..f8ad493 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -55,6 +55,7 @@ enum {
VIR_RESUMED,
VIR_STOPPED,
VIR_UPDATED,
+ VIR_PMSUSPENDED,
LAST_SIGNAL
};
@@ -225,6 +226,16 @@ static void gvir_domain_class_init(GVirDomainClass *klass)
G_TYPE_NONE,
0);
+ signals[VIR_PMSUSPENDED] = g_signal_new("pmsuspended",
+ G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE |
+ G_SIGNAL_NO_HOOKS | G_SIGNAL_DETAILED,
+ G_STRUCT_OFFSET(GVirDomainClass, pmsuspended),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
g_type_class_add_private(klass, sizeof(GVirDomainPrivate));
}
diff --git a/libvirt-gobject/libvirt-gobject-domain.h
b/libvirt-gobject/libvirt-gobject-domain.h
index 7810d1b..fc2db7c 100644
--- a/libvirt-gobject/libvirt-gobject-domain.h
+++ b/libvirt-gobject/libvirt-gobject-domain.h
@@ -66,19 +66,22 @@ struct _GVirDomainClass
void (*resumed)(GVirDomain *dom);
void (*updated)(GVirDomain *dom);
void (*suspended)(GVirDomain *dom);
+ void (*pmsuspended)(GVirDomain *dom);
- gpointer padding[20];
+ gpointer padding[19];
};
typedef enum {
- GVIR_DOMAIN_STATE_NONE = 0, /* no state */
- GVIR_DOMAIN_STATE_RUNNING = 1, /* the domain is running */
- GVIR_DOMAIN_STATE_BLOCKED = 2, /* the domain is blocked on resource */
- GVIR_DOMAIN_STATE_PAUSED = 3, /* the domain is paused by user */
- GVIR_DOMAIN_STATE_SHUTDOWN= 4, /* the domain is being shut down */
- GVIR_DOMAIN_STATE_SHUTOFF = 5, /* the domain is shut off */
- GVIR_DOMAIN_STATE_CRASHED = 6 /* the domain is crashed */
+ GVIR_DOMAIN_STATE_NONE = 0, /* no state */
+ GVIR_DOMAIN_STATE_RUNNING = 1, /* the domain is running */
+ GVIR_DOMAIN_STATE_BLOCKED = 2, /* the domain is blocked on resource */
+ GVIR_DOMAIN_STATE_PAUSED = 3, /* the domain is paused by user */
+ GVIR_DOMAIN_STATE_SHUTDOWN= 4, /* the domain is being shut down */
+ GVIR_DOMAIN_STATE_SHUTOFF = 5, /* the domain is shut off */
+ GVIR_DOMAIN_STATE_CRASHED = 6, /* the domain is crashed */
+ GVIR_DOMAIN_STATE_PMSUSPENDED = 7 /* the domain is suspended by guest
+ power management */
} GVirDomainState;
--
1.7.11.4