Пример #1
0
/**
 * virSecretEventLifecycleNew:
 * @uuid: UUID of the secret object the event describes
 * @usage_type: type of usage for the secret
 * @usage_id: usage specific identifier for the secret
 * @type: type of lifecycle event
 * @detail: more details about @type
 *
 * Create a new secret lifecycle event.
 */
virObjectEventPtr
virSecretEventLifecycleNew(const unsigned char *uuid,
                           int usage_type,
                           const char *usage_id,
                           int type,
                           int detail)
{
    virSecretEventLifecyclePtr event;
    char uuidstr[VIR_UUID_STRING_BUFLEN];

    if (virSecretEventsInitialize() < 0)
        return NULL;

    virUUIDFormat(uuid, uuidstr);
    VIR_DEBUG("Event %s %d %s %d %d", uuidstr, usage_type, usage_id, type, detail);
    if (!(event = virObjectEventNew(virSecretEventLifecycleClass,
                                    virSecretEventDispatchDefaultFunc,
                                    VIR_SECRET_EVENT_ID_LIFECYCLE,
                                    usage_type, usage_id, uuid, uuidstr)))
        return NULL;

    event->type = type;
    event->detail = detail;

    return (virObjectEventPtr)event;
}
Пример #2
0
static void *
virDomainEventNew(virClassPtr klass,
                  int eventID,
                  int id,
                  const char *name,
                  const unsigned char *uuid)
{
    virDomainEventPtr event;

    if (virDomainEventsInitialize() < 0)
        return NULL;

    if (!virClassIsDerivedFrom(klass, virDomainEventClass)) {
        virReportInvalidArg(klass,
                            _("Class %s must derive from virDomainEvent"),
                            virClassName(klass));
        return NULL;
    }

    if (!(event = virObjectEventNew(klass,
                                    virDomainEventDispatchDefaultFunc,
                                    eventID,
                                    id, name, uuid)))
        return NULL;

    return (virObjectEventPtr)event;
}
Пример #3
0
/**
 * virNodeDeviceEventUpdateNew:
 * @name: name of the node device object the event describes
 *
 * Create a new node device update event.
 */
virObjectEventPtr
virNodeDeviceEventUpdateNew(const char *name)
{
    virNodeDeviceEventUpdatePtr event;

    if (virNodeDeviceEventsInitialize() < 0)
        return NULL;

    if (!(event = virObjectEventNew(virNodeDeviceEventUpdateClass,
                                    virNodeDeviceEventDispatchDefaultFunc,
                                    VIR_NODE_DEVICE_EVENT_ID_UPDATE,
                                    0, name, NULL, name)))
        return NULL;

    return (virObjectEventPtr)event;
}
Пример #4
0
/**
 * virNodeDeviceEventLifecycleNew:
 * @name: name of the node device object the event describes
 * @type: type of lifecycle event
 * @detail: more details about @type
 *
 * Create a new node device lifecycle event.
 */
virObjectEventPtr
virNodeDeviceEventLifecycleNew(const char *name,
                               int type,
                               int detail)
{
    virNodeDeviceEventLifecyclePtr event;

    if (virNodeDeviceEventsInitialize() < 0)
        return NULL;

    if (!(event = virObjectEventNew(virNodeDeviceEventLifecycleClass,
                                    virNodeDeviceEventDispatchDefaultFunc,
                                    VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE,
                                    0, name, NULL, name)))
        return NULL;

    event->type = type;
    event->detail = detail;

    return (virObjectEventPtr)event;
}
Пример #5
0
/**
 * virSecretEventValueChangedNew:
 * @uuid: UUID of the secret object the event describes
 *
 * Create a new secret lifecycle event.
 */
virObjectEventPtr
virSecretEventValueChangedNew(const unsigned char *uuid,
                              int usage_type,
                              const char *usage_id)
{
    virSecretEventValueChangedPtr event;
    char uuidstr[VIR_UUID_STRING_BUFLEN];

    if (virSecretEventsInitialize() < 0)
        return NULL;

    virUUIDFormat(uuid, uuidstr);
    VIR_DEBUG("Event %s %d %s", uuidstr, usage_type, usage_id);
    if (!(event = virObjectEventNew(virSecretEventValueChangedClass,
                                    virSecretEventDispatchDefaultFunc,
                                    VIR_SECRET_EVENT_ID_VALUE_CHANGED,
                                    usage_type, usage_id, uuid, uuidstr)))
        return NULL;

    return (virObjectEventPtr)event;
}
Пример #6
0
/**
 * virNetworkEventLifecycleNew:
 * @name: name of the network object the event describes
 * @uuid: uuid of the network object the event describes
 * @type: type of lifecycle event
 * @detail: more details about @type
 *
 * Create a new network lifecycle event.
 */
virObjectEventPtr
virNetworkEventLifecycleNew(const char *name,
                            const unsigned char *uuid,
                            int type,
                            int detail)
{
    virNetworkEventLifecyclePtr event;

    if (virNetworkEventsInitialize() < 0)
        return NULL;

    if (!(event = virObjectEventNew(virNetworkEventLifecycleClass,
                                    virNetworkEventDispatchDefaultFunc,
                                    VIR_NETWORK_EVENT_ID_LIFECYCLE,
                                    0, name, uuid)))
        return NULL;

    event->type = type;
    event->detail = detail;

    return (virObjectEventPtr)event;
}