Add a virDBusErrorIsUnknownMethod helper so that callers
don't need todo string comparisons themselves to detect
standard error names.
virDBusCreateMethodV;
virDBusCreateReply;
virDBusCreateReplyV;
+virDBusErrorIsUnknownMethod;
virDBusGetSessionBus;
virDBusGetSystemBus;
virDBusHasSystemBus;
/* nothing */
}
#endif /* ! WITH_DBUS */
+
+bool virDBusErrorIsUnknownMethod(virErrorPtr err)
+{
+ return err->domain == VIR_FROM_DBUS &&
+ err->code == VIR_ERR_DBUS_SERVICE &&
+ err->level == VIR_ERR_ERROR &&
+ STREQ_NULLABLE("org.freedesktop.DBus.Error.UnknownMethod",
+ err->str1);
+}
int virDBusIsServiceEnabled(const char *name);
int virDBusIsServiceRegistered(const char *name);
+
+bool virDBusErrorIsUnknownMethod(virErrorPtr err);
#endif /* __VIR_DBUS_H__ */
goto cleanup;
if (error.level == VIR_ERR_ERROR) {
- if (STREQ_NULLABLE("org.freedesktop.DBus.Error.UnknownMethod",
- error.str1)) {
+ if (virDBusErrorIsUnknownMethod(&error)) {
VIR_INFO("CreateMachineWithNetwork isn't supported, switching "
"to legacy CreateMachine method for systemd-machined");
virResetError(&error);