env.update(self._set_part_env(pnum, "BOOTFLAG", p.active))
env.update(self._set_part_env(pnum, "ALIGN", p.align))
env.update(self._set_part_env(pnum, "TYPE_ID", p.part_type))
+ env.update(self._set_part_env(pnum, "UUID", p.uuid))
env.update(self._set_part_env(pnum, "DEVNODE",
"/dev/%s%d" % (p.disk, pnum + 1)))
env.update(self._set_part_env(pnum, "DISK_DEVNODE",
'fstype': part.fstype or 'ext3',
'extopts': part.extopts or None,
'loop': None, # to be created in _mount_instroot
+ 'uuid': part.uuid or None,
})
self._instloops = allloops
"size": self.__image_size or 4096L,
"fstype": self.__fstype or "ext3",
"extopts": None,
- "loop": None
+ "loop": None,
+ "uuid": None,
})
self._check_imgdir()
mp,
fstype,
self._blocksize,
- loop['label'])
+ loop['label'],
+ fsuuid = loop['uuid'])
if fstype in ("ext2", "ext3", "ext4"):
loop['loop'].extopts = loop['extopts']
self.align = kwargs.get("align", None)
self.extopts = kwargs.get("extopts", None)
self.part_type = kwargs.get("part_type", None)
+ self.uuid = kwargs.get("uuid", None)
def _getArgsAsStr(self):
retval = FC4_PartData._getArgsAsStr(self)
retval += " --extoptions=%s" % self.extopts
if self.part_type:
retval += " --part-type=%s" % self.part_type
+ if self.uuid:
+ retval += " --uuid=%s" % self.uuid
return retval
default=None)
op.add_option("--part-type", type="string", action="store", dest="part_type",
default=None)
+ op.add_option("--uuid", dest="uuid", action="store", type="string")
return op
class ExtDiskMount(DiskMount):
"""A DiskMount object that is able to format/resize ext[23] filesystems."""
- def __init__(self, disk, mountdir, fstype, blocksize, fslabel, rmmountdir=True, skipformat = False, fsopts = None):
+ def __init__(self, disk, mountdir, fstype, blocksize, fslabel, rmmountdir=True, skipformat = False, fsopts = None, fsuuid=None):
DiskMount.__init__(self, disk, mountdir, fstype, rmmountdir)
self.blocksize = blocksize
self.fslabel = fslabel.replace("/", "")
- self.uuid = str(uuid.uuid4())
+ self.uuid = fsuuid or str(uuid.uuid4())
self.skipformat = skipformat
self.fsopts = fsopts
self.extopts = None
class VfatDiskMount(DiskMount):
"""A DiskMount object that is able to format vfat/msdos filesystems."""
- def __init__(self, disk, mountdir, fstype, blocksize, fslabel, rmmountdir=True, skipformat = False, fsopts = None):
+ def __init__(self, disk, mountdir, fstype, blocksize, fslabel, rmmountdir=True, skipformat = False, fsopts = None, fsuuid = None):
DiskMount.__init__(self, disk, mountdir, fstype, rmmountdir)
self.blocksize = blocksize
self.fslabel = fslabel.replace("/", "")
rand1 = random.randint(0, 2**16 - 1)
rand2 = random.randint(0, 2**16 - 1)
- self.uuid = "%04X-%04X" % (rand1, rand2)
+ self.uuid = fsuuid or "%04X-%04X" % (rand1, rand2)
self.skipformat = skipformat
self.fsopts = fsopts
self.fsckcmd = find_binary_path("fsck." + self.fstype)
class BtrfsDiskMount(DiskMount):
"""A DiskMount object that is able to format/resize btrfs filesystems."""
- def __init__(self, disk, mountdir, fstype, blocksize, fslabel, rmmountdir=True, skipformat = False, fsopts = None):
+ def __init__(self, disk, mountdir, fstype, blocksize, fslabel, rmmountdir=True, skipformat = False, fsopts = None, fsuuid = None):
self.__check_btrfs()
DiskMount.__init__(self, disk, mountdir, fstype, rmmountdir)
self.blocksize = blocksize
self.fslabel = fslabel.replace("/", "")
- self.uuid = None
+ self.uuid = fsuuid or None
self.skipformat = skipformat
self.fsopts = fsopts
self.blkidcmd = find_binary_path("blkid")