Exemplo n.º 1
0
class EventType(NotificationObject):
    # Version 1.0: Initial version
    # Version 1.1: New valid actions values are added to the
    #              NotificationActionField enum
    # Version 1.2: DELETE value is added to the NotificationActionField enum
    # Version 1.3: Set of new values are added to NotificationActionField enum
    # Version 1.4: Another set of new values are added to
    #              NotificationActionField enum
    # Version 1.5: Aggregate related values have been added to
    #              NotificationActionField enum
    # Version 1.6: ADD_FIX_IP replaced with INTERFACE_ATTACH in
    #              NotificationActionField enum
    # Version 1.7: REMOVE_FIXED_IP replaced with INTERFACE_DETACH in
    #              NotificationActionField enum
    # Version 1.8: IMPORT value is added to NotificationActionField enum
    VERSION = '1.8'

    fields = {
        'object': fields.StringField(nullable=False),
        'action': fields.NotificationActionField(nullable=False),
        'phase': fields.NotificationPhaseField(nullable=True),
    }

    def __init__(self, object, action, phase=None):
        super(EventType, self).__init__()
        self.object = object
        self.action = action
        self.phase = phase

    def to_notification_event_type_field(self):
        """Serialize the object to the wire format."""
        s = '%s.%s' % (self.object, self.action)
        if self.phase:
            s += '.%s' % self.phase
        return s
Exemplo n.º 2
0
 def setUp(self):
     super(TestNotificationPhase, self).setUp()
     self.field = fields.NotificationPhaseField()
     self.coerce_good_values = [('start', 'start'), ('end', 'end'),
                                ('error', 'error')]
     self.coerce_bad_values = ['begin']
     self.to_primitive_values = self.coerce_good_values[0:1]
     self.from_primitive_values = self.coerce_good_values[0:1]
Exemplo n.º 3
0
class EventType(NotificationObject):
    # Version 1.0: Initial version
    # Version 1.1: New valid actions values are added to the
    #              NotificationActionField enum
    # Version 1.2: DELETE value is added to the NotificationActionField enum
    # Version 1.3: Set of new values are added to NotificationActionField enum
    # Version 1.4: Another set of new values are added to
    #              NotificationActionField enum
    # Version 1.5: Aggregate related values have been added to
    #              NotificationActionField enum
    # Version 1.6: ADD_FIX_IP replaced with INTERFACE_ATTACH in
    #              NotificationActionField enum
    # Version 1.7: REMOVE_FIXED_IP replaced with INTERFACE_DETACH in
    #              NotificationActionField enum
    # Version 1.8: IMPORT value is added to NotificationActionField enum
    # Version 1.9: ADD_MEMBER value is added to NotificationActionField enum
    # Version 1.10: UPDATE_METADATA value is added to the
    #               NotificationActionField enum
    # Version 1.11: LOCK is added to NotificationActionField enum
    # Version 1.12: UNLOCK is added to NotificationActionField enum
    # Version 1.13: REBUILD_SCHEDULED value is added to the
    #               NotificationActionField enum
    # Version 1.14: UPDATE_PROP value is added to the NotificationActionField
    #               enum
    # Version 1.15: LIVE_MIGRATION_FORCE_COMPLETE is added to the
    #               NotificationActionField enum
    # Version 1.16: CONNECT is added to NotificationActionField enum
    # Version 1.17: USAGE is added to NotificationActionField enum
    # Version 1.18: ComputeTask related values have been added to
    #               NotificationActionField enum
    # Version 1.19: SELECT_DESTINATIONS is added to the NotificationActionField
    #               enum
    # Version 1.20: IMAGE_CACHE is added to the NotificationActionField enum
    # Version 1.21: PROGRESS added to NotificationPhase enum
    VERSION = '1.21'

    fields = {
        'object': fields.StringField(nullable=False),
        'action': fields.NotificationActionField(nullable=False),
        'phase': fields.NotificationPhaseField(nullable=True),
    }

    def __init__(self, object, action, phase=None):
        super(EventType, self).__init__()
        self.object = object
        self.action = action
        self.phase = phase

    def to_notification_event_type_field(self):
        """Serialize the object to the wire format."""
        s = '%s.%s' % (self.object, self.action)
        if self.phase:
            s += '.%s' % self.phase
        return s
Exemplo n.º 4
0
class EventType(base.NovaObject):
    # Version 1.0: Initial version
    VERSION = '1.0'

    fields = {
        'object': fields.StringField(nullable=False),
        'action': fields.NotificationActionField(nullable=False),
        'phase': fields.NotificationPhaseField(nullable=True),
    }

    def to_notification_event_type_field(self):
        """Serialize the object to the wire format."""
        s = '%s.%s' % (self.object, self.action)
        if self.obj_attr_is_set('phase'):
            s += '.%s' % self.phase
        return s
Exemplo n.º 5
0
class EventType(NotificationObject):
    # Version 1.0: Initial version
    # Version 1.1: New valid actions values are added to the
    #              NotificationActionField enum
    # Version 1.2: DELETE value is added to the NotificationActionField enum
    # Version 1.3: Set of new values are added to NotificationActionField enum
    VERSION = '1.3'

    fields = {
        'object': fields.StringField(nullable=False),
        'action': fields.NotificationActionField(nullable=False),
        'phase': fields.NotificationPhaseField(nullable=True),
    }

    def to_notification_event_type_field(self):
        """Serialize the object to the wire format."""
        s = '%s.%s' % (self.object, self.action)
        if self.obj_attr_is_set('phase'):
            s += '.%s' % self.phase
        return s