Add detect type of partition (primary,logical and etc)

lvmraid
Mike Hiretsky 13 years ago
parent ae58a01e8a
commit c6fc50e0e0

@ -26,7 +26,8 @@ from cl_utils import isMount,typeFile,getTupleVersion,pathJoin,isFstabMount,\
listDirectory, getAvailableVideo, getUUIDDict, \
getUdevDeviceInfo, getPartitionDevice, getPartitionSize, \
isPkgInstalled, process, checkUtils, readLinesFile, \
FStab, lspci, getInstalledVideo,getDeviceType
FStab, lspci, getInstalledVideo,getDeviceType, \
getPartitionType
from cl_distr import DistributiveRepository,PartitionDistributive
from cl_fill import clLocale
from operator import itemgetter
@ -305,6 +306,7 @@ class fillVars(object, glob_attr):
dev_hash['id'] =props.get('ID_PART_ENTRY_TYPE','').partition("x")[2]
devParent = getPartitionDevice(disk)
dev_hash['parent'] = devParent
dev_hash['part'] = getPartitionType(props)
dev_hash['options'] = fstab.getBy(what=fstab.OPTS,eq=devName) or ""
dev_hash['size'] = getPartitionSize(disk)
if devParent in devicesHash and 'ID_PART_ENTRY_NUMBER' in props:

@ -1371,10 +1371,11 @@ class cl_install(color_print, SignalInterrupt):
builderMode = self.clVars.Get('os_install_scratch') == "on"
clearBuilder = lambda data,isswap: "" if builderMode and isswap != "swap" else data
# get hash from current variables
devMount = dict(map(lambda x:(x[0],
{'mountPoint':clearParam(x[1],x[1]),
'fileSystem':x[2],
'options':clearParam(x[3],x[1]),
DEV,MOUNT,FS,OPTS = 0,1,2,3
devMount = dict(map(lambda x:(x[DEV],
{'mountPoint':clearParam(x[MOUNT],x[MOUNT]),
'fileSystem':x[FS],
'options':clearParam(x[OPTS],x[MOUNT]),
'isFormat':""}),
zip(self.clVars.Get('os_disk_dev'),
self.clVars.Get('os_install_disk_mount'),

@ -36,14 +36,9 @@ CMD_OPTIONS = [{'shortOption':"d",
'optVal':"DISK[:[DIR:FILESYSTEM:OPTIONS]]",
'action':'append',
'help':_("the DISK for installation, which mounted to DIR") +
". "
+_("DIR with value 'none' will cancels the mount point transfer")
},
{'shortOption':"b",
'longOption':"bind",
'optVal':"SRC_DIR:DEST_DIR",
'action':'append',
'help':_("bind mount point for instalation")
". " +
_("DIR with value 'none' will cancels the mount point transfer")
+ ". " +_("For creating bind mount point need specify source directory as DISK")
},
{'shortOption':"w",
'longOption':"swap",
@ -266,15 +261,6 @@ class install_cmd(share_cmd):
self.optobj.error(_("option %s:") %"d" +\
" " + _("disk specifing error: '%s'")\
%", ".join(wrongValue))
# check syntax SRC_DIR:DEST_DIR
if values.b:
reTrueBind = re.compile("^[^:]+:[^:]+$")
wrongValue = filter(lambda x: not reTrueBind.match(x),values.b)
if wrongValue:
self.optobj.error(_("option %s:") %"b" +\
" " + _("mount bind specifing error: '%s'")\
%", ".join(wrongValue))
# check syntax SWAP_DISK
if values.w:
reTrueBind = re.compile("^[^:]+$")
@ -364,7 +350,7 @@ class install_cmd(share_cmd):
self.logicObj.clVars.Set('cl_action',
"merge" if live else "system",True)
def checkAndSetInstallOptions(self,diskOptions, swapOptions, bindOptions,
def checkAndSetInstallOptions(self,diskOptions, swapOptions,
usersOptions):
"""Check and set disk, swap and bind cmd options"""
if self.optobj.values.s:
@ -389,8 +375,7 @@ class install_cmd(share_cmd):
listDiskOptions = self._parseOptDisk(diskOptions)
if listDiskOptions is False:
return False
if bindOptions:
listBindOptions = self._parseOptBind(bindOptions)
listBindOptions = self._parseOptBind(diskOptions)
if listBindOptions is False:
return False
if swapOptions:
@ -423,6 +408,7 @@ class install_cmd(share_cmd):
def _parseOptBind(self, listOpt):
"""Parse value cmd option --bind"""
listOpt = filter(lambda x:not x.startswith('/dev/'),listOpt)
listNameOptions = ["srcMountPoint", "destMountPoint"]
lenOptions = len(listNameOptions)
itemOptions = map(lambda x: (x,''), listNameOptions)
@ -445,6 +431,7 @@ class install_cmd(share_cmd):
def _parseOptDisk(self, listOpt):
"""Parse value cmd option --disk"""
listOpt = filter(lambda x:x.startswith('/dev/'),listOpt)
listNameOptions = ["dev","mountPoint","fileSystem","options"]
lenOptions = len(listNameOptions)
itemOptions = map(lambda x: (x,''), listNameOptions)

@ -52,7 +52,7 @@ if __name__ == "__main__":
# check and set installed options
install.setAction(options.live)
if not (options.live or options.install or options.uninstall):
if not install.checkAndSetInstallOptions(options.d,options.w,options.b,
if not install.checkAndSetInstallOptions(options.d,options.w,
options.u):
sys.exit(1)
# print variables

Loading…
Cancel
Save