Skip to content

Commit

Permalink
update rockon models. rockstor#697
Browse files Browse the repository at this point in the history
  • Loading branch information
schakrava committed Jul 1, 2015
1 parent da29475 commit 845c43e
Show file tree
Hide file tree
Showing 6 changed files with 1,113 additions and 3 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/rockstor/storageadmin/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from pool_balance import PoolBalance
from tls_certificate import TLSCertificate
from rockon import (RockOn, DImage, DContainer, DPort, DVolume,
ContainerOption, DCustomConfig)
ContainerOption, DCustomConfig, DContainerLink)
from smart import (SMARTAttribute, SMARTCapability, SMARTErrorLog,
SMARTErrorLogSummary, SMARTTestLog, SMARTTestLogDetail,
SMARTIdentity, SMARTInfo)
21 changes: 20 additions & 1 deletion src/rockstor/storageadmin/models/rockon.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class RockOn(models.Model):
status = models.CharField(max_length=2048)
link = models.CharField(max_length=1024, null=True)
website = models.CharField(max_length=2048, null=True)
https = models.BooleanField(default=False)
icon = models.URLField(max_length=1024, null=True)

class Meta:
app_label = 'storageadmin'
Expand All @@ -46,18 +48,31 @@ class DContainer(models.Model):
rockon = models.ForeignKey(RockOn)
dimage = models.ForeignKey(DImage)
name = models.CharField(max_length=1024, unique=True)
link = models.ForeignKey('self', null=True)
launch_order = models.IntegerField(default=1)

class Meta:
app_label = 'storageadmin'


class DContainerLink(models.Model):
source = models.OneToOneField(DContainer)
destination = models.ForeignKey(DContainer, related_name='destination_container')
name = models.CharField(max_length=64, null=True)

class Meta:
unique_together = ('destination', 'name')
app_label = 'storageadmin'


class DPort(models.Model):
description = models.CharField(max_length=1024, null=True)
hostp = models.IntegerField(unique=True)
containerp = models.IntegerField()
containerp_default = models.IntegerField(null=True)
container = models.ForeignKey(DContainer)
protocol = models.CharField(max_length=32, null=True)
uiport = models.BooleanField(default=False)
label = models.CharField(max_length=1024, null=True)

class Meta:
unique_together = ('container', 'containerp',)
Expand All @@ -69,6 +84,9 @@ class DVolume(models.Model):
share = models.ForeignKey(Share, null=True)
dest_dir = models.CharField(max_length=1024)
uservol = models.BooleanField(default=False)
description = models.CharField(max_length=1024, null=True)
min_size = models.IntegerField(default=0)
label = models.CharField(max_length=1024, null=True)

@property
def share_name(self):
Expand All @@ -95,6 +113,7 @@ class DCustomConfig(models.Model):
key = models.CharField(max_length=1024)
val = models.CharField(max_length=1024, null=True)
description = models.CharField(max_length=2048, null=True)
label = models.CharField(max_length=64, null=True)

class Meta:
unique_together = ('rockon', 'key',)
Expand Down
5 changes: 4 additions & 1 deletion src/rockstor/storageadmin/views/rockon.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,22 @@ def post(self, request, command=None):
po.description = p_d['description']
po.uiport = p_d['ui']
po.protocol = p_d['protocol']
po.label = p_d['label']
elif (DPort.objects.filter(containerp=p, container=co).exists()):
po = DPort.objects.get(containerp=p, container=co)
po.hostp = p
po.containerp_default = p_d['default']
po.description = p_d['description']
po.uiport = p_d['ui']
po.protocol = p_d['protocol']
po.label = p_d['label']
else:
po = DPort(description=p_d['description'],
hostp=p, containerp=p,
containerp_default=p_d['default'],
container=co, uiport=p_d['ui'],
protocol=p_d['protocol'])
protocol=p_d['protocol'],
label=p_d['label'])
po.save()
else:
ports = {}
Expand Down
1 change: 1 addition & 0 deletions src/rockstor/storageadmin/views/rockon_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
'ports': {'443': {'ui': True,
'default': 8080,
'protocol': 'tcp',
'label': 'UI port',
'description': 'The port where OwnCloud UI runs. Since Rockstor WebUI runs on 443, choose a different port or the suggested default.',},},
'volumes': {'/var/www/owncloud/data':
{'description': 'Choose a dedicated Share for OwnCloud data. Eg: create a Share called owncloud-data for this purpose alone.',
Expand Down

0 comments on commit 845c43e

Please sign in to comment.