#relaxed_acs_check = 1
-# If allow_disk_format_probing is enabled, libvirt will probe disk
-# images to attempt to identify their format, when not otherwise
-# specified in the XML. This is disabled by default.
-#
-# WARNING: Enabling probing is a security hole in almost all
-# deployments. It is strongly recommended that users update their
-# guest XML <disk> elements to include <driver type='XXXX'/>
-# elements instead of enabling this option.
-#
-#allow_disk_format_probing = 1
-
-
# In order to prevent accidentally starting two domains that
# share one writable disk, libvirt offers two approaches for
# locking files. The first one is sanlock, the other one,
char **nvram = NULL;
char *corestr = NULL;
char **namespaces = NULL;
+ bool tmp;
/* Just check the file is readable before opening it, otherwise
* libvirt emits an error.
goto cleanup;
if (virConfGetValueBool(conf, "clear_emulator_capabilities", &cfg->clearEmulatorCapabilities) < 0)
goto cleanup;
- if (virConfGetValueBool(conf, "allow_disk_format_probing", &cfg->allowDiskFormatProbing) < 0)
+ if (virConfGetValueBool(conf, "allow_disk_format_probing", &tmp) < 0)
goto cleanup;
+ if (tmp) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("allow_disk_format_probing is no longer supported"));
+ goto cleanup;
+ }
if (virConfGetValueBool(conf, "set_process_name", &cfg->setProcessName) < 0)
goto cleanup;
if (virConfGetValueUInt(conf, "max_processes", &cfg->maxProcesses) < 0)
static int
qemuDomainDeviceDiskDefPostParse(virDomainDiskDefPtr disk,
virQEMUCapsPtr qemuCaps,
- unsigned int parseFlags,
- virQEMUDriverConfigPtr cfg)
+ unsigned int parseFlags)
{
/* set default disk types and drivers */
- /* assign default storage format and driver according to config */
- if (cfg->allowDiskFormatProbing) {
- /* default disk format for drives */
- if (virDomainDiskGetFormat(disk) == VIR_STORAGE_FILE_NONE &&
- (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_FILE ||
- virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_BLOCK))
- virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_AUTO);
-
- /* default disk format for mirrored drive */
- if (disk->mirror &&
- disk->mirror->format == VIR_STORAGE_FILE_NONE)
- disk->mirror->format = VIR_STORAGE_FILE_AUTO;
- } else {
- /* default driver if probing is forbidden */
- if (!virDomainDiskGetDriver(disk) &&
- virDomainDiskSetDriver(disk, "qemu") < 0)
- return -1;
+ if (!virDomainDiskGetDriver(disk) &&
+ virDomainDiskSetDriver(disk, "qemu") < 0)
+ return -1;
- /* default disk format for drives */
- if (virDomainDiskGetFormat(disk) == VIR_STORAGE_FILE_NONE &&
- (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_FILE ||
- virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_BLOCK))
- virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_RAW);
+ /* default disk format for drives */
+ if (virDomainDiskGetFormat(disk) == VIR_STORAGE_FILE_NONE &&
+ (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_FILE ||
+ virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_BLOCK))
+ virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_RAW);
- /* default disk format for mirrored drive */
- if (disk->mirror &&
- disk->mirror->format == VIR_STORAGE_FILE_NONE)
- disk->mirror->format = VIR_STORAGE_FILE_RAW;
- }
+ /* default disk format for mirrored drive */
+ if (disk->mirror &&
+ disk->mirror->format == VIR_STORAGE_FILE_NONE)
+ disk->mirror->format = VIR_STORAGE_FILE_RAW;
if (qemuDomainDeviceDiskDefPostParseRestoreSecAlias(disk, qemuCaps,
parseFlags) < 0)
* function shall not fail in that case. It will be re-run on VM startup
* with the capabilities populated. */
virQEMUCapsPtr qemuCaps = parseOpaque;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
int ret = -1;
switch ((virDomainDeviceType) dev->type) {
case VIR_DOMAIN_DEVICE_DISK:
ret = qemuDomainDeviceDiskDefPostParse(dev->data.disk, qemuCaps,
- parseFlags, cfg);
+ parseFlags);
break;
case VIR_DOMAIN_DEVICE_VIDEO:
break;
}
- virObjectUnref(cfg);
return ret;
}
qemuDomainLogContextPtr logCtxt)
{
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
- int format = virDomainDiskGetFormat(disk);
-
- if ((!format || format == VIR_STORAGE_FILE_AUTO) &&
- cfg->allowDiskFormatProbing)
- qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_DISK_PROBING, logCtxt);
if (disk->rawio == VIR_TRISTATE_BOOL_YES)
qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HIGH_PRIVILEGES,
qemuDomainGetImageIds(cfg, vm, src, disk->src, &uid, &gid);
if (virStorageFileGetMetadata(src,
- uid, gid,
- cfg->allowDiskFormatProbing,
+ uid, gid, false,
report_broken) < 0)
goto cleanup;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
unsigned int flags = 0;
- if (cfg->allowDiskFormatProbing)
- flags |= VIR_SECURITY_MANAGER_ALLOW_DISK_PROBE;
if (cfg->securityDefaultConfined)
flags |= VIR_SECURITY_MANAGER_DEFAULT_CONFINED;
if (cfg->securityRequireConfined)
if (virStorageSourceUpdateBackingSizes(src, fd, &sb) < 0)
goto cleanup;
- if (virStorageSourceUpdateCapacity(src, buf, len,
- cfg->allowDiskFormatProbing) < 0)
+ if (virStorageSourceUpdateCapacity(src, buf, len, false) < 0)
goto cleanup;
/* If guest is not using raw disk format and is on a host block
defdisk->src->path,
virStorageFileFormatTypeToString(defdisk->src->format));
} else {
- if (!cfg->allowDiskFormatProbing) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown image format of '%s' and "
- "format probing is disabled"),
- defdisk->src->path);
- goto cleanup;
- }
-
- /* adds cmd line arg: backing_file=/path/to/backing/file */
- virCommandAddArgFormat(cmd, "backing_file=%s", defdisk->src->path);
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown image format of '%s' and "
+ "format probing is disabled"),
+ defdisk->src->path);
+ goto cleanup;
}
/* adds cmd line args: /path/to/target/file */