# -*- coding: utf-8 -*-
# Generated by Django 1.11.24 on 2019-09-10 10:28
from __future__ import unicode_literals

import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import django_fsm
import model_utils.fields
import taggit.managers
import waldur_core.core.fields
import waldur_core.core.models
import waldur_core.core.validators
import waldur_core.logging.loggers
import waldur_core.structure.models
import waldur_openstack.openstack_tenant.models


class Migration(migrations.Migration):

    replaces = [(b'openstack_tenant', '0001_initial'), (b'openstack_tenant', '0002_service_properties'), (b'openstack_tenant', '0003_volume_and_snapshot'), (b'openstack_tenant', '0004_instance'), (b'openstack_tenant', '0005_resources_actions'), (b'openstack_tenant', '0006_resource_action_details'), (b'openstack_tenant', '0007_backup_backuprestoration'), (b'openstack_tenant', '0008_backup_schedule'), (b'openstack_tenant', '0009_tenant_service_verbose_name'), (b'openstack_tenant', '0010_rename_floating_ip_status'), (b'openstack_tenant', '0011_backupschedule_call_count'), (b'openstack_tenant', '0012_backupschedule_resource'), (b'openstack_tenant', '0013_init_backupschedule_spl'), (b'openstack_tenant', '0014_make_backupschedule_spl_non_nullable'), (b'openstack_tenant', '0015_snapshotrestoration'), (b'openstack_tenant', '0016_network_subnet_internalip'), (b'openstack_tenant', '0017_snapshot_schedule'), (b'openstack_tenant', '0018_remove_openstacktenantservice_name'), (b'openstack_tenant', '0019_migrate_to_single_external_ip'), (b'openstack_tenant', '0020_remove_external_ips'), (b'openstack_tenant', '0021_instance_subnets'), (b'openstack_tenant', '0022_floatingip_internal_ip'), (b'openstack_tenant', '0023_remove_instance_external_ip'), (b'openstack_tenant', '0024_add_backup_size'), (b'openstack_tenant', '0025_copy_certifications_from_existing_settings'), (b'openstack_tenant', '0026_remove_start_time'), (b'openstack_tenant', '0027_remove_duplicate_floating_ips'), (b'openstack_tenant', '0028_remove_duplicate_security_groups_networks_subnets'), (b'openstack_tenant', '0029_add_unique_constraint_for_properties'), (b'openstack_tenant', '0030_add_volume_image_name'), (b'openstack_tenant', '0031_unique_internal_ip'), (b'openstack_tenant', '0032_nullable_internal_ip_instance'), (b'openstack_tenant', '0033_unique_instance_backend_id'), (b'openstack_tenant', '0034_immutable_default_json'), (b'openstack_tenant', '0035_unique_floating_ip'), (b'openstack_tenant', '0036_instance_shared_ips'), (b'openstack_tenant', '0037_internal_ip_settings'), (b'openstack_tenant', '0038_internal_ip_settings_non_null'), (b'openstack_tenant', '0039_forbid_blank_backend_id'), (b'openstack_tenant', '0040_volume_type'), (b'openstack_tenant', '0041_volume_type_field'), (b'openstack_tenant', '0042_volume_availability_zone'), (b'openstack_tenant', '0043_field_availability_zone'), (b'openstack_tenant', '0044_instance_availability_zone'), (b'openstack_tenant', '0045_volumeavailabilityzone_available'), (b'openstack_tenant', '0046_instanceavailabilityzone_available')]

    initial = True

    dependencies = [
        ('structure', '0009_project_is_removed'),
        ('taggit', '0002_auto_20150616_2121'),
    ]

    operations = [
        migrations.CreateModel(
            name='Backup',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('description', models.CharField(blank=True, max_length=500, verbose_name='description')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('error_message', models.TextField(blank=True)),
                ('state', django_fsm.FSMIntegerField(choices=[(5, 'Creation Scheduled'), (6, 'Creating'), (1, 'Update Scheduled'), (2, 'Updating'), (7, 'Deletion Scheduled'), (8, 'Deleting'), (3, 'OK'), (4, 'Erred')], default=5)),
                ('backend_id', models.CharField(blank=True, max_length=255)),
                ('kept_until', models.DateTimeField(blank=True, help_text='Guaranteed time of backup retention. If null - keep forever.', null=True)),
                ('metadata', waldur_core.core.fields.JSONField(blank=True, help_text='Additional information about backup, can be used for backup restoration or deletion')),
            ],
            options={
                'abstract': False,
            },
            bases=(waldur_core.core.models.DescendantMixin, waldur_core.core.models.BackendModelMixin, waldur_core.structure.models.StructureLoggableMixin, models.Model),
        ),
        migrations.CreateModel(
            name='BackupRestoration',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('backup', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='restorations', to='openstack_tenant.Backup')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='BackupSchedule',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('description', models.CharField(blank=True, max_length=500, verbose_name='description')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('error_message', models.TextField(blank=True)),
                ('schedule', waldur_core.core.fields.CronScheduleField(max_length=15, validators=[waldur_core.core.validators.validate_cron_schedule, waldur_core.core.validators.MinCronValueValidator(1)])),
                ('next_trigger_at', models.DateTimeField(null=True)),
                ('timezone', models.CharField(default=django.utils.timezone.get_current_timezone_name, max_length=50)),
                ('is_active', models.BooleanField(default=False)),
                ('state', django_fsm.FSMIntegerField(choices=[(5, 'Creation Scheduled'), (6, 'Creating'), (1, 'Update Scheduled'), (2, 'Updating'), (7, 'Deletion Scheduled'), (8, 'Deleting'), (3, 'OK'), (4, 'Erred')], default=5)),
                ('backend_id', models.CharField(blank=True, max_length=255)),
                ('retention_time', models.PositiveIntegerField(help_text='Retention time in days, if 0 - resource will be kept forever')),
                ('maximal_number_of_resources', models.PositiveSmallIntegerField()),
                ('call_count', models.PositiveSmallIntegerField(default=0, help_text='How many times a resource schedule was called.')),
            ],
            options={
                'abstract': False,
            },
            bases=(waldur_core.core.models.DescendantMixin, waldur_core.core.models.BackendModelMixin, waldur_core.structure.models.StructureLoggableMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Flavor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('backend_id', models.CharField(db_index=True, max_length=255)),
                ('cores', models.PositiveSmallIntegerField(help_text='Number of cores in a VM')),
                ('ram', models.PositiveIntegerField(help_text='Memory size in MiB')),
                ('disk', models.PositiveIntegerField(help_text='Root disk size in MiB')),
                ('settings', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='structure.ServiceSettings')),
            ],
            bases=(waldur_core.logging.loggers.LoggableMixin, waldur_core.core.models.BackendModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='FloatingIP',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('backend_id', models.CharField(db_index=True, max_length=255)),
                ('address', models.GenericIPAddressField(default=None, null=True, protocol='IPv4')),
                ('runtime_state', models.CharField(max_length=30)),
                ('backend_network_id', models.CharField(editable=False, max_length=255)),
                ('is_booked', models.BooleanField(default=False, help_text='Marks if floating IP has been booked for provisioning.')),
            ],
            options={
                'verbose_name': 'Floating IP',
                'verbose_name_plural': 'Floating IPs',
            },
            bases=(waldur_core.core.models.BackendModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Image',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('backend_id', models.CharField(db_index=True, max_length=255)),
                ('min_disk', models.PositiveIntegerField(default=0, help_text='Minimum disk size in MiB')),
                ('min_ram', models.PositiveIntegerField(default=0, help_text='Minimum memory size in MiB')),
                ('settings', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='structure.ServiceSettings')),
            ],
            options={
                'abstract': False,
            },
            bases=(waldur_core.core.models.BackendModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Instance',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('description', models.CharField(blank=True, max_length=500, verbose_name='description')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('error_message', models.TextField(blank=True)),
                ('latitude', models.FloatField(blank=True, null=True)),
                ('longitude', models.FloatField(blank=True, null=True)),
                ('runtime_state', models.CharField(blank=True, max_length=150, verbose_name='runtime state')),
                ('state', django_fsm.FSMIntegerField(choices=[(5, 'Creation Scheduled'), (6, 'Creating'), (1, 'Update Scheduled'), (2, 'Updating'), (7, 'Deletion Scheduled'), (8, 'Deleting'), (3, 'OK'), (4, 'Erred')], default=5)),
                ('cores', models.PositiveSmallIntegerField(default=0, help_text='Number of cores in a VM')),
                ('ram', models.PositiveIntegerField(default=0, help_text='Memory size in MiB')),
                ('disk', models.PositiveIntegerField(default=0, help_text='Disk size in MiB')),
                ('min_ram', models.PositiveIntegerField(default=0, help_text='Minimum memory size in MiB')),
                ('min_disk', models.PositiveIntegerField(default=0, help_text='Minimum disk size in MiB')),
                ('image_name', models.CharField(blank=True, max_length=150)),
                ('key_name', models.CharField(blank=True, max_length=50)),
                ('key_fingerprint', models.CharField(blank=True, max_length=47)),
                ('user_data', models.TextField(blank=True, help_text='Additional data that will be added to instance on provisioning')),
                ('start_time', models.DateTimeField(blank=True, null=True)),
                ('backend_id', models.CharField(blank=True, max_length=255, null=True)),
                ('flavor_name', models.CharField(blank=True, max_length=255)),
                ('flavor_disk', models.PositiveIntegerField(default=0, help_text='Flavor disk size in MiB')),
                ('action', models.CharField(blank=True, max_length=50)),
                ('action_details', waldur_core.core.fields.JSONField(default=dict)),
            ],
            bases=(waldur_openstack.openstack_tenant.models.TenantQuotaMixin, waldur_core.core.models.DescendantMixin, waldur_core.core.models.BackendModelMixin, waldur_core.structure.models.StructureLoggableMixin, models.Model),
        ),
        migrations.CreateModel(
            name='InstanceAvailabilityZone',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('available', models.BooleanField(default=True)),
                ('settings', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='structure.ServiceSettings')),
            ],
            bases=(waldur_core.core.models.BackendModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='InternalIP',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('mac_address', models.CharField(blank=True, max_length=32)),
                ('ip4_address', models.GenericIPAddressField(blank=True, null=True, protocol=b'IPv4')),
                ('ip6_address', models.GenericIPAddressField(blank=True, null=True, protocol=b'IPv6')),
                ('backend_id', models.CharField(max_length=255, null=True)),
                ('instance', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='internal_ips_set', to='openstack_tenant.Instance')),
                ('settings', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='structure.ServiceSettings')),
            ],
            bases=(waldur_core.core.models.BackendModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Network',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.CharField(blank=True, max_length=500, verbose_name='description')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('backend_id', models.CharField(db_index=True, max_length=255)),
                ('is_external', models.BooleanField(default=False)),
                ('type', models.CharField(blank=True, max_length=50)),
                ('segmentation_id', models.IntegerField(null=True)),
                ('settings', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='structure.ServiceSettings')),
            ],
            bases=(waldur_core.core.models.BackendModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='OpenStackTenantService',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('available_for_all', models.BooleanField(default=False, help_text='Service will be automatically added to all customers projects if it is available for all')),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='structure.Customer', verbose_name='organization')),
            ],
            options={
                'verbose_name': 'OpenStackTenant provider',
                'verbose_name_plural': 'OpenStackTenant providers',
            },
            bases=(waldur_core.core.models.DescendantMixin, waldur_core.structure.models.StructureLoggableMixin, models.Model),
        ),
        migrations.CreateModel(
            name='OpenStackTenantServiceProjectLink',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='structure.Project')),
                ('service', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='openstack_tenant.OpenStackTenantService')),
            ],
            options={
                'abstract': False,
                'verbose_name': 'OpenStackTenant provider project link',
                'verbose_name_plural': 'OpenStackTenant provider project links',
            },
            bases=(waldur_core.core.models.DescendantMixin, waldur_core.logging.loggers.LoggableMixin, models.Model),
        ),
        migrations.CreateModel(
            name='SecurityGroup',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.CharField(blank=True, max_length=500, verbose_name='description')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('backend_id', models.CharField(db_index=True, max_length=255)),
                ('settings', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='structure.ServiceSettings')),
            ],
            bases=(waldur_core.core.models.BackendModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='SecurityGroupRule',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('protocol', models.CharField(blank=True, choices=[(b'tcp', b'tcp'), (b'udp', b'udp'), (b'icmp', b'icmp')], max_length=4)),
                ('from_port', models.IntegerField(null=True, validators=[django.core.validators.MaxValueValidator(65535)])),
                ('to_port', models.IntegerField(null=True, validators=[django.core.validators.MaxValueValidator(65535)])),
                ('cidr', models.CharField(blank=True, max_length=32)),
                ('backend_id', models.CharField(blank=True, max_length=128)),
                ('security_group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rules', to='openstack_tenant.SecurityGroup')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Snapshot',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('description', models.CharField(blank=True, max_length=500, verbose_name='description')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('error_message', models.TextField(blank=True)),
                ('runtime_state', models.CharField(blank=True, max_length=150, verbose_name='runtime state')),
                ('state', django_fsm.FSMIntegerField(choices=[(5, 'Creation Scheduled'), (6, 'Creating'), (1, 'Update Scheduled'), (2, 'Updating'), (7, 'Deletion Scheduled'), (8, 'Deleting'), (3, 'OK'), (4, 'Erred')], default=5)),
                ('size', models.PositiveIntegerField(help_text='Size in MiB')),
                ('backend_id', models.CharField(blank=True, max_length=255, null=True)),
                ('metadata', waldur_core.core.fields.JSONField(blank=True)),
                ('action', models.CharField(blank=True, max_length=50)),
                ('action_details', waldur_core.core.fields.JSONField(default=dict)),
                ('kept_until', models.DateTimeField(blank=True, help_text='Guaranteed time of snapshot retention. If null - keep forever.', null=True)),
                ('service_project_link', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='snapshots', to='openstack_tenant.OpenStackTenantServiceProjectLink')),
            ],
            bases=(waldur_openstack.openstack_tenant.models.TenantQuotaMixin, waldur_core.core.models.DescendantMixin, waldur_core.core.models.BackendModelMixin, waldur_core.structure.models.StructureLoggableMixin, models.Model),
        ),
        migrations.CreateModel(
            name='SnapshotRestoration',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('snapshot', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='restorations', to='openstack_tenant.Snapshot')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SnapshotSchedule',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('description', models.CharField(blank=True, max_length=500, verbose_name='description')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('error_message', models.TextField(blank=True)),
                ('schedule', waldur_core.core.fields.CronScheduleField(max_length=15, validators=[waldur_core.core.validators.validate_cron_schedule, waldur_core.core.validators.MinCronValueValidator(1)])),
                ('next_trigger_at', models.DateTimeField(null=True)),
                ('timezone', models.CharField(default=django.utils.timezone.get_current_timezone_name, max_length=50)),
                ('is_active', models.BooleanField(default=False)),
                ('state', django_fsm.FSMIntegerField(choices=[(5, 'Creation Scheduled'), (6, 'Creating'), (1, 'Update Scheduled'), (2, 'Updating'), (7, 'Deletion Scheduled'), (8, 'Deleting'), (3, 'OK'), (4, 'Erred')], default=5)),
                ('backend_id', models.CharField(blank=True, max_length=255)),
                ('retention_time', models.PositiveIntegerField(help_text='Retention time in days, if 0 - resource will be kept forever')),
                ('maximal_number_of_resources', models.PositiveSmallIntegerField()),
                ('call_count', models.PositiveSmallIntegerField(default=0, help_text='How many times a resource schedule was called.')),
                ('service_project_link', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='snapshot_schedules', to='openstack_tenant.OpenStackTenantServiceProjectLink')),
            ],
            options={
                'abstract': False,
            },
            bases=(waldur_core.core.models.DescendantMixin, waldur_core.core.models.BackendModelMixin, waldur_core.structure.models.StructureLoggableMixin, models.Model),
        ),
        migrations.CreateModel(
            name='SubNet',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.CharField(blank=True, max_length=500, verbose_name='description')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('backend_id', models.CharField(db_index=True, max_length=255)),
                ('cidr', models.CharField(blank=True, max_length=32)),
                ('gateway_ip', models.GenericIPAddressField(null=True, protocol='IPv4')),
                ('allocation_pools', waldur_core.core.fields.JSONField(default=dict)),
                ('ip_version', models.SmallIntegerField(default=4)),
                ('enable_dhcp', models.BooleanField(default=True)),
                ('dns_nameservers', waldur_core.core.fields.JSONField(default=list, help_text='List of DNS name servers associated with the subnet.')),
                ('network', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subnets', to='openstack_tenant.Network')),
                ('settings', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='structure.ServiceSettings')),
            ],
            options={
                'verbose_name': 'Subnet',
                'verbose_name_plural': 'Subnets',
            },
            bases=(waldur_core.core.models.BackendModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='Volume',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('description', models.CharField(blank=True, max_length=500, verbose_name='description')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('error_message', models.TextField(blank=True)),
                ('runtime_state', models.CharField(blank=True, max_length=150, verbose_name='runtime state')),
                ('state', django_fsm.FSMIntegerField(choices=[(5, 'Creation Scheduled'), (6, 'Creating'), (1, 'Update Scheduled'), (2, 'Updating'), (7, 'Deletion Scheduled'), (8, 'Deleting'), (3, 'OK'), (4, 'Erred')], default=5)),
                ('size', models.PositiveIntegerField(help_text='Size in MiB')),
                ('backend_id', models.CharField(blank=True, max_length=255, null=True)),
                ('device', models.CharField(blank=True, help_text='Name of volume as instance device e.g. /dev/vdb.', max_length=50, validators=[django.core.validators.RegexValidator('^/dev/[a-zA-Z0-9]+$', message='Device should match pattern "/dev/alphanumeric+"')])),
                ('bootable', models.BooleanField(default=False)),
                ('metadata', waldur_core.core.fields.JSONField(blank=True)),
                ('image_name', models.CharField(blank=True, max_length=150)),
                ('image_metadata', waldur_core.core.fields.JSONField(blank=True)),
                ('action', models.CharField(blank=True, max_length=50)),
                ('action_details', waldur_core.core.fields.JSONField(default=dict)),
            ],
            bases=(waldur_openstack.openstack_tenant.models.TenantQuotaMixin, waldur_core.core.models.DescendantMixin, waldur_core.core.models.BackendModelMixin, waldur_core.structure.models.StructureLoggableMixin, models.Model),
        ),
        migrations.CreateModel(
            name='VolumeAvailabilityZone',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('available', models.BooleanField(default=True)),
                ('settings', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='structure.ServiceSettings')),
            ],
            bases=(waldur_core.core.models.BackendModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name='VolumeType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.CharField(blank=True, max_length=500, verbose_name='description')),
                ('name', models.CharField(max_length=150, validators=[waldur_core.core.validators.validate_name], verbose_name='name')),
                ('uuid', waldur_core.core.fields.UUIDField()),
                ('backend_id', models.CharField(db_index=True, max_length=255)),
                ('settings', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='structure.ServiceSettings')),
            ],
            bases=(waldur_core.core.models.BackendModelMixin, models.Model),
        ),
        migrations.AddField(
            model_name='volume',
            name='availability_zone',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='openstack_tenant.VolumeAvailabilityZone'),
        ),
        migrations.AddField(
            model_name='volume',
            name='image',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='openstack_tenant.Image'),
        ),
        migrations.AddField(
            model_name='volume',
            name='instance',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='volumes', to='openstack_tenant.Instance'),
        ),
        migrations.AddField(
            model_name='volume',
            name='service_project_link',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='volumes', to='openstack_tenant.OpenStackTenantServiceProjectLink'),
        ),
        migrations.AddField(
            model_name='volume',
            name='source_snapshot',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='volumes', to='openstack_tenant.Snapshot'),
        ),
        migrations.AddField(
            model_name='volume',
            name='tags',
            field=taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'),
        ),
        migrations.AddField(
            model_name='volume',
            name='type',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='openstack_tenant.VolumeType'),
        ),
        migrations.AddField(
            model_name='snapshotschedule',
            name='source_volume',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='snapshot_schedules', to='openstack_tenant.Volume'),
        ),
        migrations.AddField(
            model_name='snapshotschedule',
            name='tags',
            field=taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'),
        ),
        migrations.AddField(
            model_name='snapshotrestoration',
            name='volume',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='restoration', to='openstack_tenant.Volume'),
        ),
        migrations.AddField(
            model_name='snapshot',
            name='snapshot_schedule',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='snapshots', to='openstack_tenant.SnapshotSchedule'),
        ),
        migrations.AddField(
            model_name='snapshot',
            name='source_volume',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='snapshots', to='openstack_tenant.Volume'),
        ),
        migrations.AddField(
            model_name='snapshot',
            name='tags',
            field=taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'),
        ),
        migrations.AddField(
            model_name='openstacktenantservice',
            name='projects',
            field=models.ManyToManyField(related_name='openstack_tenant_services', through='openstack_tenant.OpenStackTenantServiceProjectLink', to='structure.Project'),
        ),
        migrations.AddField(
            model_name='openstacktenantservice',
            name='settings',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='structure.ServiceSettings'),
        ),
        migrations.AddField(
            model_name='internalip',
            name='subnet',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='internal_ips', to='openstack_tenant.SubNet'),
        ),
        migrations.AddField(
            model_name='instance',
            name='availability_zone',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='openstack_tenant.InstanceAvailabilityZone'),
        ),
        migrations.AddField(
            model_name='instance',
            name='security_groups',
            field=models.ManyToManyField(related_name='instances', to='openstack_tenant.SecurityGroup'),
        ),
        migrations.AddField(
            model_name='instance',
            name='service_project_link',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='instances', to='openstack_tenant.OpenStackTenantServiceProjectLink'),
        ),
        migrations.AddField(
            model_name='instance',
            name='subnets',
            field=models.ManyToManyField(through='openstack_tenant.InternalIP', to='openstack_tenant.SubNet'),
        ),
        migrations.AddField(
            model_name='instance',
            name='tags',
            field=taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'),
        ),
        migrations.AddField(
            model_name='floatingip',
            name='internal_ip',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='floating_ips', to='openstack_tenant.InternalIP'),
        ),
        migrations.AddField(
            model_name='floatingip',
            name='settings',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='structure.ServiceSettings'),
        ),
        migrations.AddField(
            model_name='backupschedule',
            name='instance',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='backup_schedules', to='openstack_tenant.Instance'),
        ),
        migrations.AddField(
            model_name='backupschedule',
            name='service_project_link',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='backup_schedules', to='openstack_tenant.OpenStackTenantServiceProjectLink'),
        ),
        migrations.AddField(
            model_name='backupschedule',
            name='tags',
            field=taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'),
        ),
        migrations.AddField(
            model_name='backuprestoration',
            name='flavor',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='openstack_tenant.Flavor'),
        ),
        migrations.AddField(
            model_name='backuprestoration',
            name='instance',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='openstack_tenant.Instance'),
        ),
        migrations.AddField(
            model_name='backup',
            name='backup_schedule',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='backups', to='openstack_tenant.BackupSchedule'),
        ),
        migrations.AddField(
            model_name='backup',
            name='instance',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='backups', to='openstack_tenant.Instance'),
        ),
        migrations.AddField(
            model_name='backup',
            name='service_project_link',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='backups', to='openstack_tenant.OpenStackTenantServiceProjectLink'),
        ),
        migrations.AddField(
            model_name='backup',
            name='snapshots',
            field=models.ManyToManyField(related_name='backups', to='openstack_tenant.Snapshot'),
        ),
        migrations.AddField(
            model_name='backup',
            name='tags',
            field=taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'),
        ),
        migrations.AlterUniqueTogether(
            name='volumetype',
            unique_together=set([('settings', 'backend_id')]),
        ),
        migrations.AlterUniqueTogether(
            name='volumeavailabilityzone',
            unique_together=set([('settings', 'name')]),
        ),
        migrations.AlterUniqueTogether(
            name='volume',
            unique_together=set([('service_project_link', 'backend_id')]),
        ),
        migrations.AlterUniqueTogether(
            name='subnet',
            unique_together=set([('settings', 'backend_id')]),
        ),
        migrations.AlterUniqueTogether(
            name='snapshot',
            unique_together=set([('service_project_link', 'backend_id')]),
        ),
        migrations.AlterUniqueTogether(
            name='securitygroup',
            unique_together=set([('settings', 'backend_id')]),
        ),
        migrations.AlterUniqueTogether(
            name='openstacktenantserviceprojectlink',
            unique_together=set([('service', 'project')]),
        ),
        migrations.AlterUniqueTogether(
            name='openstacktenantservice',
            unique_together=set([('customer', 'settings')]),
        ),
        migrations.AlterUniqueTogether(
            name='network',
            unique_together=set([('settings', 'backend_id')]),
        ),
        migrations.AlterUniqueTogether(
            name='internalip',
            unique_together=set([('backend_id', 'settings')]),
        ),
        migrations.AlterUniqueTogether(
            name='instanceavailabilityzone',
            unique_together=set([('settings', 'name')]),
        ),
        migrations.AlterUniqueTogether(
            name='instance',
            unique_together=set([('service_project_link', 'backend_id')]),
        ),
        migrations.AlterUniqueTogether(
            name='image',
            unique_together=set([('settings', 'backend_id')]),
        ),
        migrations.AlterUniqueTogether(
            name='floatingip',
            unique_together=set([('settings', 'address')]),
        ),
        migrations.AlterUniqueTogether(
            name='flavor',
            unique_together=set([('settings', 'backend_id')]),
        ),
    ]
