1 # -*- coding: utf-8 -*-
3 from itertools
import chain
5 from south
.db
import db
6 from south
.v2
import DataMigration
7 from django
.db
import models
10 class Migration(DataMigration
):
12 def forwards(self
, orm
):
13 jobs
= orm
['ganeti_web.Job'].objects
.filter(serialized_info__isnull
=True)
14 vms
= orm
['ganeti_web.VirtualMachine'].objects
.filter(serialized_info__isnull
=True)
15 nodes
= orm
['ganeti_web.Node'].objects
.filter(serialized_info__isnull
=True)
16 clusters
= orm
['ganeti_web.Cluster'].objects
.filter(serialized_info__isnull
=True)
18 # Convert all NULL values to empty string ""
19 for obj
in chain([jobs
, vms
, nodes
, clusters
]):
20 obj
.update(serialized_info
='')
22 def backwards(self
, orm
):
23 raise RuntimeError("This migration is not backwards compatible")
27 'Meta': {'object_name': 'Group'},
28 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
29 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
30 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
33 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
34 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
35 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
36 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
37 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
40 'Meta': {'object_name': 'User'},
41 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
42 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
43 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
44 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
45 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
46 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
47 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
48 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
49 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
50 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
51 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
52 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
53 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
55 'contenttypes.contenttype': {
56 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
57 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
58 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
59 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
60 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
62 'ganeti_web.cluster': {
63 'Meta': {'ordering': "['hostname', 'description']", 'object_name': 'Cluster'},
64 'cached': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
65 'description': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
66 'disk': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
67 'hash': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
68 'hostname': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
69 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
70 'ignore_cache': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
71 'last_job': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'cluster_last_job'", 'null': 'True', 'to': "orm['ganeti_web.Job']"}),
72 'mtime': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
73 'password': ('ganeti_web.fields.PatchedEncryptedCharField', [], {'default': "''", 'max_length': '293', 'cipher': "'AES'", 'blank': 'True'}),
74 'port': ('django.db.models.fields.PositiveIntegerField', [], {'default': '5080'}),
75 'ram': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
76 'serialized_info': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True'}),
77 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}),
78 'username': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
79 'virtual_cpus': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
81 'ganeti_web.cluster_perms': {
82 'Meta': {'object_name': 'Cluster_Perms'},
83 'admin': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
84 'create_vm': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
85 'export': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
86 'group': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'Cluster_gperms'", 'null': 'True', 'to': "orm['auth.Group']"}),
87 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
88 'migrate': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
89 'obj': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'operms'", 'to': "orm['ganeti_web.Cluster']"}),
90 'replace_disks': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
91 'tags': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
92 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'Cluster_uperms'", 'null': 'True', 'to': "orm['auth.User']"})
94 'ganeti_web.clusteruser': {
95 'Meta': {'object_name': 'ClusterUser'},
96 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
97 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
98 'real_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']", 'null': 'True'})
100 'ganeti_web.ganetierror': {
101 'Meta': {'ordering': "('-timestamp', 'code', 'msg')", 'object_name': 'GanetiError'},
102 'cleared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
103 'cluster': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ganeti_web.Cluster']"}),
104 'code': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
105 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
106 'msg': ('django.db.models.fields.TextField', [], {}),
107 'obj_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
108 'obj_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ganeti_errors'", 'to': "orm['contenttypes.ContentType']"}),
109 'timestamp': ('django.db.models.fields.DateTimeField', [], {})
112 'Meta': {'object_name': 'Job'},
113 'cached': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
114 'cluster': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'jobs'", 'to': "orm['ganeti_web.Cluster']"}),
115 'cluster_hash': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
116 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
117 'finished': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
118 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
119 'ignore_cache': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
120 'job_id': ('django.db.models.fields.IntegerField', [], {}),
121 'mtime': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
122 'object_id': ('django.db.models.fields.IntegerField', [], {}),
123 'op': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
124 'serialized_info': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True'}),
125 'status': ('django.db.models.fields.CharField', [], {'max_length': '10'})
128 'Meta': {'object_name': 'Node'},
129 'cached': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
130 'cluster': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'nodes'", 'to': "orm['ganeti_web.Cluster']"}),
131 'cluster_hash': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
132 'cpus': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
133 'disk_free': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
134 'disk_total': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
135 'hostname': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
136 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
137 'ignore_cache': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
138 'last_job': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ganeti_web.Job']", 'null': 'True'}),
139 'mtime': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
140 'offline': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
141 'ram_free': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
142 'ram_total': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
143 'role': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
144 'serialized_info': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True'})
146 'ganeti_web.organization': {
147 'Meta': {'object_name': 'Organization', '_ormbases': ['ganeti_web.ClusterUser']},
148 'clusteruser_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['ganeti_web.ClusterUser']", 'unique': 'True', 'primary_key': 'True'}),
149 'group': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'organization'", 'unique': 'True', 'to': "orm['auth.Group']"})
151 'ganeti_web.profile': {
152 'Meta': {'object_name': 'Profile', '_ormbases': ['ganeti_web.ClusterUser']},
153 'clusteruser_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['ganeti_web.ClusterUser']", 'unique': 'True', 'primary_key': 'True'}),
154 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'})
156 'ganeti_web.quota': {
157 'Meta': {'object_name': 'Quota'},
158 'cluster': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'quotas'", 'to': "orm['ganeti_web.Cluster']"}),
159 'disk': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True'}),
160 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
161 'ram': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True'}),
162 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'quotas'", 'to': "orm['ganeti_web.ClusterUser']"}),
163 'virtual_cpus': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True'})
165 'ganeti_web.sshkey': {
166 'Meta': {'object_name': 'SSHKey'},
167 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
168 'key': ('django.db.models.fields.TextField', [], {}),
169 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ssh_keys'", 'to': "orm['auth.User']"})
171 'ganeti_web.testmodel': {
172 'Meta': {'object_name': 'TestModel'},
173 'cached': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
174 'cluster': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ganeti_web.Cluster']"}),
175 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
176 'ignore_cache': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
177 'mtime': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
178 'serialized_info': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True'})
180 'ganeti_web.virtualmachine': {
181 'Meta': {'ordering': "['hostname']", 'unique_together': "(('cluster', 'hostname'),)", 'object_name': 'VirtualMachine'},
182 'cached': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
183 'cluster': ('django.db.models.fields.related.ForeignKey', [], {'default': '0', 'related_name': "'virtual_machines'", 'to': "orm['ganeti_web.Cluster']"}),
184 'cluster_hash': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
185 'disk_size': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
186 'hostname': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
187 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
188 'ignore_cache': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
189 'last_job': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ganeti_web.Job']", 'null': 'True'}),
190 'minram': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
191 'mtime': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
192 'operating_system': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
193 'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'virtual_machines'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ganeti_web.ClusterUser']"}),
194 'pending_delete': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
195 'primary_node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'primary_vms'", 'null': 'True', 'to': "orm['ganeti_web.Node']"}),
196 'ram': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
197 'secondary_node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'secondary_vms'", 'null': 'True', 'to': "orm['ganeti_web.Node']"}),
198 'serialized_info': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True'}),
199 'status': ('django.db.models.fields.CharField', [], {'max_length': '14'}),
200 'template': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'null': 'True', 'to': "orm['ganeti_web.VirtualMachineTemplate']"}),
201 'virtual_cpus': ('django.db.models.fields.IntegerField', [], {'default': '-1'})
203 'ganeti_web.virtualmachine_perms': {
204 'Meta': {'object_name': 'VirtualMachine_Perms'},
205 'admin': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
206 'group': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'VirtualMachine_gperms'", 'null': 'True', 'to': "orm['auth.Group']"}),
207 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
208 'modify': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
209 'obj': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'operms'", 'to': "orm['ganeti_web.VirtualMachine']"}),
210 'power': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
211 'remove': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
212 'tags': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
213 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'VirtualMachine_uperms'", 'null': 'True', 'to': "orm['auth.User']"})
215 'ganeti_web.virtualmachinetemplate': {
216 'Meta': {'unique_together': "(('cluster', 'template_name'),)", 'object_name': 'VirtualMachineTemplate'},
217 'boot_order': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
218 'cdrom2_image_path': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
219 'cdrom_image_path': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
220 'cluster': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ganeti_web.Cluster']", 'null': 'True'}),
221 'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
222 'disk_template': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
223 'disk_type': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
224 'disks': ('django_fields.fields.PickleField', [], {'null': 'True', 'blank': 'True'}),
225 'iallocator': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
226 'iallocator_hostname': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
227 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
228 'ip_check': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
229 'kernel_path': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
230 'memory': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
231 'minmem': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
232 'name_check': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
233 'nic_type': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
234 'nics': ('django_fields.fields.PickleField', [], {'null': 'True', 'blank': 'True'}),
235 'no_install': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
236 'os': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
237 'pnode': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
238 'root_path': ('django.db.models.fields.CharField', [], {'default': "'/'", 'max_length': '255', 'null': 'True', 'blank': 'True'}),
239 'serial_console': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
240 'snode': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
241 'start': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
242 'template_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
243 'temporary': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
244 'vcpus': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
248 complete_apps
= ['ganeti_web']