events.c 30.6 KB
Newer Older
1 2 3
#include "domain.h"
#include "events.h"
#include "util.h"
4
#include "storagepool.h"
5

Pavel Hrdina's avatar
Pavel Hrdina committed
6
#include <libvirt/libvirt.h>
7

8
static gint
9 10 11 12 13
virtDBusEventsDomainAgentEvent(virConnectPtr connection G_GNUC_UNUSED,
                               virDomainPtr domain,
                               gint state,
                               gint reason,
                               gpointer opaque)
14 15 16 17 18 19 20 21 22 23
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
24
                                  "AgentEvent",
25 26 27 28 29 30
                                  g_variant_new("(ii)", state, reason),
                                  NULL);

    return 0;
}

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
static gint
virtDBusEventsDomainBalloonChange(virConnectPtr connection G_GNUC_UNUSED,
                                  virDomainPtr domain,
                                  guint64 actual,
                                  gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "BalloonChange",
                                  g_variant_new("(t)", actual),
                                  NULL);

    return 0;
}

53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
static gint
virtDBusEventsDomainBlockJob(virConnectPtr connection G_GNUC_UNUSED,
                             virDomainPtr domain,
                             gchar *disk,
                             gint type,
                             gint status,
                             gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "BlockJob",
                                  g_variant_new("(sii)", disk, type, status),
                                  NULL);

    return 0;
}

77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
static gint
virtDBusEventsDomainControlError(virConnectPtr connection G_GNUC_UNUSED,
                                 virDomainPtr domain,
                                 gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "ControlError",
                                  NULL,
                                  NULL);

    return 0;
}

98
static gint
99 100 101 102 103
virtDBusEventsDomainEvent(virConnectPtr connection G_GNUC_UNUSED,
                          virDomainPtr domain,
                          gint event,
                          gint detail,
                          gpointer opaque)
104
{
105
    virtDBusConnect *connect = opaque;
106
    g_autofree gchar *path = NULL;
107

108
    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);
109

110 111 112 113
    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  connect->connectPath,
                                  VIRT_DBUS_CONNECT_INTERFACE,
114
                                  "DomainEvent",
115
                                  g_variant_new("(oii)", path, event, detail),
116
                                  NULL);
117

118
    return 0;
119 120
}

121 122
static gint
virtDBusEventsDomainDeviceAdded(virConnectPtr connection G_GNUC_UNUSED,
123
                                virDomainPtr domain,
124 125
                                const gchar *device,
                                gpointer opaque)
126
{
127
    virtDBusConnect *connect = opaque;
128
    g_autofree gchar *path = NULL;
129

130
    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);
131

132 133
    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
134
                                  path,
135
                                  VIRT_DBUS_DOMAIN_INTERFACE,
136 137 138
                                  "DeviceAdded",
                                  g_variant_new("(s)", device),
                                  NULL);
139

140
    return 0;
141 142
}

143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
static gint
virtDBusEventsDomainDeviceRemovalFailed(virConnectPtr connection G_GNUC_UNUSED,
                                        virDomainPtr domain,
                                        const gchar *device,
                                        gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "DeviceRemovalFailed",
                                  g_variant_new("(s)", device),
                                  NULL);

    return 0;
}

165 166
static gint
virtDBusEventsDomainDeviceRemoved(virConnectPtr connection G_GNUC_UNUSED,
167
                                  virDomainPtr domain,
168 169
                                  const gchar *device,
                                  gpointer opaque)
170
{
171
    virtDBusConnect *connect = opaque;
172
    g_autofree gchar *path = NULL;
173

174
    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);
175

176 177
    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
178
                                  path,
179
                                  VIRT_DBUS_DOMAIN_INTERFACE,
180 181 182
                                  "DeviceRemoved",
                                  g_variant_new("(s)", device),
                                  NULL);
183

184
    return 0;
185 186
}

187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
static gint
virtDBusEventsDomainGraphics(virConnectPtr connection G_GNUC_UNUSED,
                             virDomainPtr domain,
                             gint phase,
                             const virDomainEventGraphicsAddress *local,
                             const virDomainEventGraphicsAddress *remote,
                             const gchar *authScheme,
                             const virDomainEventGraphicsSubject *subject,
                             gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;
    GVariantBuilder builder;
    GVariant *gret;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    g_variant_builder_init(&builder, G_VARIANT_TYPE("(i(iss)(iss)sa(ss))"));

    g_variant_builder_add(&builder, "i", phase);

    g_variant_builder_open(&builder, G_VARIANT_TYPE("(iss)"));
    g_variant_builder_add(&builder, "i", local->family);
    g_variant_builder_add(&builder, "s", VIRT_DBUS_EMPTY_STR(local->node));
    g_variant_builder_add(&builder, "s", VIRT_DBUS_EMPTY_STR(local->service));
    g_variant_builder_close(&builder);

    g_variant_builder_open(&builder, G_VARIANT_TYPE("(iss)"));
    g_variant_builder_add(&builder, "i", remote->family);
    g_variant_builder_add(&builder, "s", VIRT_DBUS_EMPTY_STR(remote->node));
    g_variant_builder_add(&builder, "s", VIRT_DBUS_EMPTY_STR(remote->service));
    g_variant_builder_close(&builder);

    g_variant_builder_add(&builder, "s", authScheme);

    g_variant_builder_open(&builder, G_VARIANT_TYPE("a(ss)"));
    for (gint i = 0; i < subject->nidentity; i++) {
        g_variant_builder_open(&builder, G_VARIANT_TYPE("(ss)"));
        g_variant_builder_add(&builder, "s", subject->identities[i].type);
        g_variant_builder_add(&builder, "s", subject->identities[i].name);
        g_variant_builder_close(&builder);
    }
    g_variant_builder_close(&builder);
    gret = g_variant_builder_end(&builder);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "Graphics",
                                  gret,
                                  NULL);

    return 0;
}

243
static gint
244 245 246 247 248 249 250
virtDBusEventsDomainIOError(virConnectPtr connection G_GNUC_UNUSED,
                            virDomainPtr domain,
                            const gchar *srcPath,
                            const gchar *device,
                            gint action,
                            const gchar *reason,
                            gpointer opaque)
251 252 253 254 255 256 257 258 259 260
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
261
                                  "IOError",
262 263 264 265 266 267 268 269
                                  g_variant_new("(ssis)", srcPath,
                                                VIRT_DBUS_EMPTY_STR(device),
                                                action, reason),
                                  NULL);

    return 0;
}

270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
static gint
virtDBusEventsDomainJobCompleted(virConnectPtr connection G_GNUC_UNUSED,
                                 virDomainPtr domain,
                                 virTypedParameterPtr params,
                                 gint nparams,
                                 gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;
    GVariant *gargs;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    gargs = virtDBusUtilTypedParamsToGVariant(params, nparams);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "JobCompleted",
                                  g_variant_new_tuple(&gargs, 1),
                                  NULL);

    return 0;
}

296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
static gint
virtDBusEventsDomainMetadataChange(virConnectPtr connection G_GNUC_UNUSED,
                                   virDomainPtr domain,
                                   gint type,
                                   const gchar *nsuri,
                                   gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "MetadataChange",
                                  g_variant_new("(is)", type, nsuri),
                                  NULL);

    return 0;
}

319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340
static gint
virtDBusEventsDomainMigrationIteration(virConnectPtr connection G_GNUC_UNUSED,
                                       virDomainPtr domain,
                                       gint iteration,
                                       gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "MigrationIteration",
                                  g_variant_new("(i)", iteration),
                                  NULL);

    return 0;
}

341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
static gint
virtDBusEventsDomainPMSuspend(virConnectPtr connection G_GNUC_UNUSED,
                              virDomainPtr domain,
                              gint reason,
                              gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "PMSuspend",
                                  g_variant_new("(i)", reason),
                                  NULL);

    return 0;
}

363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
static gint
virtDBusEventsDomainPMSuspendDisk(virConnectPtr connection G_GNUC_UNUSED,
                                  virDomainPtr domain,
                                  gint reason,
                                  gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "PMSuspendDisk",
                                  g_variant_new("(i)", reason),
                                  NULL);

    return 0;
}

385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
static gint
virtDBusEventsDomainPMWakeup(virConnectPtr connection G_GNUC_UNUSED,
                             virDomainPtr domain,
                             gint reason,
                             gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "PMWakeup",
                                  g_variant_new("(i)", reason),
                                  NULL);

    return 0;
}

407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
static gint
virtDBusEventsDomainReboot(virConnectPtr connection G_GNUC_UNUSED,
                           virDomainPtr domain,
                           gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "Reboot",
                                  NULL,
                                  NULL);

    return 0;
}

428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449
static gint
virtDBusEventsDomainRTCChange(virConnectPtr connection G_GNUC_UNUSED,
                              virDomainPtr domain,
                              gint64 utcoffset,
                              gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "RTCChange",
                                  g_variant_new("(x)", utcoffset),
                                  NULL);

    return 0;
}

450 451
static gint
virtDBusEventsDomainTrayChange(virConnectPtr connection G_GNUC_UNUSED,
452
                               virDomainPtr domain,
453 454 455
                               const gchar *device,
                               gint reason,
                               gpointer opaque)
456
{
457
    virtDBusConnect *connect = opaque;
458
    g_autofree gchar *path = NULL;
459

460
    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);
461

462 463 464 465 466
    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "TrayChange",
467
                                  g_variant_new("(si)", device, reason),
468
                                  NULL);
469

470
    return 0;
471 472
}

473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498
static gint
virtDBusEventsDomainTunable(virConnectPtr connection G_GNUC_UNUSED,
                            virDomainPtr domain,
                            virTypedParameterPtr params,
                            gint nparams,
                            gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;
    GVariant *gargs;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    gargs = virtDBusUtilTypedParamsToGVariant(params, nparams);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "Tunable",
                                  g_variant_new_tuple(&gargs, 1),
                                  NULL);

    return 0;
}

499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520
static gint
virtDBusEventsDomainWatchdog(virConnectPtr connection G_GNUC_UNUSED,
                             virDomainPtr domain,
                             gint action,
                             gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "Watchdog",
                                  g_variant_new("(i)", action),
                                  NULL);

    return 0;
}

521 522
static gint
virtDBusEventsDomainDiskChange(virConnectPtr connection G_GNUC_UNUSED,
523
                               virDomainPtr domain,
524 525 526 527 528
                               const gchar *old_src_path,
                               const gchar *new_src_path,
                               const gchar *device,
                               gint reason,
                               gpointer opaque)
529
{
530
    virtDBusConnect *connect = opaque;
531
    g_autofree gchar *path = NULL;
532

533
    path = virtDBusUtilBusPathForVirDomain(domain, connect->domainPath);
534

535 536 537 538 539
    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_DOMAIN_INTERFACE,
                                  "DiskChange",
540
                                  g_variant_new("(sssi)", old_src_path,
541
                                                new_src_path, device, reason),
542
                                  NULL);
543

544
    return 0;
545 546
}

547
static gint
548
virtDBusEventsNetworkEvent(virConnectPtr connection G_GNUC_UNUSED,
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563
                               virNetworkPtr network,
                               gint event,
                               gint detail G_GNUC_UNUSED,
                               gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirNetwork(network, connect->networkPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  connect->connectPath,
                                  VIRT_DBUS_CONNECT_INTERFACE,
                                  "NetworkEvent",
564
                                  g_variant_new("(oi)", path, event),
565 566 567 568 569
                                  NULL);

    return 0;
}

570
static gint
571
virtDBusEventsSecretEvent(virConnectPtr connection G_GNUC_UNUSED,
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586
                              virSecretPtr secret,
                              gint event,
                              gint detail,
                              gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirSecret(secret, connect->secretPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  connect->connectPath,
                                  VIRT_DBUS_CONNECT_INTERFACE,
                                  "SecretEvent",
587
                                  g_variant_new("(oii)", path, event, detail),
588 589 590 591 592
                                  NULL);

    return 0;
}

593
static gint
594
virtDBusEventsStoragePoolEvent(virConnectPtr connection G_GNUC_UNUSED,
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610
                                   virStoragePoolPtr storagePool,
                                   gint event,
                                   gint detail,
                                   gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirStoragePool(storagePool,
                                                connect->storagePoolPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  connect->connectPath,
                                  VIRT_DBUS_CONNECT_INTERFACE,
                                  "StoragePoolEvent",
611
                                  g_variant_new("(oii)", path, event, detail),
612 613 614 615 616
                                  NULL);

    return 0;
}

617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638
static gint
virtDBusEventsStoragePoolRefresh(virConnectPtr connection G_GNUC_UNUSED,
                                 virStoragePoolPtr storagePool,
                                 gpointer opaque)
{
    virtDBusConnect *connect = opaque;
    g_autofree gchar *path = NULL;

    path = virtDBusUtilBusPathForVirStoragePool(storagePool,
                                                connect->storagePoolPath);

    g_dbus_connection_emit_signal(connect->bus,
                                  NULL,
                                  path,
                                  VIRT_DBUS_STORAGEPOOL_INTERFACE,
                                  "Refresh",
                                  NULL,
                                  NULL);

    return 0;
}

639
static void
640 641 642
virtDBusEventsRegisterDomainEvent(virtDBusConnect *connect,
                                  gint id,
                                  virConnectDomainEventGenericCallback callback)
643
{
644 645 646 647 648 649 650 651
    g_assert(connect->domainCallbackIds[id] == -1);

    connect->domainCallbackIds[id] = virConnectDomainEventRegisterAny(connect->connection,
                                                                      NULL,
                                                                      id,
                                                                      VIR_DOMAIN_EVENT_CALLBACK(callback),
                                                                      connect,
                                                                      NULL);
652 653
}

654 655 656 657 658 659 660 661 662 663 664 665 666 667 668
static void
virtDBusEventsRegisterNetworkEvent(virtDBusConnect *connect,
                                   gint id,
                                   virConnectNetworkEventGenericCallback callback)
{
    g_assert(connect->networkCallbackIds[id] == -1);

    connect->networkCallbackIds[id] = virConnectNetworkEventRegisterAny(connect->connection,
                                                                        NULL,
                                                                        id,
                                                                        VIR_NETWORK_EVENT_CALLBACK(callback),
                                                                        connect,
                                                                        NULL);
}

669 670 671 672 673 674 675 676 677 678 679 680 681 682 683
static void
virtDBusEventsRegisterSecretEvent(virtDBusConnect *connect,
                                  gint id,
                                  virConnectSecretEventGenericCallback callback)
{
    g_assert(connect->secretCallbackIds[id] == -1);

    connect->secretCallbackIds[id] = virConnectSecretEventRegisterAny(connect->connection,
                                                                      NULL,
                                                                      id,
                                                                      VIR_SECRET_EVENT_CALLBACK(callback),
                                                                      connect,
                                                                      NULL);
}

684 685 686 687 688 689 690 691 692 693 694 695 696 697 698
static void
virtDBusEventsRegisterStoragePoolEvent(virtDBusConnect *connect,
                                       gint id,
                                       virConnectStoragePoolEventGenericCallback callback)
{
    g_assert(connect->storagePoolCallbackIds[id] == -1);

    connect->storagePoolCallbackIds[id] = virConnectStoragePoolEventRegisterAny(connect->connection,
                                                                                NULL,
                                                                                id,
                                                                                VIR_STORAGE_POOL_EVENT_CALLBACK(callback),
                                                                                connect,
                                                                                NULL);
}

699
void
700
virtDBusEventsRegister(virtDBusConnect *connect)
701
{
702 703
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE,
704
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainAgentEvent));
705

706 707 708 709
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainBalloonChange));

710 711 712 713
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainBlockJob));

714 715 716 717
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_CONTROL_ERROR,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainControlError));

718 719
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_LIFECYCLE,
720
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainEvent));
721

722 723 724
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_DEVICE_ADDED,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainDeviceAdded));
725

726 727 728 729
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainDeviceRemovalFailed));

730 731 732
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainDeviceRemoved));
733

734 735 736
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_DISK_CHANGE,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainDiskChange));
737

738 739 740 741
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_GRAPHICS,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainGraphics));

742 743
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON,
744
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainIOError));
745

746 747 748 749
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_JOB_COMPLETED,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainJobCompleted));

750 751 752 753
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_METADATA_CHANGE,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainMetadataChange));

754 755 756 757
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainMigrationIteration));

758 759 760 761
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_PMSUSPEND,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainPMSuspend));

762 763 764 765
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainPMSuspendDisk));

766 767 768 769
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_PMWAKEUP,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainPMWakeup));

770 771 772 773
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_REBOOT,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainReboot));

774 775 776 777
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_RTC_CHANGE,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainRTCChange));

778 779 780
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_TRAY_CHANGE,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainTrayChange));
781

782 783 784 785
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_TUNABLE,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainTunable));

786 787 788 789
    virtDBusEventsRegisterDomainEvent(connect,
                                      VIR_DOMAIN_EVENT_ID_WATCHDOG,
                                      VIR_DOMAIN_EVENT_CALLBACK(virtDBusEventsDomainWatchdog));

790 791
    virtDBusEventsRegisterNetworkEvent(connect,
                                       VIR_NETWORK_EVENT_ID_LIFECYCLE,
792
                                       VIR_NETWORK_EVENT_CALLBACK(virtDBusEventsNetworkEvent));
793

794 795
    virtDBusEventsRegisterSecretEvent(connect,
                                      VIR_SECRET_EVENT_ID_LIFECYCLE,
796
                                      VIR_SECRET_EVENT_CALLBACK(virtDBusEventsSecretEvent));
797

798 799
    virtDBusEventsRegisterStoragePoolEvent(connect,
                                           VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
800
                                           VIR_STORAGE_POOL_EVENT_CALLBACK(virtDBusEventsStoragePoolEvent));
801 802 803 804

    virtDBusEventsRegisterStoragePoolEvent(connect,
                                           VIR_STORAGE_POOL_EVENT_ID_REFRESH,
                                           VIR_STORAGE_POOL_EVENT_CALLBACK(virtDBusEventsStoragePoolRefresh));
805
}