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.virtualdiskimage import VirtualDiskImage
from common.fs.virtualmachinedisk import VirtualMachineDisk from common.fs.virtualmachinedisk import VirtualMachineDisk
from partitionmaps.gpt import GPTPartitionMap from partitionmaps.gpt import GPTPartitionMap
from partitionmaps.mbr import MBRPartitionMap from partitionmaps.msdos import MSDOSPartitionMap
from partitionmaps.none import NoPartitions from partitionmaps.none import NoPartitions
partition_maps = {'none': NoPartitions, partition_maps = {'none': NoPartitions,
'gpt': GPTPartitionMap, 'gpt': GPTPartitionMap,
'mbr': MBRPartitionMap, 'msdos': MSDOSPartitionMap,
} }
partition_map = partition_maps.get(data['partitions']['type'])(data['partitions']) partition_map = partition_maps.get(data['partitions']['type'])(data['partitions'])
volume_backings = {'raw': LoopbackVolume, volume_backings = {'raw': LoopbackVolume,

View file

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

View file

@ -1,11 +1,11 @@
from common.tools import log_check_call 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): def __init__(self, size, previous):
super(MBRSwapPartition, self).__init__(size, 'swap', previous) super(MSDOSSwapPartition, self).__init__(size, 'swap', previous)
def _before_format(self, e): def _before_format(self, e):
log_check_call(['/sbin/mkswap', self.device_path]) log_check_call(['/sbin/mkswap', self.device_path])

View file

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

View file

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

View file

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

View file

@ -20,7 +20,7 @@
"volume": { "volume": {
"backing": "vdi", "backing": "vdi",
"partitions": { "partitions": {
"type": "mbr", "type": "msdos",
"boot": { "boot": {
"size": 32, "size": 32,
"filesystem": "ext2" "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')) validator(data, os.path.join(os.path.dirname(__file__), 'manifest-schema.json'))
if data['volume']['backing'] == 'ebs': 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(): for key, partition in data['volume']['partitions'].iteritems():
if key != 'type': if key != 'type':
volume_size += partition['size'] volume_size += partition['size']

View file

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

View file

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