25 from django.db
import models
26 from clm.utils.exception
import CLMException
27 from common.states
import cluster_states
38 address = models.CharField(max_length=20)
40 port = models.IntegerField()
42 name = models.CharField(max_length=40, unique=
True)
44 state = models.IntegerField()
65 d[
'cluster_id'] = self.id
69 d[
'state'] = self.
state
83 d[
'cluster_id'] = self.id
85 d[
'state'] = self.
state
99 cluster = Cluster.objects.get(pk=cluster_id)
100 except Cluster.DoesNotExist:
101 raise CLMException(
'cluster_get')
102 if cluster.state == cluster_states[
'locked']:
103 raise CLMException(
'cluster_locked')