Revision 58194535 snf-cyclades-app/synnefo/db/models.py

b/snf-cyclades-app/synnefo/db/models.py
1011 1011
    userid = models.CharField("Owner's UUID", max_length=100, null=False,
1012 1012
                              db_index=True)
1013 1013
    size = models.IntegerField("Volume size in GB",  null=False)
1014
    disk_template = models.CharField('Disk template', max_length=32,
1015
                                     null=False)
1016

  
1014 1017
    delete_on_termination = models.BooleanField("Delete on Server Termination",
1015 1018
                                                default=True, null=False)
1016 1019

  
......
1068 1071
            return None
1069 1072

  
1070 1073
    @property
1071
    def disk_template(self):
1072
        if self.machine is None:
1073
            return None
1074
        else:
1075
            disk_template = self.machine.flavor.disk_template
1076
            return disk_template.split("_")[0]
1074
    def template(self):
1075
        return self.disk_template.split("_")[0]
1077 1076

  
1078 1077
    @property
1079
    def disk_provider(self):
1080
        if self.machine is None:
1081
            return None
1078
    def provider(self):
1079
        if "_" in self.disk_template:
1080
            return self.disk_template.split("_")[1]
1082 1081
        else:
1083
            disk_template = self.machine.flavor.disk_template
1084
            if "_" in disk_template:
1085
                return disk_template.split("_")[1]
1086
            else:
1087
                return None
1082
            return None
1088 1083

  
1089 1084
    @staticmethod
1090 1085
    def prefix_source(source_id, source_type):

Also available in: Unified diff