def _add_partition(self, disk, start, end, type, fs, name=""):
		if self._debug: self._logger.log("_add_partition(): type=%s, fstype=%s" % (type, fs))
		types = { 'primary': parted.PARTITION_PRIMARY, 'extended': parted.PARTITION_EXTENDED, 'logical': parted.PARTITION_LOGICAL }
		fsTypes = {}
		fs_type = parted.file_system_type_get_next ()
		while fs_type:
			fsTypes[fs_type.name] = fs_type
			fs_type = parted.file_system_type_get_next (fs_type)
		fstype = None
		if fs: fstype = fsTypes[fs]
		newpart = disk.partition_new(types[type], fstype, start, end)
		if self._debug: self._logger.log("_add_partition(): partition object created")
		constraint = disk.dev.constraint_any()
		if self._debug: self._logger.log("_add_partition(): constraint object created")
		disk.add_partition(newpart, constraint)
		if self._debug: self._logger.log("_add_partition(): partition added")
	def _add_partition(self, disk, start, end, type, fs, name=""):
		if self._debug: self._logger.log("_add_partition(): type=%s, fstype=%s" % (type, fs))
		types = { 'primary': parted.PARTITION_PRIMARY, 'extended': parted.PARTITION_EXTENDED, 'logical': parted.PARTITION_LOGICAL }
		fsTypes = {}
		fs_type = parted.file_system_type_get_next ()
		while fs_type:
			fsTypes[fs_type.name] = fs_type
			fs_type = parted.file_system_type_get_next (fs_type)
		fstype = None
		if fs: fstype = fsTypes[fs]
		newpart = disk.partition_new(types[type], fstype, start, end)
		if self._debug: self._logger.log("_add_partition(): partition object created")
		constraint = disk.dev.constraint_any()
		if self._debug: self._logger.log("_add_partition(): constraint object created")
		disk.add_partition(newpart, constraint)
		if self._debug: self._logger.log("_add_partition(): partition added")
Example #3
0
import os, sys, string, struct

from product import *
import fsset
import iutil, isys
import raid
import lvm
from flags import flags
from partErrors import *

from rhpl.log import log
from rhpl.translate import _

fsTypes = {}

fs_type = parted.file_system_type_get_next ()
while fs_type:
    fsTypes[fs_type.name] = fs_type
    fs_type = parted.file_system_type_get_next (fs_type)



def get_flags (part):
    """Retrieve a list of strings representing the flags on the partition."""
    string=""
    if not part.is_active ():
        return string
    first=1
    flag = parted.partition_flag_next (0)
    while flag:
        if part.get_flag (flag):
Example #4
0
#!/usr/bin/python
# Copyright (C) 2003, Charles Wang <*****@*****.**>
# Author:  Charles Wang.

import parted

print '*** file_system_type ***'
fstype = parted.file_system_type_get_next()
while fstype:
    print fstype.name
    fstype = parted.file_system_type_get_next(fstype)
print

print '*** disk_type ***'
disktype = parted.disk_type_get_next()
while disktype:
    print disktype.name
    disktype = parted.disk_type_get_next(disktype)