Scott Baker | 4815f92 | 2014-09-15 16:05:39 -0700 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | from __future__ import unicode_literals |
| 3 | |
| 4 | from django.db import models, migrations |
| 5 | import datetime |
| 6 | import syndicate_storage.models |
| 7 | from django.conf import settings |
| 8 | |
| 9 | |
| 10 | class Migration(migrations.Migration): |
| 11 | |
| 12 | dependencies = [ |
| 13 | ('core', '0002_omf_friendly_default_false'), |
| 14 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
| 15 | ] |
| 16 | |
| 17 | operations = [ |
| 18 | migrations.CreateModel( |
| 19 | name='SliceSecret', |
| 20 | fields=[ |
| 21 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
| 22 | ('secret', syndicate_storage.models.ObserverSecretValue(help_text=b"Shared secret between OpenCloud and this slice's Syndicate daemons.", blank=True)), |
| 23 | ('slice_id', models.ForeignKey(to='core.Slice')), |
| 24 | ], |
| 25 | options={ |
| 26 | }, |
| 27 | bases=(models.Model,), |
| 28 | ), |
| 29 | migrations.CreateModel( |
| 30 | name='SyndicatePrincipal', |
| 31 | fields=[ |
| 32 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
| 33 | ('created', models.DateTimeField(default=datetime.datetime.now, auto_now_add=True)), |
| 34 | ('updated', models.DateTimeField(default=datetime.datetime.now, auto_now=True)), |
| 35 | ('enacted', models.DateTimeField(default=None, null=True)), |
| 36 | ('backend_status', models.CharField(default=b'Provisioning in progress', max_length=140)), |
| 37 | ('deleted', models.BooleanField(default=False)), |
| 38 | ('principal_id', models.TextField(unique=True)), |
| 39 | ('public_key_pem', models.TextField()), |
| 40 | ('sealed_private_key', models.TextField()), |
| 41 | ], |
| 42 | options={ |
| 43 | }, |
| 44 | bases=(models.Model,), |
| 45 | ), |
| 46 | migrations.CreateModel( |
| 47 | name='SyndicateService', |
| 48 | fields=[ |
| 49 | ('service_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='core.Service')), |
| 50 | ], |
| 51 | options={ |
| 52 | 'verbose_name': 'Syndicate Service', |
| 53 | 'verbose_name_plural': 'Syndicate Service', |
| 54 | }, |
| 55 | bases=('core.service', models.Model), |
| 56 | ), |
| 57 | migrations.CreateModel( |
| 58 | name='Volume', |
| 59 | fields=[ |
| 60 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
| 61 | ('created', models.DateTimeField(default=datetime.datetime.now, auto_now_add=True)), |
| 62 | ('updated', models.DateTimeField(default=datetime.datetime.now, auto_now=True)), |
| 63 | ('enacted', models.DateTimeField(default=None, null=True)), |
| 64 | ('backend_status', models.CharField(default=b'Provisioning in progress', max_length=140)), |
| 65 | ('deleted', models.BooleanField(default=False)), |
| 66 | ('name', models.CharField(help_text=b'Human-readable, searchable name of the Volume', max_length=64)), |
| 67 | ('description', models.TextField(help_text=b'Human-readable description of what this Volume is used for.', max_length=130, null=True, blank=True)), |
| 68 | ('blocksize', models.PositiveIntegerField(help_text=b'Number of bytes per block.')), |
| 69 | ('private', models.BooleanField(default=True, help_text=b'Indicates if the Volume is visible to users other than the Volume Owner and Syndicate Administrators.')), |
| 70 | ('archive', models.BooleanField(default=False, help_text=b'Indicates if this Volume is read-only, and only an Aquisition Gateway owned by the Volume owner (or Syndicate admin) can write to it.')), |
| 71 | ('cap_read_data', models.BooleanField(default=True, help_text=b'VM can read Volume data')), |
| 72 | ('cap_write_data', models.BooleanField(default=True, help_text=b'VM can write Volume data')), |
| 73 | ('cap_host_data', models.BooleanField(default=True, help_text=b'VM can host Volume data')), |
| 74 | ('owner_id', models.ForeignKey(verbose_name=b'Owner', to=settings.AUTH_USER_MODEL)), |
| 75 | ], |
| 76 | options={ |
| 77 | }, |
| 78 | bases=(models.Model,), |
| 79 | ), |
| 80 | migrations.CreateModel( |
| 81 | name='VolumeAccessRight', |
| 82 | fields=[ |
| 83 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
| 84 | ('created', models.DateTimeField(default=datetime.datetime.now, auto_now_add=True)), |
| 85 | ('updated', models.DateTimeField(default=datetime.datetime.now, auto_now=True)), |
| 86 | ('enacted', models.DateTimeField(default=None, null=True)), |
| 87 | ('backend_status', models.CharField(default=b'Provisioning in progress', max_length=140)), |
| 88 | ('deleted', models.BooleanField(default=False)), |
| 89 | ('cap_read_data', models.BooleanField(default=True, help_text=b'VM can read Volume data')), |
| 90 | ('cap_write_data', models.BooleanField(default=True, help_text=b'VM can write Volume data')), |
| 91 | ('cap_host_data', models.BooleanField(default=True, help_text=b'VM can host Volume data')), |
| 92 | ('owner_id', models.ForeignKey(verbose_name=b'user', to=settings.AUTH_USER_MODEL)), |
| 93 | ('volume', models.ForeignKey(to='syndicate_storage.Volume')), |
| 94 | ], |
| 95 | options={ |
| 96 | }, |
| 97 | bases=(models.Model,), |
| 98 | ), |
| 99 | migrations.CreateModel( |
| 100 | name='VolumeSlice', |
| 101 | fields=[ |
| 102 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
| 103 | ('created', models.DateTimeField(default=datetime.datetime.now, auto_now_add=True)), |
| 104 | ('updated', models.DateTimeField(default=datetime.datetime.now, auto_now=True)), |
| 105 | ('enacted', models.DateTimeField(default=None, null=True)), |
| 106 | ('backend_status', models.CharField(default=b'Provisioning in progress', max_length=140)), |
| 107 | ('deleted', models.BooleanField(default=False)), |
| 108 | ('cap_read_data', models.BooleanField(default=True, help_text=b'VM can read Volume data')), |
| 109 | ('cap_write_data', models.BooleanField(default=True, help_text=b'VM can write Volume data')), |
| 110 | ('cap_host_data', models.BooleanField(default=True, help_text=b'VM can host Volume data')), |
| 111 | ('UG_portnum', models.PositiveIntegerField(help_text=b'User Gateway port. Any port above 1024 will work, but it must be available slice-wide.', verbose_name=b'UG port')), |
| 112 | ('RG_portnum', models.PositiveIntegerField(help_text=b'Replica Gateway port. Any port above 1024 will work, but it must be available slice-wide.', verbose_name=b'RG port')), |
| 113 | ('credentials_blob', models.TextField(help_text=b'Encrypted slice credentials, sealed with the slice secret.', null=True, blank=True)), |
| 114 | ('slice_id', models.ForeignKey(verbose_name=b'Slice', to='core.Slice')), |
| 115 | ('volume_id', models.ForeignKey(verbose_name=b'Volume', to='syndicate_storage.Volume')), |
| 116 | ], |
| 117 | options={ |
| 118 | }, |
| 119 | bases=(models.Model,), |
| 120 | ), |
| 121 | migrations.AddField( |
| 122 | model_name='volume', |
| 123 | name='slice_id', |
| 124 | field=models.ManyToManyField(to='core.Slice', through='syndicate_storage.VolumeSlice'), |
| 125 | preserve_default=True, |
| 126 | ), |
| 127 | ] |