summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Provaznik <jan.provaznik@gmail.com>2013-08-06 01:55:07 -0700
committerJan Provaznik <jan.provaznik@gmail.com>2013-08-06 01:55:07 -0700
commit41aa6279d3bb0a4727604b0e8ed5061996c9a210 (patch)
tree7e4623bf01613ee0d10087c00b4ada2ce07190f6
parentfe8ce143fda4e81dc61d4fa54b79343cd38bfb86 (diff)
parentbbd5f1428a58b105151dfe73f9bc443f9cae3da4 (diff)
downloadtuskar-ui-41aa6279d3bb0a4727604b0e8ed5061996c9a210.tar.gz
Merge pull request #10 from tzumainn/cleanup
removed unused models
-rw-r--r--openstack_dashboard/api/tuskar.py2
-rw-r--r--openstack_dashboard/dashboards/infrastructure/fixtures/initial_data.json22
-rw-r--r--openstack_dashboard/dashboards/infrastructure/models.py38
3 files changed, 7 insertions, 55 deletions
diff --git a/openstack_dashboard/api/tuskar.py b/openstack_dashboard/api/tuskar.py
index bebccc70..23bde905 100644
--- a/openstack_dashboard/api/tuskar.py
+++ b/openstack_dashboard/api/tuskar.py
@@ -199,7 +199,7 @@ class Node(StringIdAPIResourceWrapper):
@classmethod
def list_unracked(cls, request):
return [cls(h) for h in dummymodels.Node.objects.all() if (
- h.rack is None)]
+ h.rack_id is None)]
@classmethod
def create(cls, request, name, mac_address, ip_address, status,
diff --git a/openstack_dashboard/dashboards/infrastructure/fixtures/initial_data.json b/openstack_dashboard/dashboards/infrastructure/fixtures/initial_data.json
index 281af6e4..fc204cd3 100644
--- a/openstack_dashboard/dashboards/infrastructure/fixtures/initial_data.json
+++ b/openstack_dashboard/dashboards/infrastructure/fixtures/initial_data.json
@@ -7,25 +7,12 @@
{"pk": 6, "model": "infrastructure.flavortemplate", "fields": {"name": "large"}},
{"pk": 7, "model": "infrastructure.flavortemplate", "fields": {"name": "xlarge"}},
- {"pk": 1, "model": "infrastructure.node", "fields": {"name": "node1", "rack": 1, "mac_address": "00-B0-D0-86-AB-F7", "ip_address": "192.168.191.11", "status": "active", "usage": "20"}},
- {"pk": 2, "model": "infrastructure.node", "fields": {"name": "node2", "rack": 1, "mac_address": "00-B0-D0-86-AB-F8", "ip_address": "192.168.191.12", "status": "active", "usage": "30"}},
- {"pk": 3, "model": "infrastructure.node", "fields": {"name": "node3", "rack": 2, "mac_address": "00-B0-D0-86-AB-F9", "ip_address": "192.168.191.13", "status": "active", "usage": "40"}},
- {"pk": 4, "model": "infrastructure.node", "fields": {"name": "node4", "rack": 2, "mac_address": "00-B0-D0-86-AB-F0", "ip_address": "192.168.191.14", "status": "active", "usage": "50"}},
+ {"pk": 1, "model": "infrastructure.node", "fields": {"name": "node1", "rack_id": 1, "mac_address": "00-B0-D0-86-AB-F7", "ip_address": "192.168.191.11", "status": "active", "usage": "20"}},
+ {"pk": 2, "model": "infrastructure.node", "fields": {"name": "node2", "rack_id": 1, "mac_address": "00-B0-D0-86-AB-F8", "ip_address": "192.168.191.12", "status": "active", "usage": "30"}},
+ {"pk": 3, "model": "infrastructure.node", "fields": {"name": "node3", "rack_id": 2, "mac_address": "00-B0-D0-86-AB-F9", "ip_address": "192.168.191.13", "status": "active", "usage": "40"}},
+ {"pk": 4, "model": "infrastructure.node", "fields": {"name": "node4", "rack_id": 2, "mac_address": "00-B0-D0-86-AB-F0", "ip_address": "192.168.191.14", "status": "active", "usage": "50"}},
{"pk": 5, "model": "infrastructure.node", "fields": {"name": "Unracked Node", "mac_address": "00-B0-D0-86-AB-F1"}},
- {"pk": 1, "model": "infrastructure.rack", "fields": {"name": "rack1", "resource_class": 1, "location": "Boston DC 1", "subnet": "10.16.25.0/24", "status": "active"}},
- {"pk": 2, "model": "infrastructure.rack", "fields": {"name": "rack2", "resource_class": 1, "location": "Toronto - 151 Front St.", "subnet": "24.50.60.0/22", "status": "active"}},
-
- {"pk": 1, "model": "infrastructure.resourceclass", "fields": {"service_type": "compute", "name": "m1"}},
-
- {"pk": 1, "model": "infrastructure.resourceclassflavor", "fields": {"flavortemplate": 1, "resource_class": 1, "max_vms": 128}},
- {"pk": 2, "model": "infrastructure.resourceclassflavor", "fields": {"flavortemplate": 2, "resource_class": 1, "max_vms": 64}},
- {"pk": 3, "model": "infrastructure.resourceclassflavor", "fields": {"flavortemplate": 3, "resource_class": 1, "max_vms": 32}},
- {"pk": 4, "model": "infrastructure.resourceclassflavor", "fields": {"flavortemplate": 4, "resource_class": 1, "max_vms": 16}},
- {"pk": 5, "model": "infrastructure.resourceclassflavor", "fields": {"flavortemplate": 5, "resource_class": 1, "max_vms": 8}},
- {"pk": 6, "model": "infrastructure.resourceclassflavor", "fields": {"flavortemplate": 6, "resource_class": 1, "max_vms": 4}},
- {"pk": 7, "model": "infrastructure.resourceclassflavor", "fields": {"flavortemplate": 7, "resource_class": 1, "max_vms": 2}},
-
{"pk": 1, "model": "infrastructure.capacity", "fields": {"value": 4, "unit": "GHz", "object_id": 1, "content_type": ["infrastructure", "node"], "name": "cpu"}},
{"pk": 2, "model": "infrastructure.capacity", "fields": {"value": 4, "unit": "GHz", "object_id": 2, "content_type": ["infrastructure", "node"], "name": "cpu"}},
{"pk": 3, "model": "infrastructure.capacity", "fields": {"value": 4, "unit": "GHz", "object_id": 3, "content_type": ["infrastructure", "node"], "name": "cpu"}},
@@ -88,6 +75,7 @@
{"pk": 53, "model": "infrastructure.capacity", "fields": {"value": 160, "unit": "GB", "object_id": 7, "content_type": ["infrastructure", "flavortemplate"], "name": "storage"}},
{"pk": 54, "model": "infrastructure.capacity", "fields": {"value": 0, "unit": "GB", "object_id": 7, "content_type": ["infrastructure", "flavortemplate"], "name": "ephemeral_disk"}},
{"pk": 55, "model": "infrastructure.capacity", "fields": {"value": 0, "unit": "MB", "object_id": 7, "content_type": ["infrastructure", "flavortemplate"], "name": "swap_disk"}},
+
{"pk": 1, "model": "infrastructure.alert", "fields": {"message": "Switch is not accessible.", "object_id": "1", "object_type": "rack", "time": "2011-09-01T13:20:30+03:00"}},
{"pk": 2, "model": "infrastructure.alert", "fields": {"message": "Nova service is not running.", "object_id": "1", "object_type": "node", "time": "2011-09-01T13:20:30+03:00"}},
{"pk": 3, "model": "infrastructure.alert", "fields": {"message": "Disk usage is over 90%.", "object_id": "1", "object_type": "node", "time": "2011-09-01T13:20:30+03:00"}}
diff --git a/openstack_dashboard/dashboards/infrastructure/models.py b/openstack_dashboard/dashboards/infrastructure/models.py
index 8097e5b1..0437911c 100644
--- a/openstack_dashboard/dashboards/infrastructure/models.py
+++ b/openstack_dashboard/dashboards/infrastructure/models.py
@@ -53,45 +53,9 @@ class Node(models.Model):
db_table = 'infrastructure_node'
name = models.CharField(max_length=50, unique=True)
+ rack_id = models.PositiveIntegerField(null=True)
mac_address = models.CharField(max_length=50, unique=True)
ip_address = models.CharField(max_length=50, unique=True, null=True)
status = models.CharField(max_length=50, null=True)
usage = models.IntegerField(max_length=50, null=True)
- rack = models.ForeignKey('Rack', null=True)
capacities = generic.GenericRelation(Capacity)
-
-
-class Rack(models.Model):
- class Meta:
- db_table = 'infrastructure_rack'
-
- name = models.CharField(max_length=50, unique=True)
- resource_class = models.ForeignKey('ResourceClass', blank=True, null=True)
- capacities = generic.GenericRelation(Capacity)
- location = models.CharField(max_length=50)
- subnet = models.CharField(max_length=50, unique=True)
- status = models.CharField(max_length=50)
-
-
-class ResourceClass(models.Model):
- class Meta:
- # syncdb by default creates 'openstack_dashboard_resourceclass' table,
- # but it's better to keep models under
- # openstack_dashboard/dashboards/infrastructure/models.py instead of
- # openstack_dashboard/models.py since the models.py stub file is
- # required here anyway
- db_table = 'infrastructure_resourceclass'
-
- name = models.CharField(max_length=50, unique=True)
- service_type = models.CharField(max_length=50)
- status = models.CharField(max_length=10, null=True, blank=True)
-
-
-class ResourceClassFlavor(models.Model):
- class Meta:
- db_table = 'infrastructure_resourceclass_flavors'
-
- # ResourceClass db model is not used anymore
- flavortemplate = models.ForeignKey('FlavorTemplate')
- resource_class = models.ForeignKey('ResourceClass')
- max_vms = models.PositiveIntegerField(max_length=50, null=True)