Statistics
| Branch: | Tag: | Revision:

root / snf-cyclades-app / synnefo / db / migrations / 0097_userid_to_subnets.py @ bdedfd9d

History | View | Annotate | Download (19.2 kB)

1
# -*- coding: utf-8 -*-
2
import datetime
3
from south.db import db
4
from south.v2 import DataMigration
5
from django.db import models
6

    
7
class Migration(DataMigration):
8

    
9
    def forwards(self, orm):
10
        "Write your forwards methods here."
11
        # Note: Remember to use orm['appname.ModelName'] rather than "from appname.models..."
12
        for network in orm.Network.objects.all():
13
            network.subnets.update(userid=network.userid,
14
                                   public=network.public)
15

    
16
    def backwards(self, orm):
17
        "Write your backwards methods here."
18
        pass
19

    
20
    models = {
21
        'db.backend': {
22
            'Meta': {'ordering': "['clustername']", 'object_name': 'Backend'},
23
            'clustername': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
24
            'ctotal': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
25
            'dfree': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
26
            'disk_templates': ('synnefo.db.fields.SeparatedValuesField', [], {'null': 'True'}),
27
            'drained': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
28
            'dtotal': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
29
            'hash': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
30
            'hypervisor': ('django.db.models.fields.CharField', [], {'default': "'kvm'", 'max_length': '32'}),
31
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
32
            'index': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'unique': 'True'}),
33
            'mfree': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
34
            'mtotal': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
35
            'offline': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
36
            'password_hash': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
37
            'pinst_cnt': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
38
            'port': ('django.db.models.fields.PositiveIntegerField', [], {'default': '5080'}),
39
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
40
            'username': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'})
41
        },
42
        'db.backendnetwork': {
43
            'Meta': {'unique_together': "(('network', 'backend'),)", 'object_name': 'BackendNetwork'},
44
            'backend': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'networks'", 'on_delete': 'models.PROTECT', 'to': "orm['db.Backend']"}),
45
            'backendjobid': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
46
            'backendjobstatus': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True'}),
47
            'backendlogmsg': ('django.db.models.fields.TextField', [], {'null': 'True'}),
48
            'backendopcode': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True'}),
49
            'backendtime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1, 1, 1, 0, 0)'}),
50
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
51
            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
52
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
53
            'mac_prefix': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
54
            'network': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'backend_networks'", 'on_delete': 'models.PROTECT', 'to': "orm['db.Network']"}),
55
            'operstate': ('django.db.models.fields.CharField', [], {'default': "'PENDING'", 'max_length': '30'}),
56
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
57
        },
58
        'db.bridgepooltable': {
59
            'Meta': {'object_name': 'BridgePoolTable'},
60
            'available_map': ('django.db.models.fields.TextField', [], {'default': "''"}),
61
            'base': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
62
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
63
            'offset': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
64
            'reserved_map': ('django.db.models.fields.TextField', [], {'default': "''"}),
65
            'size': ('django.db.models.fields.IntegerField', [], {})
66
        },
67
        'db.flavor': {
68
            'Meta': {'unique_together': "(('cpu', 'ram', 'disk', 'disk_template'),)", 'object_name': 'Flavor'},
69
            'cpu': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
70
            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
71
            'disk': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
72
            'disk_template': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
73
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
74
            'ram': ('django.db.models.fields.IntegerField', [], {'default': '0'})
75
        },
76
        'db.ipaddress': {
77
            'Meta': {'unique_together': "(('network', 'address', 'deleted'),)", 'object_name': 'IPAddress'},
78
            'address': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
79
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
80
            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
81
            'floating_ip': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
82
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
83
            'ipversion': ('django.db.models.fields.IntegerField', [], {}),
84
            'network': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ips'", 'on_delete': 'models.PROTECT', 'to': "orm['db.Network']"}),
85
            'nic': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ips'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['db.NetworkInterface']"}),
86
            'serial': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ips'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['db.QuotaHolderSerial']"}),
87
            'subnet': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ips'", 'on_delete': 'models.PROTECT', 'to': "orm['db.Subnet']"}),
88
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
89
            'userid': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'})
90
        },
91
        'db.ipaddresslog': {
92
            'Meta': {'object_name': 'IPAddressLog'},
93
            'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
94
            'address': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_index': 'True'}),
95
            'allocated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
96
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
97
            'network_id': ('django.db.models.fields.IntegerField', [], {}),
98
            'released_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
99
            'server_id': ('django.db.models.fields.IntegerField', [], {})
100
        },
101
        'db.ippooltable': {
102
            'Meta': {'object_name': 'IPPoolTable'},
103
            'available_map': ('django.db.models.fields.TextField', [], {'default': "''"}),
104
            'base': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
105
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
106
            'offset': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
107
            'reserved_map': ('django.db.models.fields.TextField', [], {'default': "''"}),
108
            'size': ('django.db.models.fields.IntegerField', [], {}),
109
            'subnet': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ip_pools'", 'null': 'True', 'on_delete': 'models.PROTECT', 'to': "orm['db.Subnet']"})
110
        },
111
        'db.macprefixpooltable': {
112
            'Meta': {'object_name': 'MacPrefixPoolTable'},
113
            'available_map': ('django.db.models.fields.TextField', [], {'default': "''"}),
114
            'base': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
115
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
116
            'offset': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
117
            'reserved_map': ('django.db.models.fields.TextField', [], {'default': "''"}),
118
            'size': ('django.db.models.fields.IntegerField', [], {})
119
        },
120
        'db.network': {
121
            'Meta': {'object_name': 'Network'},
122
            'action': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '32', 'null': 'True'}),
123
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
124
            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
125
            'drained': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
126
            'external_router': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
127
            'flavor': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
128
            'floating_ip_pool': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
129
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
130
            'link': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
131
            'mac_prefix': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
132
            'machines': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['db.VirtualMachine']", 'through': "orm['db.NetworkInterface']", 'symmetrical': 'False'}),
133
            'mode': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True'}),
134
            'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
135
            'public': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
136
            'serial': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'network'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['db.QuotaHolderSerial']"}),
137
            'state': ('django.db.models.fields.CharField', [], {'default': "'PENDING'", 'max_length': '32'}),
138
            'tags': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}),
139
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
140
            'userid': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'db_index': 'True'})
141
        },
142
        'db.networkinterface': {
143
            'Meta': {'object_name': 'NetworkInterface'},
144
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
145
            'device_owner': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}),
146
            'firewall_profile': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True'}),
147
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
148
            'index': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
149
            'mac': ('django.db.models.fields.CharField', [], {'max_length': '32', 'unique': 'True', 'null': 'True'}),
150
            'machine': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'nics'", 'null': 'True', 'on_delete': 'models.PROTECT', 'to': "orm['db.VirtualMachine']"}),
151
            'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128', 'null': 'True'}),
152
            'network': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'nics'", 'on_delete': 'models.PROTECT', 'to': "orm['db.Network']"}),
153
            'security_groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['db.SecurityGroup']", 'null': 'True', 'symmetrical': 'False'}),
154
            'state': ('django.db.models.fields.CharField', [], {'default': "'ACTIVE'", 'max_length': '32'}),
155
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
156
            'userid': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'})
157
        },
158
        'db.quotaholderserial': {
159
            'Meta': {'ordering': "['serial']", 'object_name': 'QuotaHolderSerial'},
160
            'accept': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
161
            'pending': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}),
162
            'resolved': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
163
            'serial': ('django.db.models.fields.BigIntegerField', [], {'primary_key': 'True', 'db_index': 'True'})
164
        },
165
        'db.securitygroup': {
166
            'Meta': {'object_name': 'SecurityGroup'},
167
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
168
            'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
169
        },
170
        'db.subnet': {
171
            'Meta': {'object_name': 'Subnet'},
172
            'cidr': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
173
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
174
            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
175
            'dhcp': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
176
            'dns_nameservers': ('synnefo.db.fields.SeparatedValuesField', [], {'null': 'True'}),
177
            'gateway': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
178
            'host_routes': ('synnefo.db.fields.SeparatedValuesField', [], {'null': 'True'}),
179
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
180
            'ipversion': ('django.db.models.fields.IntegerField', [], {'default': '4'}),
181
            'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128', 'null': 'True'}),
182
            'network': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subnets'", 'on_delete': 'models.PROTECT', 'to': "orm['db.Network']"}),
183
            'public': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
184
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
185
            'userid': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'db_index': 'True'})
186
        },
187
        'db.virtualmachine': {
188
            'Meta': {'object_name': 'VirtualMachine'},
189
            'action': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '30', 'null': 'True'}),
190
            'backend': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'virtual_machines'", 'null': 'True', 'on_delete': 'models.PROTECT', 'to': "orm['db.Backend']"}),
191
            'backend_hash': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}),
192
            'backendjobid': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
193
            'backendjobstatus': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True'}),
194
            'backendlogmsg': ('django.db.models.fields.TextField', [], {'null': 'True'}),
195
            'backendopcode': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True'}),
196
            'backendtime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1, 1, 1, 0, 0)'}),
197
            'buildpercentage': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
198
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
199
            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
200
            'flavor': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['db.Flavor']", 'on_delete': 'models.PROTECT'}),
201
            'hostid': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
202
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
203
            'imageid': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
204
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
205
            'operstate': ('django.db.models.fields.CharField', [], {'default': "'BUILD'", 'max_length': '30'}),
206
            'serial': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'virtual_machine'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['db.QuotaHolderSerial']"}),
207
            'suspended': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
208
            'task': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
209
            'task_job_id': ('django.db.models.fields.BigIntegerField', [], {'null': 'True'}),
210
            'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
211
            'userid': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_index': 'True'})
212
        },
213
        'db.virtualmachinediagnostic': {
214
            'Meta': {'ordering': "['-created']", 'object_name': 'VirtualMachineDiagnostic'},
215
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
216
            'details': ('django.db.models.fields.TextField', [], {'null': 'True'}),
217
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
218
            'level': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
219
            'machine': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'diagnostics'", 'to': "orm['db.VirtualMachine']"}),
220
            'message': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
221
            'source': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
222
            'source_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'})
223
        },
224
        'db.virtualmachinemetadata': {
225
            'Meta': {'unique_together': "(('meta_key', 'vm'),)", 'object_name': 'VirtualMachineMetadata'},
226
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
227
            'meta_key': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
228
            'meta_value': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
229
            'vm': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'metadata'", 'to': "orm['db.VirtualMachine']"})
230
        }
231
    }
232

    
233
    complete_apps = ['db']
234
    symmetrical = True