~mpontillo/maas/remove-iscpy-trunk

« back to all changes in this revision

Viewing changes to src/maasserver/models/partition.py

[r=blake-rouse,allenap][bug=][author=rbanffy] Add partition information to API blockdevice data

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
from maasserver.enum import PARTITION_TABLE_TYPE
32
32
from maasserver.models.cleansave import CleanSave
33
33
from maasserver.models.timestampedmodel import TimestampedModel
 
34
from maasserver.utils.orm import get_one
34
35
 
35
36
 
36
37
class Partition(CleanSave, TimestampedModel):
119
120
    def size_blocks(self):
120
121
        """Returns the size of the partition, in blocks."""
121
122
        return int(ceil(float(self.size) / self.get_block_size()))
 
123
 
 
124
    @property
 
125
    def filesystem(self):
 
126
        """Returns the filesystem that's using this partition"""
 
127
        return get_one(self.filesystem_set.all())