Rename MBR partition table to MSDOS

Calling it MBR is just confusing
This commit is contained in:
Anders Ingemann 2014-01-18 21:23:54 +00:00
parent f16939eef5
commit 889812b1ad
11 changed files with 20 additions and 20 deletions

View file

@ -6,11 +6,11 @@ def load_volume(data):
from common.fs.virtualdiskimage import VirtualDiskImage
from common.fs.virtualmachinedisk import VirtualMachineDisk
from partitionmaps.gpt import GPTPartitionMap
from partitionmaps.mbr import MBRPartitionMap
from partitionmaps.msdos import MSDOSPartitionMap
from partitionmaps.none import NoPartitions
partition_maps = {'none': NoPartitions,
'gpt': GPTPartitionMap,
'mbr': MBRPartitionMap,
'msdos': MSDOSPartitionMap,
}
partition_map = partition_maps.get(data['partitions']['type'])(data['partitions'])
volume_backings = {'raw': LoopbackVolume,

View file

@ -1,10 +1,10 @@
from abstract import AbstractPartitionMap
from ..partitions.mbr import MBRPartition
from ..partitions.mbr_swap import MBRSwapPartition
from ..partitions.msdos import MSDOSPartition
from ..partitions.msdos_swap import MSDOSSwapPartition
from common.tools import log_check_call
class MBRPartitionMap(AbstractPartitionMap):
class MSDOSPartitionMap(AbstractPartitionMap):
def __init__(self, data):
self.partitions = []
@ -12,15 +12,15 @@ class MBRPartitionMap(AbstractPartitionMap):
def last_partition():
return self.partitions[-1] if len(self.partitions) > 0 else None
if 'boot' in data:
self.boot = MBRPartition(data['boot']['size'], data['boot']['filesystem'], None)
self.boot = MSDOSPartition(data['boot']['size'], data['boot']['filesystem'], None)
self.partitions.append(self.boot)
if 'swap' in data:
self.swap = MBRSwapPartition(data['swap']['size'], last_partition())
self.swap = MSDOSSwapPartition(data['swap']['size'], last_partition())
self.partitions.append(self.swap)
self.root = MBRPartition(data['root']['size'], data['root']['filesystem'], last_partition())
self.root = MSDOSPartition(data['root']['size'], data['root']['filesystem'], last_partition())
self.partitions.append(self.root)
super(MBRPartitionMap, self).__init__()
super(MSDOSPartitionMap, self).__init__()
def get_total_size(self):
return sum(p.size for p in self.partitions) + 1 # Post-MBR gap for embedding grub

View file

@ -2,7 +2,7 @@ from common.tools import log_check_call
from base import BasePartition
class MBRPartition(BasePartition):
class MSDOSPartition(BasePartition):
def get_start(self):
if self.previous is None:

View file

@ -1,11 +1,11 @@
from common.tools import log_check_call
from mbr import MBRPartition
from msdos import MSDOSPartition
class MBRSwapPartition(MBRPartition):
class MSDOSSwapPartition(MSDOSPartition):
def __init__(self, size, previous):
super(MBRSwapPartition, self).__init__(size, 'swap', previous)
super(MSDOSSwapPartition, self).__init__(size, 'swap', previous)
def _before_format(self, e):
log_check_call(['/sbin/mkswap', self.device_path])

View file

@ -117,7 +117,7 @@
"partition_table": {
"type": "object",
"properties": {
"type": { "enum": ["mbr", "gpt"] },
"type": { "enum": ["msdos", "gpt"] },
"boot": { "$ref": "#/definitions/partition" },
"root": { "$ref": "#/definitions/partition" },
"swap": {

View file

@ -27,7 +27,7 @@
"volume": {
"backing": "ebs",
"partitions": {
"type": "mbr",
"type": "msdos",
"root": {
"size": 1023,
"filesystem": "ext4"

View file

@ -20,7 +20,7 @@
"volume": {
"backing": "vmdk",
"partitions": {
"type": "mbr",
"type": "msdos",
"boot": {
"size": 64,
"filesystem": "ext2"

View file

@ -20,7 +20,7 @@
"volume": {
"backing": "vdi",
"partitions": {
"type": "mbr",
"type": "msdos",
"boot": {
"size": 32,
"filesystem": "ext2"

View file

@ -31,7 +31,7 @@ def validate_manifest(data, validator, error):
validator(data, os.path.join(os.path.dirname(__file__), 'manifest-schema.json'))
if data['volume']['backing'] == 'ebs':
volume_size = 1 if data['volume']['partitions']['type'] == 'mbr' else 0
volume_size = 1 if data['volume']['partitions']['type'] == 'msdos' else 0
for key, partition in data['volume']['partitions'].iteritems():
if key != 'type':
volume_size += partition['size']

View file

@ -30,7 +30,7 @@
"partitions": {
"type": "object",
"properties": {
"type": { "enum": ["none", "mbr"] }
"type": { "enum": ["none", "msdos"] }
}
}
},

View file

@ -30,7 +30,7 @@
"partitions": {
"type": "object",
"properties": {
"type": { "enum": ["none", "mbr"] }
"type": { "enum": ["none", "msdos"] }
}
}
},