Revert 03efa0f (#210)

It seems the bug was only present on my old dev bootstrapping machine

This reverts commit 03efa0ffdf1ee0d3cf81905e6e4d9f5f6aa62143.
This commit is contained in:
Anders Ingemann 2015-04-12 10:13:16 +02:00
parent f1e4d34eb9
commit a2cf28b054

View file

@ -31,8 +31,6 @@ class BasePartition(AbstractPartition):
self.previous = previous
# List of flags that parted should put on the partition
self.flags = []
# Path to symlink in /dev/disk/by-uuid (manually maintained by this class)
self.disk_by_uuid_path = None
super(BasePartition, self).__init__(size, filesystem, format_command)
def create(self, volume):
@ -73,25 +71,6 @@ class BasePartition(AbstractPartition):
"""
self.fsm.map(device_path=device_path)
def link_uuid(self):
# /lib/udev/rules.d/60-kpartx.rules does not create symlinks in /dev/disk/by-{uuid,label}
# This patch would fix that: http://www.redhat.com/archives/dm-devel/2013-July/msg00080.html
# For now we just do the uuid part ourselves.
# This is mainly to fix a problem in update-grub where /etc/grub.d/10_linux
# checks if the $GRUB_DEVICE_UUID exists in /dev/disk/by-uuid and falls
# back to $GRUB_DEVICE if it doesn't.
# $GRUB_DEVICE is /dev/mapper/xvd{f,g...}# (on ec2), opposed to /dev/xvda# when booting.
# Creating the symlink ensures that grub consistently uses
# $GRUB_DEVICE_UUID when creating /boot/grub/grub.cfg
import os
self.disk_by_uuid_path = os.path.join('/dev/disk/by-uuid', self.get_uuid())
os.symlink(self.device_path, self.disk_by_uuid_path)
def unlink_uuid(self):
import os
os.remove(self.disk_by_uuid_path)
self.disk_by_uuid_path = None
def _before_create(self, e):
"""Creates the partition
"""
@ -113,16 +92,7 @@ class BasePartition(AbstractPartition):
def _before_map(self, e):
# Set the device path
self.device_path = e.device_path
if e.src == 'unmapped_fmt':
# Only link the uuid if the partition is formatted
self.link_uuid()
def _after_format(self, e):
# We do this after formatting because there otherwise would be no UUID
self.link_uuid()
def _before_unmap(self, e):
# When unmapped, the device_path information becomes invalid, so we delete it
self.device_path = None
if e.src == 'formatted':
self.unlink_uuid()