Removed image_type from GenericRawData
Added message_id to GenericRawdata Regenerated migration
This commit is contained in:
parent
755e706107
commit
25baf82328
@ -48,6 +48,24 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal(u'stacktach', ['ImageUsage'])
|
||||
|
||||
# Adding model 'GenericRawData'
|
||||
db.create_table(u'stacktach_genericrawdata', (
|
||||
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
('deployment', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['stacktach.Deployment'])),
|
||||
('tenant', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=50, null=True, blank=True)),
|
||||
('json', self.gf('django.db.models.fields.TextField')()),
|
||||
('routing_key', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=50, null=True, blank=True)),
|
||||
('when', self.gf('django.db.models.fields.DecimalField')(max_digits=20, decimal_places=6, db_index=True)),
|
||||
('publisher', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=100, null=True, blank=True)),
|
||||
('event', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=50, null=True, blank=True)),
|
||||
('service', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=50, null=True, blank=True)),
|
||||
('host', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=100, null=True, blank=True)),
|
||||
('instance', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=50, null=True, blank=True)),
|
||||
('request_id', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=50, null=True, blank=True)),
|
||||
('message_id', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=50, null=True, blank=True)),
|
||||
))
|
||||
db.send_create_signal(u'stacktach', ['GenericRawData'])
|
||||
|
||||
# Adding model 'ImageExists'
|
||||
db.create_table(u'stacktach_imageexists', (
|
||||
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
@ -67,24 +85,6 @@ class Migration(SchemaMigration):
|
||||
))
|
||||
db.send_create_signal(u'stacktach', ['ImageExists'])
|
||||
|
||||
# Adding model 'GenericRawData'
|
||||
db.create_table(u'stacktach_genericrawdata', (
|
||||
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||
('deployment', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['stacktach.Deployment'])),
|
||||
('tenant', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=50, null=True, blank=True)),
|
||||
('json', self.gf('django.db.models.fields.TextField')()),
|
||||
('routing_key', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=50, null=True, blank=True)),
|
||||
('image_type', self.gf('django.db.models.fields.IntegerField')(default=0, null=True, db_index=True)),
|
||||
('when', self.gf('django.db.models.fields.DecimalField')(max_digits=20, decimal_places=6, db_index=True)),
|
||||
('publisher', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=100, null=True, blank=True)),
|
||||
('event', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=50, null=True, blank=True)),
|
||||
('service', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=50, null=True, blank=True)),
|
||||
('host', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=100, null=True, blank=True)),
|
||||
('instance', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=50, null=True, blank=True)),
|
||||
('request_id', self.gf('django.db.models.fields.CharField')(db_index=True, max_length=50, null=True, blank=True)),
|
||||
))
|
||||
db.send_create_signal(u'stacktach', ['GenericRawData'])
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting model 'ImageDeletes'
|
||||
@ -96,12 +96,12 @@ class Migration(SchemaMigration):
|
||||
# Deleting model 'ImageUsage'
|
||||
db.delete_table(u'stacktach_imageusage')
|
||||
|
||||
# Deleting model 'ImageExists'
|
||||
db.delete_table(u'stacktach_imageexists')
|
||||
|
||||
# Deleting model 'GenericRawData'
|
||||
db.delete_table(u'stacktach_genericrawdata')
|
||||
|
||||
# Deleting model 'ImageExists'
|
||||
db.delete_table(u'stacktach_imageexists')
|
||||
|
||||
|
||||
models = {
|
||||
u'stacktach.deployment': {
|
||||
@ -115,9 +115,9 @@ class Migration(SchemaMigration):
|
||||
'event': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}),
|
||||
'host': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '100', 'null': 'True', 'blank': 'True'}),
|
||||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'image_type': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True', 'db_index': 'True'}),
|
||||
'instance': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}),
|
||||
'json': ('django.db.models.fields.TextField', [], {}),
|
||||
'message_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}),
|
||||
'publisher': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '100', 'null': 'True', 'blank': 'True'}),
|
||||
'request_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}),
|
||||
'routing_key': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}),
|
||||
@ -213,9 +213,14 @@ class Migration(SchemaMigration):
|
||||
'instance': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}),
|
||||
'instance_type_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}),
|
||||
'launched_at': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '20', 'decimal_places': '6', 'db_index': 'True'}),
|
||||
'os_architecture': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'os_distro': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'os_version': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'rax_options': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
|
||||
'row_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||
'row_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||
'source': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '150', 'null': 'True', 'blank': 'True'})
|
||||
'source': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '150', 'null': 'True', 'blank': 'True'}),
|
||||
'tenant': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'})
|
||||
},
|
||||
u'stacktach.instanceusage': {
|
||||
'Meta': {'object_name': 'InstanceUsage'},
|
@ -1,3 +1,18 @@
|
||||
# Copyright 2012 - Dark Secret Software Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django import forms
|
||||
from django.db import models
|
||||
|
||||
@ -16,7 +31,6 @@ class GenericRawData(models.Model):
|
||||
json = models.TextField()
|
||||
routing_key = models.CharField(max_length=50, null=True,
|
||||
blank=True, db_index=True)
|
||||
image_type = models.IntegerField(null=True, default=0, db_index=True)
|
||||
when = models.DecimalField(max_digits=20, decimal_places=6,
|
||||
db_index=True)
|
||||
publisher = models.CharField(max_length=100, null=True,
|
||||
@ -31,6 +45,8 @@ class GenericRawData(models.Model):
|
||||
blank=True, db_index=True)
|
||||
request_id = models.CharField(max_length=50, null=True,
|
||||
blank=True, db_index=True)
|
||||
message_id = models.CharField(max_length=50, null=True,
|
||||
blank=True, db_index=True)
|
||||
|
||||
@staticmethod
|
||||
def get_name():
|
||||
|
@ -72,18 +72,23 @@ class Notification(object):
|
||||
instance = self.payload.get('instance', {}).get('uuid')
|
||||
return instance
|
||||
|
||||
@property
|
||||
def message_id(self):
|
||||
return self.body.get('message_id', None)
|
||||
|
||||
def save(self):
|
||||
return db.create_generic_rawdata(deployment=self.deployment,
|
||||
routing_key=self.routing_key,
|
||||
tenant=self.tenant,
|
||||
json=self.json,
|
||||
when=self.when,
|
||||
publisher=self.publisher,
|
||||
event=self.event,
|
||||
service=self.service,
|
||||
host=self.host,
|
||||
instance=self.instance,
|
||||
request_id=self.request_id)
|
||||
routing_key=self.routing_key,
|
||||
tenant=self.tenant,
|
||||
json=self.json,
|
||||
when=self.when,
|
||||
publisher=self.publisher,
|
||||
event=self.event,
|
||||
service=self.service,
|
||||
host=self.host,
|
||||
instance=self.instance,
|
||||
request_id=self.request_id,
|
||||
message_id=self.message_id)
|
||||
|
||||
|
||||
class GlanceNotification(Notification):
|
||||
@ -179,6 +184,7 @@ class GlanceNotification(Notification):
|
||||
}
|
||||
db.create_image_delete(**values)
|
||||
|
||||
|
||||
class NovaNotification(Notification):
|
||||
def __init__(self, body, deployment, routing_key, json):
|
||||
super(NovaNotification, self).__init__(body, deployment, routing_key,
|
||||
@ -203,8 +209,6 @@ class NovaNotification(Notification):
|
||||
'audit_period_beginning', None)
|
||||
self.audit_period_ending = self.payload.get(
|
||||
'audit_period_ending', None)
|
||||
self.message = self.payload.get('message', None)
|
||||
self.message_id = self.body.get('message_id', None)
|
||||
|
||||
@property
|
||||
def host(self):
|
||||
|
@ -142,13 +142,13 @@ class GenericRawDataTestCase(TransactionTestCase):
|
||||
'tenant': '1234567',
|
||||
'json': '{}',
|
||||
'routing_key': 'monitor.info',
|
||||
'image_type': 1,
|
||||
'publisher': 'publisher',
|
||||
'event': 'event',
|
||||
'service': 'service',
|
||||
'host': 'host',
|
||||
'instance': '1234-5678-9012-3456',
|
||||
'request_id': '1234'}
|
||||
'request_id': '1234',
|
||||
'message_id': 'message_id'}
|
||||
|
||||
db.create_generic_rawdata(**kwargs)
|
||||
rawdata = GenericRawData.objects.all()[0]
|
||||
|
@ -349,7 +349,7 @@ def post_process_glancerawdata(raw, notification):
|
||||
aggregate_glance_usage(raw, notification)
|
||||
|
||||
|
||||
def post_process_genericrawdata(raw, body, notification):
|
||||
def post_process_genericrawdata(raw, notification):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -35,6 +35,7 @@ from tests.unit.utils import DUMMY_TIME
|
||||
from tests.unit.utils import TIMESTAMP_1
|
||||
from tests.unit.utils import TENANT_ID_1
|
||||
from tests.unit.utils import INSTANCE_ID_1
|
||||
from tests.unit.utils import MESSAGE_ID_1
|
||||
|
||||
|
||||
class NovaNotificationTestCase(unittest.TestCase):
|
||||
@ -422,7 +423,6 @@ class GlanceNotificationTestCase(unittest.TestCase):
|
||||
self.mox.VerifyAll()
|
||||
|
||||
|
||||
|
||||
class NotificationTestCase(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.mox = mox.Mox()
|
||||
@ -437,14 +437,12 @@ class NotificationTestCase(unittest.TestCase):
|
||||
'_context_project_id': TENANT_ID_1,
|
||||
"timestamp": TIMESTAMP_1,
|
||||
"publisher_id": "glance-api01-r2961.global.preprod-ord.ohthree.com",
|
||||
"message_id": MESSAGE_ID_1,
|
||||
"payload": {
|
||||
'instance_id': INSTANCE_ID_1,
|
||||
"status": "saving",
|
||||
"container_format": "ovf",
|
||||
"properties": {
|
||||
"image_type": "snapshot",
|
||||
},
|
||||
"tenant": "5877054",
|
||||
"tenant": "5877054"
|
||||
}
|
||||
}
|
||||
deployment = "1"
|
||||
@ -463,7 +461,8 @@ class NotificationTestCase(unittest.TestCase):
|
||||
service="glance-api01-r2961",
|
||||
host="global.preprod-ord.ohthree.com",
|
||||
instance=INSTANCE_ID_1,
|
||||
request_id=REQUEST_ID_1).AndReturn(raw)
|
||||
request_id=REQUEST_ID_1,
|
||||
message_id=MESSAGE_ID_1).AndReturn(raw)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user