Skip to content

Commit

Permalink
Do format handling when adding devices from format handlers.
Browse files Browse the repository at this point in the history
This way the formatting is set up correctly so that any subsequent
lookup of the newly-added device will find the correct format info.

Related: rhbz#1197582
  • Loading branch information
dwlehman committed May 28, 2015
1 parent 6c8ee5f commit 0bd1e23
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions blivet/populator.py
Expand Up @@ -24,7 +24,6 @@
import re
import shutil
import pprint
import copy
import parted

from gi.repository import BlockDev as blockdev
Expand Down Expand Up @@ -745,7 +744,7 @@ def addUdevDevice(self, info):
# now handle the device's formatting
self.handleUdevDeviceFormat(info, device)
if device_added:
device.originalFormat = copy.copy(device.format)
device.updateOriginalFormat()
device.deviceLinks = udev.device_get_symlinks(info)

def handleUdevDiskLabelFormat(self, info, device):
Expand Down Expand Up @@ -843,6 +842,11 @@ def handleUdevLUKSFormat(self, info, device):
else:
luks_device.updateSysfsPath()
self.devicetree._addDevice(luks_device)

# do format handling immediately to keep things consistent
luks_info = udev.get_device(luks_device.sysfsPath)
self.handleUdevDeviceFormat(luks_info, luks_device)
luks_device.updateOriginalFormat()
else:
log.warning("luks device %s already in the tree",
device.format.mapName)
Expand Down Expand Up @@ -1002,8 +1006,9 @@ def addLV(lv):
log.error("failed to get udev data for lv %s", lv_device.name)
return

# do format handling now
self.addUdevDevice(lv_info)
# do format handling immediately to keep things consistent
self.handleUdevDeviceFormat(lv_info, lv_device)
lv_device.updateOriginalFormat()

raid_items = dict((n.replace("[", "").replace("]", ""),
{"copies": 0, "log": Size(0), "meta": Size(0)})
Expand Down Expand Up @@ -1146,6 +1151,11 @@ def handleUdevMDMemberFormat(self, info, device):
md_array.parents.append(device)
self.devicetree._addDevice(md_array)

# do format handling now to keep things consistent
array_info = udev.get_device(md_array.sysfsPath)
self.handleUdevDeviceFormat(array_info, md_array)
md_array.updateOriginalFormat()

def handleUdevDMRaidMemberFormat(self, info, device):
# if dmraid usage is disabled skip any dmraid set activation
if not flags.dmraid:
Expand Down

0 comments on commit 0bd1e23

Please sign in to comment.