本文整理汇总了Python中pyanaconda.modules.common.constants.services.STORAGE.get_proxy方法的典型用法代码示例。如果您正苦于以下问题:Python STORAGE.get_proxy方法的具体用法?Python STORAGE.get_proxy怎么用?Python STORAGE.get_proxy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyanaconda.modules.common.constants.services.STORAGE
的用法示例。
在下文中一共展示了STORAGE.get_proxy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _reset_storage
# 需要导入模块: from pyanaconda.modules.common.constants.services import STORAGE [as 别名]
# 或者: from pyanaconda.modules.common.constants.services.STORAGE import get_proxy [as 别名]
def _reset_storage(storage):
"""Do reset the storage.
FIXME: Call the DBus task instead of this function.
:param storage: an instance of the Blivet's storage object
"""
# Set the ignored and exclusive disks.
disk_select_proxy = STORAGE.get_proxy(DISK_SELECTION)
storage.ignored_disks = disk_select_proxy.IgnoredDisks
storage.exclusive_disks = disk_select_proxy.ExclusiveDisks
storage.protected_devices = disk_select_proxy.ProtectedDevices
storage.disk_images = disk_select_proxy.DiskImages
# Reload additional modules.
if not conf.target.is_image:
iscsi.startup()
fcoe_proxy = STORAGE.get_proxy(FCOE)
fcoe_proxy.ReloadModule()
if arch.is_s390():
zfcp_proxy = STORAGE.get_proxy(ZFCP)
zfcp_proxy.ReloadModule()
# Do the reset.
storage.reset()
示例2: write_storage_configuration
# 需要导入模块: from pyanaconda.modules.common.constants.services import STORAGE [as 别名]
# 或者: from pyanaconda.modules.common.constants.services.STORAGE import get_proxy [as 别名]
def write_storage_configuration(storage, sysroot=None):
"""Write the storage configuration to sysroot.
:param storage: the storage object
:param sysroot: a path to the target OS installation
"""
if sysroot is None:
sysroot = util.getSysroot()
if not os.path.isdir("%s/etc" % sysroot):
os.mkdir("%s/etc" % sysroot)
_write_escrow_packets(storage, sysroot)
storage.make_mtab()
storage.fsset.write()
iscsi.write(sysroot, storage)
fcoe_proxy = STORAGE.get_proxy(FCOE)
fcoe_proxy.WriteConfiguration(sysroot)
if arch.is_s390():
zfcp_proxy = STORAGE.get_proxy(ZFCP)
zfcp_proxy.WriteConfiguration(sysroot)
_write_dasd_conf(storage, sysroot)
示例3: __init__
# 需要导入模块: from pyanaconda.modules.common.constants.services import STORAGE [as 别名]
# 或者: from pyanaconda.modules.common.constants.services.STORAGE import get_proxy [as 别名]
def __init__(self, data, storage, payload):
super().__init__(data, storage, payload)
self.title = N_("Assign mount points")
self._container = None
self._disk_select_proxy = STORAGE.get_proxy(DISK_SELECTION)
self._manual_part_proxy = STORAGE.get_proxy(MANUAL_PARTITIONING)
self._mount_info = self._gather_mount_info()
示例4: applyDiskSelection
# 需要导入模块: from pyanaconda.modules.common.constants.services import STORAGE [as 别名]
# 或者: from pyanaconda.modules.common.constants.services.STORAGE import get_proxy [as 别名]
def applyDiskSelection(storage, data, use_names):
onlyuse = use_names[:]
for disk in (d for d in storage.disks if d.name in onlyuse):
onlyuse.extend(d.name for d in disk.ancestors
if d.name not in onlyuse
and d.is_disk)
disk_select_proxy = STORAGE.get_proxy(DISK_SELECTION)
disk_select_proxy.SetSelectedDisks(onlyuse)
disk_init_proxy = STORAGE.get_proxy(DISK_INITIALIZATION)
disk_init_proxy.SetDrivesToClear(use_names)
示例5: _configure_partitioning
# 需要导入模块: from pyanaconda.modules.common.constants.services import STORAGE [as 别名]
# 或者: from pyanaconda.modules.common.constants.services.STORAGE import get_proxy [as 别名]
def _configure_partitioning(self, storage):
"""Configure the partitioning.
:param storage: an instance of Blivet
"""
log.debug("Executing the automatic partitioning.")
# Create the auto partitioning proxy.
auto_part_proxy = STORAGE.get_proxy(AUTO_PARTITIONING)
# Set the filesystem type.
fstype = auto_part_proxy.FilesystemType
if fstype:
storage.set_default_fstype(fstype)
storage.set_default_boot_fstype(fstype)
# Set the default pbkdf args.
pbkdf_args = self._luks_format_args.get('pbkdf_args', None)
if pbkdf_args and not luks_data.pbkdf_args:
luks_data.pbkdf_args = pbkdf_args
# Set the minimal entropy.
min_luks_entropy = self._luks_format_args.get('min_luks_entropy', None)
if min_luks_entropy is not None:
luks_data.min_entropy = min_luks_entropy
# Get the autopart requests.
requests = self._get_autopart_requests(storage)
# Do the autopart.
self._do_autopart(storage, self._scheme, requests, self._encrypted, self._luks_format_args)
示例6: execute
# 需要导入模块: from pyanaconda.modules.common.constants.services import STORAGE [as 别名]
# 或者: from pyanaconda.modules.common.constants.services.STORAGE import get_proxy [as 别名]
def execute(self, storage, dry_run=False):
"""Execute the bootloader."""
log.debug("Execute the bootloader with dry run %s.", dry_run)
bootloader_proxy = STORAGE.get_proxy(BOOTLOADER)
# Skip bootloader for s390x image installation.
if blivet.arch.is_s390() \
and conf.target.is_image \
and bootloader_proxy.BootloaderMode == BOOTLOADER_ENABLED:
bootloader_proxy.SetBootloaderMode(BOOTLOADER_SKIPPED)
# Is the bootloader enabled?
if bootloader_proxy.BootloaderMode != BOOTLOADER_ENABLED:
storage.bootloader.skip_bootloader = True
log.debug("Bootloader is not enabled, skipping.")
return
# Update the disk list. Disks are already sorted by Blivet.
storage.bootloader.set_disk_list([d for d in storage.disks if d.partitioned])
# Apply the settings.
self._update_flags(storage, bootloader_proxy)
self._apply_args(storage, bootloader_proxy)
self._apply_location(storage, bootloader_proxy)
self._apply_password(storage, bootloader_proxy)
self._apply_timeout(storage, bootloader_proxy)
self._apply_drive_order(storage, bootloader_proxy, dry_run=dry_run)
self._apply_boot_drive(storage, bootloader_proxy, dry_run=dry_run)
# Set the stage2 and stage1 devices.
if not dry_run:
storage.bootloader.stage2_device = storage.boot_device
storage.bootloader.set_stage1_device(storage.devices)
示例7: _get_initialization_config
# 需要导入模块: from pyanaconda.modules.common.constants.services import STORAGE [as 别名]
# 或者: from pyanaconda.modules.common.constants.services.STORAGE import get_proxy [as 别名]
def _get_initialization_config(self):
"""Get the initialization config.
FIXME: This is a temporary method.
"""
config = DiskInitializationConfig()
# Update the config.
disk_init_proxy = STORAGE.get_proxy(DISK_INITIALIZATION)
config.initialization_mode = disk_init_proxy.InitializationMode
config.drives_to_clear = disk_init_proxy.DrivesToClear
config.devices_to_clear = disk_init_proxy.DevicesToClear
config.initialize_labels = disk_init_proxy.InitializeLabelsEnabled
config.format_unrecognized = disk_init_proxy.FormatUnrecognizedEnabled
config.clear_non_existent = False
# Update the disk label.
disk_label = disk_init_proxy.DefaultDiskLabel
if disk_label and not DiskLabel.set_default_label_type(disk_label):
log.warning("%s is not a supported disklabel type on this platform. "
"Using default disklabel %s instead.", disk_label,
DiskLabel.get_platform_label_types()[0])
return config
示例8: do_format
# 需要导入模块: from pyanaconda.modules.common.constants.services import STORAGE [as 别名]
# 或者: from pyanaconda.modules.common.constants.services.STORAGE import get_proxy [as 别名]
def do_format(self):
"""Format with a remote task."""
disk_names = [disk.name for disk in self._dasds]
task_path = self._dasd_module.FormatWithTask(disk_names)
task_proxy = STORAGE.get_proxy(task_path)
sync_run_task(task_proxy, callback=self._report_progress)
示例9: _filter_default_partitions
# 需要导入模块: from pyanaconda.modules.common.constants.services import STORAGE [as 别名]
# 或者: from pyanaconda.modules.common.constants.services.STORAGE import get_proxy [as 别名]
def _filter_default_partitions(requests):
"""Filter default partitions based on the kickstart data.
:param requests: a list of requests
:return: a customized list of requests
"""
auto_part_proxy = STORAGE.get_proxy(AUTO_PARTITIONING)
skipped_mountpoints = set()
skipped_fstypes = set()
# Create sets of mountpoints and fstypes to remove from autorequests.
if auto_part_proxy.Enabled:
# Remove /home if --nohome is selected.
if auto_part_proxy.NoHome:
skipped_mountpoints.add("/home")
# Remove /boot if --noboot is selected.
if auto_part_proxy.NoBoot:
skipped_mountpoints.add("/boot")
# Remove swap if --noswap is selected.
if auto_part_proxy.NoSwap:
skipped_fstypes.add("swap")
# Swap will not be recommended by the storage checker.
# TODO: Remove this code from this function.
from pyanaconda.storage.checker import storage_checker
storage_checker.add_constraint(STORAGE_SWAP_IS_RECOMMENDED, False)
# Skip mountpoints we want to remove.
return [
req for req in requests
if req.mountpoint not in skipped_mountpoints
and req.fstype not in skipped_fstypes
]
示例10: _set_storage_defaults
# 需要导入模块: from pyanaconda.modules.common.constants.services import STORAGE [as 别名]
# 或者: from pyanaconda.modules.common.constants.services.STORAGE import get_proxy [as 别名]
def _set_storage_defaults(self, storage):
fstype = None
boot_fstype = None
# Get the default fstype from a kickstart file.
auto_part_proxy = STORAGE.get_proxy(AUTO_PARTITIONING)
if auto_part_proxy.Enabled and auto_part_proxy.FilesystemType:
fstype = auto_part_proxy.FilesystemType
boot_fstype = fstype
# Or from an install class.
elif self.instClass.defaultFS:
fstype = self.instClass.defaultFS
boot_fstype = None
# Set the default fstype.
if fstype:
storage.set_default_fstype(fstype)
# Set the default boot fstype.
if boot_fstype:
storage.set_default_boot_fstype(boot_fstype)
# Set the default LUKS version.
luks_version = self.instClass.default_luks_version
if luks_version:
storage.set_default_luks_version(luks_version)
# Set the default partitioning.
storage.set_default_partitioning(self.instClass.default_partitioning)
示例11: setup
# 需要导入模块: from pyanaconda.modules.common.constants.services import STORAGE [as 别名]
# 或者: from pyanaconda.modules.common.constants.services.STORAGE import get_proxy [as 别名]
def setup(self, storage, ksdata, payload):
# the kdump addon should run only if requested
if not flags.cmdline.getbool("kdump_addon", default=False):
return
bootloader_proxy = STORAGE.get_proxy(BOOTLOADER)
# Clear any existing crashkernel bootloader arguments
extra_args = bootloader_proxy.ExtraArguments
new_args = [arg for arg in extra_args
if not arg.startswith('crashkernel=')]
# Copy our reserved amount to the bootloader arguments
if self.enabled:
# Ensure that the amount is an amount in MB
if self.reserveMB[-1] != 'M':
self.reserveMB += 'M'
new_args.append(' crashkernel=%s' % self.reserveMB)
bootloader_proxy.SetExtraArguments(new_args)
# Do the same thing with the storage.bootloader.boot_args set
if storage.bootloader.boot_args:
crashargs = [arg for arg in storage.bootloader.boot_args \
if arg.startswith('crashkernel=')]
storage.bootloader.boot_args -= set(crashargs)
if self.enabled:
storage.bootloader.boot_args.add('crashkernel=%s' % self.reserveMB)
ksdata.packages.packageList.append("kexec-tools")
if self.enablefadump and os.path.exists(FADUMP_CAPABLE_FILE):
storage.bootloader.boot_args.add('fadump=on')
示例12: __init__
# 需要导入模块: from pyanaconda.modules.common.constants.services import STORAGE [as 别名]
# 或者: from pyanaconda.modules.common.constants.services.STORAGE import get_proxy [as 别名]
def __init__(self, data, storage, disks, show_remove=True, set_boot=True):
super().__init__(data)
self._storage = storage
self.disks = []
self._view = self.builder.get_object("disk_tree_view")
self._store = self.builder.get_object("disk_store")
self._selection = self.builder.get_object("disk_selection")
self._summary_label = self.builder.get_object("summary_label")
self._set_button = self.builder.get_object("set_as_boot_button")
self._remove_button = self.builder.get_object("remove_button")
self._bootloader_proxy = STORAGE.get_proxy(BOOTLOADER)
self._previousID = None
for disk in disks:
self._store.append([False,
"%s (%s)" % (disk.description, disk.serial),
str(disk.size),
str(self._storage.get_disk_free_space([disk])),
disk.name,
disk.id])
self.disks = disks[:]
self._update_summary()
if not show_remove:
self.builder.get_object("remove_button").hide()
if not set_boot:
self._set_button.hide()
if not disks:
return
# Don't select a boot device if no boot device is asked for.
if self._bootloader_proxy.BootloaderMode != BOOTLOADER_ENABLED:
return
# Set up the default boot device. Use what's in the ksdata if anything,
# then fall back to the first device.
boot_drive = self._bootloader_proxy.Drive
default_id = None
if boot_drive:
for d in self.disks:
if d.name == boot_drive:
default_id = d.id
if not default_id:
default_id = self.disks[0].id
# And then select it in the UI.
for row in self._store:
if row[ID_COL] == default_id:
self._previousID = row[ID_COL]
row[IS_BOOT_COL] = True
break
示例13: reset_bootloader
# 需要导入模块: from pyanaconda.modules.common.constants.services import STORAGE [as 别名]
# 或者: from pyanaconda.modules.common.constants.services.STORAGE import get_proxy [as 别名]
def reset_bootloader(storage):
"""Reset the bootloader.
:param storage: an instance of the Blivet's storage object
"""
bootloader_proxy = STORAGE.get_proxy(BOOTLOADER)
bootloader_proxy.SetDrive(BOOTLOADER_DRIVE_UNSET)
storage.bootloader.reset()
示例14: ignore_nvdimm_blockdevs
# 需要导入模块: from pyanaconda.modules.common.constants.services import STORAGE [as 别名]
# 或者: from pyanaconda.modules.common.constants.services.STORAGE import get_proxy [as 别名]
def ignore_nvdimm_blockdevs():
"""Add nvdimm devices to be ignored to the ignored disks."""
if conf.target.is_directory:
return
nvdimm_proxy = STORAGE.get_proxy(NVDIMM)
ignored_nvdimm_devs = nvdimm_proxy.GetDevicesToIgnore()
if not ignored_nvdimm_devs:
return
log.debug("Adding NVDIMM devices %s to ignored disks", ",".join(ignored_nvdimm_devs))
disk_select_proxy = STORAGE.get_proxy(DISK_SELECTION)
ignored_disks = disk_select_proxy.IgnoredDisks
ignored_disks.extend(ignored_nvdimm_devs)
disk_select_proxy.SetIgnoredDisks(ignored_disks)
示例15: configure_storage
# 需要导入模块: from pyanaconda.modules.common.constants.services import STORAGE [as 别名]
# 或者: from pyanaconda.modules.common.constants.services.STORAGE import get_proxy [as 别名]
def configure_storage(storage, data=None, interactive=False):
"""Setup storage state from the kickstart data.
:param storage: an instance of the Blivet's storage object
:param data: an instance of kickstart data or None
:param interactive: use a task for the interactive partitioning
"""
auto_part_proxy = STORAGE.get_proxy(AUTO_PARTITIONING)
if interactive:
task = InteractivePartitioningTask(storage)
elif auto_part_proxy.Enabled:
luks_version = auto_part_proxy.LUKSVersion or storage.default_luks_version
passphrase = auto_part_proxy.Passphrase or storage.encryption_passphrase
escrow_cert = storage.get_escrow_certificate(auto_part_proxy.Escrowcert)
pbkdf_args = get_pbkdf_args(
luks_version=luks_version,
pbkdf_type=auto_part_proxy.PBKDF or None,
max_memory_kb=auto_part_proxy.PBKDFMemory,
iterations=auto_part_proxy.PBKDFIterations,
time_ms=auto_part_proxy.PBKDFTime
)
luks_format_args = {
"passphrase": passphrase,
"cipher": auto_part_proxy.Cipher,
"luks_version": luks_version,
"pbkdf_args": pbkdf_args,
"escrow_cert": escrow_cert,
"add_backup_passphrase": auto_part_proxy.BackupPassphraseEnabled,
"min_luks_entropy": MIN_CREATE_ENTROPY,
}
task = AutomaticPartitioningTask(
storage,
auto_part_proxy.Type,
auto_part_proxy.Encrypted,
luks_format_args
)
elif STORAGE.get_proxy(MANUAL_PARTITIONING).Enabled:
task = ManualPartitioningTask(storage)
else:
task = CustomPartitioningTask(storage, data)
task.run()