libvirt/321a28c6-libxl-default-disk-format.patch
James Fehlig f167ba3466 Accepting request 456194 from home:jfehlig:branches:Virtualization
- apparmor: don't fail on non-apparmor <seclabel>
  apparmor-errormsg-fix.patch, apparmor-alt-seclabel.patch
  bsc#1023436

- libxl: fix reporting of domain maximum memory
  ff225538-libxl-autoballoon-setting.patch,
  c89a6e78-libxl-physinfo-cleanup.patch,
  d2b77608-libxl-maxmem-fix.patch,
  79692c38-libxl-dom0-maxmem.patch
  bsc#1017762

- libxl: set disk format to raw if not specified and fix disk
  detach
  321a28c6-libxl-default-disk-format.patch,
  bd116810-libxl-fix-disk-detach.patch
  bsc#1003379

- libxl: fix timer configurations
  6e4759d0-libxl-timer-fix.patch,
  87df87e0-libxl-timer-tsc-emulate.patch,
  b4386fda-xenconfig-timer-fix.patch, d3970925-timer-tests.patch
  bsc#1019969

OBS-URL: https://build.opensuse.org/request/show/456194
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=583
2017-02-10 23:01:12 +00:00

100 lines
4.4 KiB
Diff

commit 321a28c6aef6fb31b4ba309a1b3d252f7cd0f05c
Author: Jim Fehlig <jfehlig@suse.com>
Date: Tue Feb 7 11:00:33 2017 -0700
libxl: set default disk format in device post-parse
When starting a domian, a libxl_domain_config object is created from
virDomainDef. Any virDomainDiskDef devices with a format of
VIR_STORAGE_FILE_NONE are mapped to LIBXL_DISK_FORMAT_RAW in the
corresponding libxl_disk_device, but the virDomainDiskDef format is
never updated to reflect the change.
A better place to set a default format for disk devices is the
device post-parse callback, ensuring the virDomainDiskDef object
reflects the default format.
Index: libvirt-3.0.0/src/libxl/libxl_conf.c
===================================================================
--- libvirt-3.0.0.orig/src/libxl/libxl_conf.c
+++ libvirt-3.0.0/src/libxl/libxl_conf.c
@@ -765,8 +765,6 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
x_disk->format = LIBXL_DISK_FORMAT_VHD;
x_disk->backend = LIBXL_DISK_BACKEND_TAP;
break;
- case VIR_STORAGE_FILE_NONE:
- /* No subtype specified, default to raw/tap */
case VIR_STORAGE_FILE_RAW:
x_disk->format = LIBXL_DISK_FORMAT_RAW;
x_disk->backend = LIBXL_DISK_BACKEND_TAP;
@@ -802,8 +800,6 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
case VIR_STORAGE_FILE_VHD:
x_disk->format = LIBXL_DISK_FORMAT_VHD;
break;
- case VIR_STORAGE_FILE_NONE:
- /* No subtype specified, default to raw */
case VIR_STORAGE_FILE_RAW:
x_disk->format = LIBXL_DISK_FORMAT_RAW;
break;
@@ -816,8 +812,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
return -1;
}
} else if (STREQ(driver, "file")) {
- if (format != VIR_STORAGE_FILE_NONE &&
- format != VIR_STORAGE_FILE_RAW) {
+ if (format != VIR_STORAGE_FILE_RAW) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("libxenlight does not support disk format %s "
"with disk driver %s"),
@@ -828,8 +823,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
x_disk->format = LIBXL_DISK_FORMAT_RAW;
x_disk->backend = LIBXL_DISK_BACKEND_QDISK;
} else if (STREQ(driver, "phy")) {
- if (format != VIR_STORAGE_FILE_NONE &&
- format != VIR_STORAGE_FILE_RAW) {
+ if (format != VIR_STORAGE_FILE_RAW) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("libxenlight does not support disk format %s "
"with disk driver %s"),
Index: libvirt-3.0.0/src/libxl/libxl_domain.c
===================================================================
--- libvirt-3.0.0.orig/src/libxl/libxl_domain.c
+++ libvirt-3.0.0/src/libxl/libxl_domain.c
@@ -362,16 +362,21 @@ libxlDomainDeviceDefPostParse(virDomainD
}
}
- /* for network-based disks, set 'qemu' as the default driver */
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
virDomainDiskDefPtr disk = dev->data.disk;
int actual_type = virStorageSourceGetActualType(disk->src);
+ int format = virDomainDiskGetFormat(disk);
+ /* for network-based disks, set 'qemu' as the default driver */
if (actual_type == VIR_STORAGE_TYPE_NETWORK) {
if (!virDomainDiskGetDriver(disk) &&
virDomainDiskSetDriver(disk, "qemu") < 0)
return -1;
}
+
+ /* xl.cfg default format is raw. See xl-disk-configuration(5) */
+ if (format == VIR_STORAGE_FILE_NONE)
+ virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_RAW);
}
return 0;
Index: libvirt-3.0.0/src/libxl/libxl_driver.c
===================================================================
--- libvirt-3.0.0.orig/src/libxl/libxl_driver.c
+++ libvirt-3.0.0/src/libxl/libxl_driver.c
@@ -5466,8 +5466,7 @@ libxlDomainBlockStatsGatherSingle(virDom
disk_drv = "qemu";
if (STREQ(disk_drv, "phy")) {
- if (disk_fmt != VIR_STORAGE_FILE_RAW &&
- disk_fmt != VIR_STORAGE_FILE_NONE) {
+ if (disk_fmt != VIR_STORAGE_FILE_RAW) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("unsupported format %s"),
virStorageFileFormatTypeToString(disk_fmt));