def get_config_drive_type(os_type=None): """Determine the type of config drive. Config drive will be: 'cdrom' in case of config_drive is set to iso9660; 'disk' in case of config_drive is set to vfat; 'fs' in case of os_type is EXE and virt_type is parallels; Autodetected from (cdrom, disk, fs) in case of config_drive is None; Otherwise, an exception of unknown format will be thrown. Returns a string indicating the config drive type. """ if CONF.config_drive_format == 'iso9660': config_drive_type = 'cdrom' elif CONF.config_drive_format == 'vfat': config_drive_type = 'disk' elif CONF.config_drive_format is None: if CONF.libvirt.virt_type == 'parallels': if os_type == vm_mode.HVM: config_drive_type = 'cdrom' elif os_type == vm_mode.EXE: config_drive_type = 'fs' else: raise exception.ConfigDriveUnknownFormat( format=CONF.config_drive_format, os_type=os_type) else: config_drive_type = 'cdrom' else: raise exception.ConfigDriveUnknownFormat( format=CONF.config_drive_format, os_type=os_type) return config_drive_type
def make_drive(self, path): if FLAGS.config_drive_format == 'iso9660': self._make_iso9660(path) elif FLAGS.config_drive_format == 'vfat': self._make_vfat(path) else: raise exception.ConfigDriveUnknownFormat( format=FLAGS.config_drive_format)
def make_drive(self, path): """Make the config drive. :param path: the path to place the config drive image at :raises ProcessExecuteError if a helper process has failed. """ if CONF.config_drive_format in ['iso9660']: self._make_tgz(path) else: raise exception.ConfigDriveUnknownFormat( format=CONF.config_drive_format)
def make_drive(self, path): """Make the config drive. :param path: the path to place the config drive image at :raises ProcessExecuteError if a helper process has failed. """ with utils.tempdir() as tmpdir: self._write_md_files(tmpdir) if CONF.config_drive_format == 'iso9660': self._make_iso9660(path, tmpdir) elif CONF.config_drive_format == 'vfat': self._make_vfat(path, tmpdir) else: raise exception.ConfigDriveUnknownFormat( format=CONF.config_drive_format)
def get_config_drive_type(): """Determine the type of config drive. If config_drive_format is set to iso9660 then the config drive will be 'cdrom', otherwise 'disk'. Returns a string indicating the config drive type. """ if CONF.config_drive_format == 'iso9660': config_drive_type = 'cdrom' elif CONF.config_drive_format == 'vfat': config_drive_type = 'disk' else: raise exception.ConfigDriveUnknownFormat( format=CONF.config_drive_format) return config_drive_type