本文整理汇总了Python中kiwi.defaults.Defaults.get_install_volume_id方法的典型用法代码示例。如果您正苦于以下问题:Python Defaults.get_install_volume_id方法的具体用法?Python Defaults.get_install_volume_id怎么用?Python Defaults.get_install_volume_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kiwi.defaults.Defaults
的用法示例。
在下文中一共展示了Defaults.get_install_volume_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post_init
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_install_volume_id [as 别名]
def post_init(self, custom_args):
"""
isolinux post initialization method
Setup class attributes
"""
self.custom_args = custom_args
arch = platform.machine()
if arch == 'x86_64':
self.arch = arch
elif arch == 'i686' or arch == 'i586':
self.arch = 'ix86'
else:
raise KiwiBootLoaderIsoLinuxPlatformError(
'host architecture %s not supported for isolinux setup' % arch
)
self.volume_id = self.xml_state.build_type.get_volid() or \
Defaults.get_volume_id()
self.live_type = self.xml_state.build_type.get_flags()
if not self.live_type:
self.live_type = Defaults.get_default_live_iso_type()
self.live_boot_options = [
'root=live:CDLABEL={0}'.format(self.volume_id),
'rd.live.image'
]
self.install_boot_options = [
'loglevel=0'
]
if self.xml_state.get_initrd_system() == 'dracut':
self.install_boot_options.append(
'root=install:CDLABEL={0}'.format(
Defaults.get_install_volume_id()
)
)
if self.xml_state.build_type.get_hybridpersistent():
self.live_boot_options += \
Defaults.get_live_iso_persistent_boot_options(
self.xml_state.build_type.get_hybridpersistent_filesystem()
)
self.terminal = self.xml_state.build_type.get_bootloader_console()
self.gfxmode = self.get_gfxmode('isolinux')
# isolinux counts the timeout in units of 1/10 sec
self.timeout = self.get_boot_timeout_seconds() * 10
self.cmdline = self.get_boot_cmdline()
self.cmdline_failsafe = ' '.join(
[self.cmdline, Defaults.get_failsafe_kernel_options()]
)
self.failsafe_boot = self.failsafe_boot_entry_requested()
self.mediacheck_boot = self.xml_state.build_type.get_mediacheck()
self.multiboot = False
if self.xml_state.is_xen_server():
self.multiboot = True
self.isolinux = BootLoaderTemplateIsoLinux()
self.config = None
self.config_message = None
示例2: post_init
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_install_volume_id [as 别名]
def post_init(self, custom_args):
"""
grub2 post initialization method
:param dict custom_args:
Contains grub config arguments
.. code:: python
{'grub_directory_name': 'grub|grub2'}
"""
self.custom_args = custom_args
arch = platform.machine()
if arch == 'x86_64':
# grub2 support for bios and efi systems
self.arch = arch
elif arch.startswith('ppc64'):
# grub2 support for ofw and opal systems
self.arch = arch
elif arch == 'i686' or arch == 'i586':
# grub2 support for bios systems
self.arch = 'ix86'
elif arch == 'aarch64' or arch.startswith('arm'):
# grub2 support for efi systems
self.arch = arch
else:
raise KiwiBootLoaderGrubPlatformError(
'host architecture %s not supported for grub2 setup' % arch
)
if self.custom_args and 'grub_directory_name' in self.custom_args:
self.boot_directory_name = self.custom_args['grub_directory_name']
else:
self.boot_directory_name = 'grub'
self.terminal = self.xml_state.build_type.get_bootloader_console() \
or 'gfxterm'
self.gfxmode = self.get_gfxmode('grub2')
self.bootpath = self.get_boot_path()
self.theme = self.get_boot_theme()
self.timeout = self.get_boot_timeout_seconds()
self.failsafe_boot = self.failsafe_boot_entry_requested()
self.mediacheck_boot = self.xml_state.build_type.get_mediacheck()
self.xen_guest = self.xml_state.is_xen_guest()
self.firmware = FirmWare(
self.xml_state
)
self.live_type = self.xml_state.build_type.get_flags()
if not self.live_type:
self.live_type = Defaults.get_default_live_iso_type()
self.volume_id = self.xml_state.build_type.get_volid() or \
Defaults.get_volume_id()
self.live_boot_options = [
'root=live:CDLABEL={0}'.format(self.volume_id),
'rd.live.image'
]
self.install_boot_options = [
'loglevel=0'
]
if self.xml_state.get_initrd_system() == 'dracut':
self.install_boot_options.append(
'root=install:CDLABEL={0}'.format(
Defaults.get_install_volume_id()
)
)
if self.xml_state.build_type.get_hybridpersistent():
self.live_boot_options += \
Defaults.get_live_iso_persistent_boot_options(
self.xml_state.build_type.get_hybridpersistent_filesystem()
)
if self.xml_state.is_xen_server():
self.hybrid_boot = False
self.multiboot = True
elif self.xen_guest:
self.hybrid_boot = False
self.multiboot = False
else:
self.hybrid_boot = True
self.multiboot = False
self.grub2 = BootLoaderTemplateGrub2()
self.config = None
self.efi_boot_path = None
self.cmdline_failsafe = None
self.cmdline = None
self.iso_boot = False
self.shim_fallback_setup = False
示例3: create_install_iso
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_install_volume_id [as 别名]
def create_install_iso(self):
"""
Create an install ISO from the disk_image as hybrid ISO
bootable via legacy BIOS, EFI and as disk from Stick
Image types which triggers this builder are:
* installiso="true|false"
* installstick="true|false"
"""
self.media_dir = mkdtemp(
prefix='kiwi_install_media.', dir=self.target_dir
)
# custom iso metadata
self.custom_iso_args = {
'create_options': [
'-V', Defaults.get_install_volume_id(),
'-A', self.mbrid.get_id()
]
}
# the system image transfer is checked against a checksum
log.info('Creating disk image checksum')
self.squashed_contents = mkdtemp(
prefix='kiwi_install_squashfs.', dir=self.target_dir
)
checksum = Checksum(self.diskname)
checksum.md5(self.squashed_contents + '/' + self.md5name)
# the system image name is stored in a config file
self._write_install_image_info_to_iso_image()
if self.initrd_system == 'kiwi':
self._write_install_image_info_to_boot_image()
# the system image is stored as squashfs embedded file
log.info('Creating squashfs embedded disk image')
Command.run(
[
'cp', '-l', self.diskname,
self.squashed_contents + '/' + self.squashed_diskname
]
)
squashed_image_file = ''.join(
[
self.target_dir, '/', self.squashed_diskname, '.squashfs'
]
)
squashed_image = FileSystemSquashFs(
device_provider=None, root_dir=self.squashed_contents
)
squashed_image.create_on_file(squashed_image_file)
Command.run(
['mv', squashed_image_file, self.media_dir]
)
# setup bootloader config to boot the ISO via isolinux
log.info('Setting up install image bootloader configuration')
bootloader_config_isolinux = BootLoaderConfig(
'isolinux', self.xml_state, self.media_dir
)
bootloader_config_isolinux.setup_install_boot_images(
mbrid=None,
lookup_path=self.boot_image_task.boot_root_directory
)
bootloader_config_isolinux.setup_install_image_config(
mbrid=None
)
bootloader_config_isolinux.write()
# setup bootloader config to boot the ISO via EFI
bootloader_config_grub = BootLoaderConfig(
'grub2', self.xml_state, self.media_dir, {
'grub_directory_name':
Defaults.get_grub_boot_directory_name(self.root_dir)
}
)
bootloader_config_grub.setup_install_boot_images(
mbrid=self.mbrid, lookup_path=self.root_dir
)
bootloader_config_grub.setup_install_image_config(
mbrid=self.mbrid
)
bootloader_config_grub.write()
# create initrd for install image
log.info('Creating install image boot image')
self._create_iso_install_kernel_and_initrd()
# the system image initrd is stored to allow kexec
self._copy_system_image_initrd_to_iso_image()
# create iso filesystem from media_dir
log.info('Creating ISO filesystem')
iso_image = FileSystemIsoFs(
device_provider=None,
root_dir=self.media_dir,
custom_args=self.custom_iso_args
)
iso_header_offset = iso_image.create_on_file(self.isoname)
#.........这里部分代码省略.........