Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Misc. fixes
* Workaround delayed IO keeping loop devices busy
* Fix issue with proxy set
* Fix vfat UUID missing a -

Signed-off-by: Islam Amer <islam.amer@jollamobile.com>
  • Loading branch information
Islam Amer committed Jan 3, 2013
1 parent 2872e1b commit dc1873f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
15 changes: 12 additions & 3 deletions mic/utils/fs_related.py
Expand Up @@ -528,22 +528,31 @@ def __init__(self, disk, mountdir, fstype, blocksize, fslabel, rmmountdir=True,
DiskMount.__init__(self, disk, mountdir, fstype, rmmountdir)
self.blocksize = blocksize
self.fslabel = fslabel.replace("/", "")
self.uuid = "%08X" % int(time.time())
self.uuid = None
self.blkidcmd = find_binary_path("blkid")
self.skipformat = skipformat
self.fsopts = fsopts
self.fsckcmd = find_binary_path("fsck." + self.fstype)

def __parse_field(self, output, field):
for line in output.split(" "):
if line.startswith(field + "="):
return line[len(field) + 1:].strip().replace("\"", "")

raise KeyError("Failed to find field '%s' in output" % field)

def __format_filesystem(self):
if self.skipformat:
msger.debug("Skip filesystem format.")
return

msger.verbose("Formating %s filesystem on %s" % (self.fstype, self.disk.device))
rc = runner.show([self.mkfscmd, "-n", self.fslabel, "-i", self.uuid, self.disk.device])
rc = runner.show([self.mkfscmd, "-n", self.fslabel, self.disk.device])
if rc != 0:
raise MountError("Error creating %s filesystem on disk %s" % (self.fstype,self.disk.device))

msger.verbose("Tuning filesystem on %s" % self.disk.device)
self.uuid = self.__parse_field(runner.outs([self.blkidcmd, self.disk.device]), "UUID")

def __resize_filesystem(self, size = None):
current_size = os.stat(self.disk.lofile)[stat.ST_SIZE]
Expand Down
4 changes: 3 additions & 1 deletion mic/utils/partitionedfs.py
Expand Up @@ -19,6 +19,7 @@
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.

import os
import time

from mic import msger
from mic.utils import runner
Expand Down Expand Up @@ -339,6 +340,8 @@ def __unmap_partitions(self):
self.partitions[pnum]['device'] = None

msger.debug("Unmapping %s" % d['disk'].device)
#FIXME: find a better way to workaround delayed IO keeping the devices busy
time.sleep(4)
rc = runner.quiet([self.kpartx, "-d", d['disk'].device])
if rc != 0:
raise MountError("Failed to unmap partitions for '%s'" %
Expand Down Expand Up @@ -562,7 +565,6 @@ def __unmount_subvolumes(self):
subvol["mounted"] = False

def __create_subvolume_snapshots(self, p, pdisk):
import time

if self.snapshot_created:
return
Expand Down
2 changes: 1 addition & 1 deletion mic/utils/rpmmisc.py
Expand Up @@ -557,7 +557,7 @@ def checkRepositoryEULA(name, repo):
proxy = get_proxy_for(repo.baseurl[0])

if proxy:
proxies = {str(repourl.split(':')[0]): str(proxy)}
proxies = {str(repo.baseurl[0].split(':')[0]): str(proxy)}

# download all remote files to one temp dir
baseurl = None
Expand Down

0 comments on commit dc1873f

Please sign in to comment.