[libvirt] [PATCH] libxl: don't break the build on Xen>=4.5 because of libxl_vcpu_setaffinity()
by Dario Faggioli
libxl interface for vcpu pinning is changing in Xen 4.5. Basically,
libxl_set_vcpuaffinity() now wants one more parameter. That is
representative of 'VCPU soft affinity', which libvirt does not use.
To mark such change, the macro LIBXL_HAVE_VCPUINFO_SOFT_AFFINITY is
defined. Use it as a gate and, if present, re-#define the calls from
the old to the new interface, to avoid breaking the build.
Signed-off-by: Dario Faggioli <dario.faggioli(a)citrix.com>
Cc: Jim Fehlig <jfehlig(a)suse.com>
Cc: Ian Campbell <Ian.Campbell(a)citrix.com>
Cc: Ian Jackson <Ian.Jackson(a)eu.citrix.com>
---
src/libxl/libxl_conf.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index 6aa36d2..da66b4e 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -55,6 +55,17 @@
# define LIBXL_DUMP_DIR LIBXL_LIB_DIR "/dump"
# define LIBXL_BOOTLOADER_PATH BINDIR "/pygrub"
+/* libxl interface for setting VCPU affinity changed in 4.5. In fact, a new
+ * parameter has been added, representative of 'VCPU soft affinity'. If one
+ * does not care about it (and that's libvirt case), passing NULL is the
+ * right thing to do. To mark that change, LIBXL_HAVE_VCPUINFO_SOFT_AFFINITY
+ * is defined. */
+# ifdef LIBXL_HAVE_VCPUINFO_SOFT_AFFINITY
+# define libxl_set_vcpuaffinity(ctx, domid, vcpuid, map) \
+ libxl_set_vcpuaffinity((ctx), (domid), (vcpuid), (map), NULL)
+# define libxl_set_vcpuaffinity_all(ctx, domid, max_vcpus, map) \
+ libxl_set_vcpuaffinity_all((ctx), (domid), (max_vcpus), (map), NULL)
+# endif
typedef struct _libxlDriverPrivate libxlDriverPrivate;
typedef libxlDriverPrivate *libxlDriverPrivatePtr;
10 years, 4 months
[libvirt] [PATCH] Fix segfault when starting a domain with no cpu definition
by Ján Tomko
My commit fba6bc4 iterated over the features in cpu definition
without checking if there is one.
---
Pushed as trivial.
src/qemu/qemu_migration.c | 2 +-
src/qemu/qemu_process.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index bbfb09a..99d4c4a 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1513,7 +1513,7 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr vm,
return false;
}
- for (i = 0; i < def->cpu->nfeatures; i++) {
+ for (i = 0; def->cpu && i < def->cpu->nfeatures; i++) {
virCPUFeatureDefPtr feature = &def->cpu->features[i];
if (feature->policy != VIR_CPU_FEATURE_REQUIRE)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index a39cc0a..570960e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3636,7 +3636,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, virDomainObjPtr vm)
}
}
- for (i = 0; i < def->cpu->nfeatures; i++) {
+ for (i = 0; def->cpu && i < def->cpu->nfeatures; i++) {
virCPUFeatureDefPtr feature = &def->cpu->features[i];
if (feature->policy != VIR_CPU_FEATURE_REQUIRE)
--
1.8.5.5
10 years, 4 months
[libvirt] Release of libvirt-1.2.6
by Daniel Veillard
As planned I have tagged the release in git and pushed the tarball
as well as signed rpms to the usual place:
ftp://libvirt.org/libvirt/
I also tagged 1.2.6 for the libvirt tree and pushed the associated
release to its own tree:
ftp://libvirt.org/libvirt/python/
Looks like a well balanced release, some new user visible features,
a number of bugs fixes, lot of improvement accross the whole code,
and a bit less than 300 patches in.
Features:
- libxl: add migration support and fixes (Jim Fehlig)
- various improvements and fixes for NUMA (Michal Privoznik)
Documentation:
- security: manager: Document behavior of disk label manipulation funcs (Peter Krempa)
- fix some typos in formatdomain.html (Jincheng Miao)
- virsh: man: Correctly spell QEMU (Peter Krempa)
- virsh: man: Fix examples and docs for virsh version (Peter Krempa)
- Added example script on how to convert LXC container config (Cédric Bosdonnat)
- blockjob: document recent job addition (Eric Blake)
- virsh: Add details about specified migration host (Chen Fan)
- blockcommit: document semantics of committing active layer (Eric Blake)
- fix a typo in hacking.html.in (Wangrui (K))
- formatcaps: Rework and add stubs to document (Michal Privoznik)
Portability:
- build: link libvirt_conf with libxml (Martin Kletzander)
- vbox: fix linker error (Jim Fehlig)
- libxl: don't break the build on Xen>=4.5 because of libxl_vcpu_setaffinity() (Dario Faggioli)
- Add PKG_CONFIG_PATH to run.in script. (Daniel P. Berrange)
- Change 'interface' to 'iface' in virNetworkDHCPLease (Daniel P. Berrange)
- Fix shadowed variable with older gcc (Ján Tomko)
- Add pkg-config files to allow deps to build against source tree (Daniel P. Berrange)
- Add pkg-config files for libvirt-qemu & libvirt-lxc (Daniel P. Berrange)
- blockjob: avoid compiler uncertainty in info sizing (Eric Blake)
- build: prefer -fstack-protector-strong to -all (Ján Tomko)
- build: remove ssp-buffer-size (Ján Tomko)
- build: remove duplicit warning suppression (Ján Tomko)
- virnetdev: Use ifname in virNetDevGetLinkInfo (Michal Privoznik)
- Fix virbitmaptest on 32-bit (Ján Tomko)
- translations: Don't leave default template fields in .po files (Martin Kletzander)
- tests: Build virstoragetest only when storage driver is compiled too (Peter Krempa)
- Fix build on freebsd (Pavel Hrdina)
Bug Fixes:
- qemu: copy: Accept 'format' parameter when copying to a non-existing img (Peter Krempa)
- storage: gluster: Fix header reader function (Peter Krempa)
- conf: storage: Add volume feature formatter for gluster pools (Peter Krempa)
- vboxsnapshotxmltest: Don't write to a file in abs_srcdir (Michal Privoznik)
- securityselinuxlabeltest: Don't create dummy file in the srcdir (Michal Privoznik)
- Report one error less when getting net dev speed (Ján Tomko)
- Only detect PCI Express devices as root in udev nodedev driver (Ján Tomko)
- libxl: add PV console if not explicitly specified (Jim Fehlig)
- qemu: snapshot: Save persistent domain config when taking external snapshot (Peter Krempa)
- bhyve: fix build by fixing typo in variable name (Roman Bogorodskiy)
- docs: publish correct enum values (Eric Blake)
- qemu: fix guestfwd chardev option back how it was (Martin Kletzander)
- Fix typo s/SASL_CONF_DIR/SASL_CONF_PATH/ in QEMU VNC code (Daniel P. Berrange)
- qemu: blockcopy: Don't remove existing disk mirror info (Peter Krempa)
- bridge: leases: Fix potential crash caused by use after free (Peter Krempa)
- Free DHCP leases file in networkGetDHCPLeasesHelper (Ján Tomko)
- Rework remoteSerializeDHCPLease (Ján Tomko)
- Free file header in virStorageFileGetMetadataRecurse (Ján Tomko)
- graphics: remember graphics not auto allocated ports (Giuseppe Scrivano)
- LXC: trivially support flag VIR_DRV_FEATURE_TYPED_PARAM_STRING (Chen Hanxiao)
- cmdFreepages: initialize @tmp (Michal Privoznik)
- Fix closedir usage in virNumaGetPages (Roman Bogorodskiy)
- Don't include @LIBS@ in libvirt.pc.in file (Daniel P. Berrange)
- virnuma: Actually build huge page code (Michal Privoznik)
- Do not call closedir with NULL argument (Ján Tomko)
- Fix invalid write in virNumaGetDistances (Ján Tomko)
- Properly check the return value of CCWAddressAsString (Ján Tomko)
- virsh: fix broken code in freepages (Eric Blake)
- Fix xmconfigtest (Jim Fehlig)
- vbox_snapshot_conf: fix wrong use of 'xmlSaveFormatFileEnc' (Pavel Hrdina)
- tests: fix vbox snapshot xmls (Pavel Hrdina)
- vbox: fix a segfault when taking a snapshot (Yohan BELLEGUIC)
- vbox: snapshot: Avoid memleaks in functions dealing with disk arrays (Peter Krempa)
- vbox: snapshot: Avoid memleak in virVBoxSnapshotConfAllChildren (Peter Krempa)
- uuid: Fix coverity warning of unchecked return value (Peter Krempa)
- network: bridge: Avoid freeing uninitialized pointer on cleanup path (Peter Krempa)
- net: leaseshelper: Refactor copying of old entries to avoid double free (Peter Krempa)
- net: leaseshelper: Ignore corrupted lease file and rewrite it (Peter Krempa)
- net: leaseshelper: Don't crash if DNSMASQ doesn't provide lease expiry (Peter Krempa)
- blockjob: don't remove older-style mirror XML (Eric Blake)
- blockcommit: require base below top (Eric Blake)
- leaseshelper: fix another crash (Pavel Hrdina)
- bhyve: do not cleanup unallocated networks on fail (Roman Bogorodskiy)
- bhyve: fix crash in bhyveBuildNetArgStr (Roman Bogorodskiy)
- storage: report VIR_ERR_NO_STORAGE_VOL when the file doesn't exist (Giuseppe Scrivano)
- blockcommit: fix regression with explicit top argument (Eric Blake)
- virsh: forbid negative vcpu argument to vcpupin (Jincheng Miao)
- Fix crash when saving a domain with type none dac label (Ján Tomko)
- vbox_snapshot_conf: Resolve Coverity warnings (John Ferlan)
- vbox_temp: Resolve Coverity warnings (John Ferlan)
- libxl: Resolve Coverity warnings (John Ferlan)
- leaseshelper: fix crash (Pavel Hrdina)
- qemu: Properly label FDs when restoring domain with static label (Shivaprasad G Bhat)
- nodeinfo: avoid uninitialized variable on error (Eric Blake)
- storage: fix memory leak with encrypted images (Eric Blake)
- vbox: fix compilation error (Roman Bogorodskiy)
- SELinux: don't fail silently when no label is present (Ján Tomko)
- parallels: Avoid possible leak of "cpu" from parallelsBuildCapabilities (Peter Krempa)
- Fix storage format probing (Ján Tomko)
- network: bridge: Avoid memory leak from networkBuildDhcpDaemonCommandLine (Peter Krempa)
- qemu: monitor: Fix type of holdtime argument in qemuMonitorJSONSendKey (Peter Krempa)
- libxl: Avoid possible use of uninitialized mem in libxlDomainStart (Daniel P. Berrange)
- qemu: Remove character device backend only after frontend is gone (Jiri Denemark)
- qemu: Remove disk backend only after frontend is gone (Jiri Denemark)
- qemu: Remove interface backend only after frontend is gone (Jiri Denemark)
- Don't use AI_ADDRCONFIG when binding to wildcard addresses (Ján Tomko)
- qemu: Unref cfg when detaching hostdev interface (Jiri Denemark)
- virsh: Check whether found volume is member of the specified storage pool (Peter Krempa)
Improvements:
- Introduce virFileReadAllQuiet (Ján Tomko)
- Track privileged state in udev nodedev driver (Ján Tomko)
- build: fix 'make syntax-check' after commit c6cf5df3 (Jim Fehlig)
- LXC: throw an error if we failed to get Idmap elements (Chen Hanxiao)
- cpu: Add new Broadwell CPU model (Jiri Denemark)
- net: merge virNetworkGetDHCPLeases and virNetworkGetDHCPLeasesForMAC (Peter Krempa)
- Add test for type none model dac seclabel (Ján Tomko)
- test: add user_xattr check for securityselinuxlabeltest (Jincheng Miao)
- libxl: detect support for save and restore (Jim Fehlig)
- security: nop: Avoid very long lines (Peter Krempa)
- security: Fix header formatting of a few functions (Peter Krempa)
- security: manager: Unify function header format (Peter Krempa)
- security: manager: Avoid forward decl of virSecurityManagerDispose (Peter Krempa)
- security: Rename virSecurityManagerRestoreImageLabel to *Disk* (Peter Krempa)
- util: s/virStorageSourceClearBackingStore/virStorageSourceBackingStoreClear (Peter Krempa)
- Fix a typo in a localized string (Daniel Veillard)
- virConnectCompareCPU: Introduce FAIL_INCOMPATIBLE flag (Jiri Denemark)
- cpuCompare*: Add support for reporting failure on incompatible CPUs (Jiri Denemark)
- cpu: Cleanup coding style in generic CPU driver (Jiri Denemark)
- virsh: Remove bogus stat on log file (Jiri Denemark)
- enhance hostdev mode 'capabilities' process (Jincheng Miao)
- storage: Don't store parent directory of an image explicitly (Peter Krempa)
- storage: Don't canonicalize paths unnecessarily (Peter Krempa)
- tests: virstoragetest: Remove unneeded relative test plumbing (Peter Krempa)
- tests: virstoragetest: Don't test relative start of backing chains (Peter Krempa)
- util: storage: Remove now redundant backingRelative from virStorageSource (Peter Krempa)
- tests: virstoragetest: Remove now unused pathAbs (Peter Krempa)
- storage: Store relative path only for relatively backed storage (Peter Krempa)
- tests: virstoragetest: Remove "expBackingStore" field (Peter Krempa)
- util: storage: Add helper to resolve relative path difference (Peter Krempa)
- LXC: check whether we get MemSwap[Total|Usage] (Chen Hanxiao)
- qemu: enum cleanups in "src/qemu/*" (Julio Faracco)
- libxl: fix version annotation of migration functions (Jim Fehlig)
- virtportallocator: new function "virPortAllocatorSetUsed" (Giuseppe Scrivano)
- net-dhcp-leases: Add virsh support (Nehal J Wani)
- net-dhcp-leases: Private implementation inside network (Nehal J Wani)
- net-dhcp-leases: Implement the remote protocol (Nehal J Wani)
- net-dhcp-leases: Implement the public APIs (Nehal J Wani)
- virNumaGetPages: Don't fail on huge page-less systems (Michal Privoznik)
- virNumaGetPageInfo: Take huge pages into account (Michal Privoznik)
- storage: gluster: Avoid name shadow on older compilers (Peter Krempa)
- storage: gluster: Add backend to return unique storage file path (Peter Krempa)
- util: storagefile: Introduce universal function to canonicalize paths (Peter Krempa)
- util: string: Add helper to free non-NULL terminated string arrays (Peter Krempa)
- libxl: prefer qdisk for <driver name='file'> (Jim Fehlig)
- qemu: parse -device virtio-balloon (Laine Stump)
- Report correct error in virNetDevTapCreate (Ján Tomko)
- util: numa: Stub out hugepage code on non-Linux platforms (Peter Krempa)
- util: numa: Catch readdir errors in virNumaGetPages (Peter Krempa)
- tests: Fix syntax-check after cdd11151791bc9e61538988438980f41c0185681 (Peter Krempa)
- test: Disable storage test when FS backend isn't compiled in (Peter Krempa)
- Split out CCW address allocation (Ján Tomko)
- libxl: Use cooperative resume for migration (Jason Andryuk)
- cpu_arm: Support all ARM processors we know about (Michal Privoznik)
- virNodeParseSocket: Take ARM into account (Michal Privoznik)
- nodeinfotest: Print error if cpuinfo file can't be opened (Michal Privoznik)
- virNodeParseNode: Propagate host architecture (Michal Privoznik)
- nodeinfo: Introduce @arch to linuxNodeInfoCPUPopulate (Michal Privoznik)
- interface: clean up virInterfaceDefDevFormat (Laine Stump)
- interface: clean up virInterfaceDefParseXML (Laine Stump)
- interface: move parsing of bridge attributes into appropriate function (Laine Stump)
- interface: report link state for bonds and vlans too (Laine Stump)
- security: Rename virSecurityManagerSetImageLabel to *Disk* (Peter Krempa)
- security: Sanitize type of @migrated in virSecurityManagerRestoreAllLabel (Peter Krempa)
- util: Don't require full disk definition when getting imagelabels (Peter Krempa)
- util: storagefile: Introduce helper to free storage source perms (Peter Krempa)
- util: seclabel: Add deep copy function for device labels (Peter Krempa)
- storage: encryption: Add deep copy function for storage encryption (Peter Krempa)
- libxl: limit support for specifying an interface script (Jim Fehlig)
- libxl: support interface type=network (Jim Fehlig)
- interface: allow reordering of elements in xml (Laine Stump)
- nodeinfo: Implement nodeGetFreePages (Michal Privoznik)
- virsh: Expose virNodeGetFreePages (Michal Privoznik)
- Introduce virNodeGetFreePages (Michal Privoznik)
- virCaps: expose pages info (Michal Privoznik)
- virnuma: Introduce pages helpers (Michal Privoznik)
- nodeinfo: Rename nodeGetFreeMemory to nodeGetMemory (Michal Privoznik)
- virnuma: Introduce virNumaNodeIsAvailable (Michal Privoznik)
- virsh: expose new active commit controls (Eric Blake)
- blockjob: use stable disk string in job event (Eric Blake)
- xen: handle root= in xen-xm configuration files. (Ian Campbell)
- virt-aa-helper: allow access to /dev/vhost-net if needed (Serge Hallyn)
- util: json: Add helpers for manipulating json arrays (Peter Krempa)
- util: json: Unify function header formatting (Peter Krempa)
- Increase the size of REMOTE_MIGRATE_COOKIE_MAX to REMOTE_STRING_MAX (Shivaprasad G Bhat)
- nodedev: Introduce <pci-express/> to PCI devices (Michal Privoznik)
- virpci: Introduce virPCIDeviceIsPCIExpress and friends (Michal Privoznik)
- storage: better tests of lookup (Eric Blake)
- storage: renumber lookup tests (Eric Blake)
- storage: add alias for less typing (Eric Blake)
- qemu: snapshot: Don't mark all block disks for metadata reuse (Peter Krempa)
- bhyve: silent destroy command errors on cleanup (Roman Bogorodskiy)
- bhyve: implement PCI address allocation (Roman Bogorodskiy)
- virNetDevGetLinkInfo: Don't report link speed if NIC's not up (Michal Privoznik)
- tests: virstoragetest: Fix output when hitting errors (Peter Krempa)
- blockcommit: update error messages related to block jobs (Eric Blake)
- virsh: improve blockcopy UI (Eric Blake)
- virNodeDevCapPCIDevParseXML: Initialize numa_node variable (Michal Privoznik)
- virsh: Reject negative numbers in vshCommandOptULongLong (Peter Krempa)
- virsh: Reject negative numbers in vshCommandOptUL (Peter Krempa)
- virsh: Reject negative numbers in vshCommandOptUInt (Peter Krempa)
- security: Don't skip labelling for network disks (Peter Krempa)
- storage: volume: Rework lookup of volume objects (Peter Krempa)
- storage: Clean up unlocking of storage pool objects (Peter Krempa)
- storage: pool: Fix handling of errors on pool lookup failure (Peter Krempa)
- virsh: include bhyve in virsh -V output (Roman Bogorodskiy)
- maint: exempt graphic binaries from syntax check (Eric Blake)
- vmware: make version parsing more robust (Jean-Baptiste Rouault)
- node_device: Expose link state & speed (Michal Privoznik)
- interface_backend_udev: Implement link speed & state (Michal Privoznik)
- virnetdev: Introduce virNetDevGetLinkInfo (Michal Privoznik)
- virInterface: Expose link state & speed (Michal Privoznik)
- vbox_tmpl.c: Add function for undefining snapshot (Yohan BELLEGUIC)
- vbox_tmpl.c: Patch for redefining snapshots (Yohan BELLEGUIC)
- Add vbox_snapshot_conf struct (Yohan BELLEGUIC)
- vbox_tmpl.c: Better XML description for snapshots (Manuel VIVES)
- qemu: ignore -nodefconfig and -nodefaults when parsing commandline (Laine Stump)
- test: display qemuParseCommandline warnings when VIR_TEST_DEBUG > 0 (Laine Stump)
- m4: bhyve: Fix check for the required bhyve programs (Peter Krempa)
- vmx: Relax virtualHW.version check (Matthias Bolte)
- conf: alter disk mirror xml output (Eric Blake)
- conf: store mirroring information in virStorageSource (Eric Blake)
- conf: store disk source as pointer, for easier manipulation (Eric Blake)
- conf: consolidate disk def allocation (Eric Blake)
- conf: store snapshot source as pointer, for easier manipulation (Eric Blake)
- nodedev: Export NUMA node locality for PCI devices (Michal Privoznik)
- Implement pretty flag for vcpuinfo and nodecpumap (Ján Tomko)
- Introduce virBitmapDataToString (Ján Tomko)
- Always report an error if virBitmapFormat fails (Ján Tomko)
- Format NULL bitmap as an empty string (Ján Tomko)
- virsh: Separate API calls and result printing in cmdVcpuinfo (Ján Tomko)
- virsh: Invert logic in cmdVcpuinfo (Ján Tomko)
- Parallels: Include CPU info in the capabilities XML (Alexander Burluka)
- Parallels: add connectBaselineCPU() (Alexander Burluka)
- Parallels: add domainGetVcpus() (Alexander Burluka)
- maint: prohibit empty first lines (Martin Kletzander)
- Remove unnecessary empty first lines (Martin Kletzander)
- Simplify conditions in virStorageBackendProbeTarget (Ján Tomko)
- Don't reuse 'ret' variable in virStorageBackendProbeTarget (Ján Tomko)
- vircaps2xmltest: Introduce basic testing (Michal Privoznik)
- libxl: introduce libxlDomainDefCheckABIStability (Jim Fehlig)
- maint: detect VPATH builds when checking for gnulib update (Eric Blake)
- maint: optimize locale.h syntax check (Eric Blake)
- virnuma: Check for numa_bitmask_isbitset presence (Michal Privoznik)
- cfg.mk: Introduce rule for setlocale() (Michal Privoznik)
- virnuma: Implement virNumaGetDistances stub for non-NUMA (Michal Privoznik)
- virCaps: Expose distance between host NUMA nodes (Michal Privoznik)
- virnuma: Introduce virNumaGetDistances (Michal Privoznik)
- tests: monitor: json: Fix error message when returning json in json (Peter Krempa)
- libxl: Move virDomainXMLOptionNew into libxlCreateXMLConf (Daniel P. Berrange)
- libxl: Don't pass libxlDriverPrivatePtr into libxlBuildDomainConfig (Daniel P. Berrange)
- libxl: Don't pass virDomainObjPtr to libxlBuildDomainConfig (Daniel P. Berrange)
- qemu: Return in from qemuDomainRemove*Device (Jiri Denemark)
- tests: storagetest: Unify and reformat storage chain format string (Peter Krempa)
- qemu: json: Add format strings for optional command arguments (Peter Krempa)
- util: string: Return element count from virStringSplit (Peter Krempa)
- storage: Traverse backing chains of network disks (Peter Krempa)
- storage: Change to new backing store parser (Peter Krempa)
- storage: Add infrastructure to parse remote network backing names (Peter Krempa)
- storage: Switch metadata crawler to use storage driver file access check (Peter Krempa)
- storage: Switch metadata crawler to use storage driver to read headers (Peter Krempa)
- storage: Switch metadata crawler to use storage driver to get unique path (Peter Krempa)
- storage: backend: Add possibility to suppress errors from backend lookup (Peter Krempa)
- test: storage: Initialize storage source to correct type (Peter Krempa)
- storage: Determine the local storage type right away (Peter Krempa)
- storage: Move virStorageFileGetMetadata to the storage driver (Peter Krempa)
- storage: Add API to check accessibility of storage volumes (Peter Krempa)
- storage: backend: Add unique id retrieval API (Peter Krempa)
- xenapi_utils: Adapt to enum cleanups (Michal Privoznik)
- virnuma.c: Fix some comments (Michal Privoznik)
- conf: more enum cleanups in "src/conf/domain_conf.h" (Julio Faracco)
- conf: enum cleanups in "src/conf/domain_conf.h" (Julio Faracco)
- cpu: use typedefs for enums in "src/cpu/cpu_map.h" (Julio Faracco)
- virsh-nodedev: Avoid spurious errors (Michal Privoznik)
- qemu: Process DEVICE_DELETED event in a separate thread (Jiri Denemark)
- qemu: Finish device removal in the original thread (Jiri Denemark)
- Add helper program to create custom leases (Nehal J Wani)
Cleanups:
- Remove redundant docs from libvirt.h (Jiri Denemark)
- conf: whitespace tweak (Chen Fan)
So thanks everybody for your contributions to this release and the
python one, be it with reports, patches, documentation etc ...
Enjoy !
Daniel
--
Daniel Veillard | Open Source and Standards, Red Hat
veillard(a)redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
10 years, 4 months
[libvirt] [PATCHv3] Add invariant TSC cpu flag
by Ján Tomko
Add suport for invariant TSC flag (CPUID 0x80000007, bit 8 of EDX).
If this flag is enabled, the TSC ticks at a constant rate across
all ACPI P-, C- and T-states.
This can be enabled by adding:
<feature name='invtsc'/>
to the <cpu> element.
Migration and saving the domain does not work with this flag.
QEMU support for this is not merged yet:
https://lists.gnu.org/archive/html/qemu-devel/2014-04/msg05024.html
The feature name "invtsc" differs from the name "" used by the linux kernel:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch...
---
v1: https://www.redhat.com/archives/libvir-list/2014-May/msg00183.html
v2: https://www.redhat.com/archives/libvir-list/2014-May/msg00297.html
add it as a cpu flag instead of a timer
v3:
check if the feature wasn't filtered out on domain startup
src/cpu/cpu_map.xml | 5 +++++
src/qemu/qemu_migration.c | 14 ++++++++++++++
src/qemu/qemu_process.c | 15 +++++++++++++++
3 files changed, 34 insertions(+)
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index 7d34d40..ffaeb92 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -327,6 +327,11 @@
<cpuid function='0x00000007' ebx='0x00100000'/>
</feature>
+ <!-- Advanced Power Management edx features -->
+ <feature name='invtsc'>
+ <cpuid function='0x80000007' edx='0x00000100'/>
+ </feature>
+
<!-- models -->
<model name='486'>
<feature name='fpu'/>
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index f0df1a6..7504a38 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1513,6 +1513,20 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr vm,
return false;
}
+ for (i = 0; i < def->cpu->nfeatures; i++) {
+ virCPUFeatureDefPtr feature = &def->cpu->features[i];
+
+ if (feature->policy != VIR_CPU_FEATURE_REQUIRE)
+ continue;
+
+ if (STREQ(feature->name, "invtsc")) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("domain has CPU feature: %s"),
+ feature->name);
+ return false;
+ }
+ }
+
return true;
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index a83780f..0824afe 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3568,6 +3568,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, virDomainObjPtr vm)
qemuDomainObjPrivatePtr priv = vm->privateData;
int rc;
bool ret = false;
+ size_t i;
switch (arch) {
case VIR_ARCH_I686:
@@ -3590,6 +3591,20 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, virDomainObjPtr vm)
goto cleanup;
}
}
+
+ for (i = 0; i < def->cpu->nfeatures; i++) {
+ virCPUFeatureDefPtr feature = &def->cpu->features[i];
+
+ if (feature->policy != VIR_CPU_FEATURE_REQUIRE)
+ continue;
+
+ if (STREQ(feature->name, "invtsc") &&
+ !cpuHasFeature(guestcpu, feature->name)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("host doesn't support invariant TSC"));
+ goto cleanup;
+ }
+ }
break;
default:
--
1.8.3.2
10 years, 4 months
[libvirt] [PATCH] qemu: Add cmd_per_lun, max_sectors to virtio-scsi
by Mike Perez
This introduces two new attributes "cmd_per_lun" and "max_sectors" same
with the names QEMU uses for virtio-scsi. An example of the XML:
<controller type='scsi' index='0' model='virtio-scsi' cmd_per_lun='50'
max_sectors='512'/>
The corresponding QEMU command line:
-device virtio-scsi-pci,id=scsi0,cmd_per_lun=50,max_sectors=512,
bus=pci.0,addr=0x3
Signed-off-by: Mike Perez <thingee(a)gmail.com>
---
docs/formatdomain.html.in | 29 +++++++++++++++++++---
docs/schemas/domaincommon.rng | 10 ++++++++
src/conf/domain_conf.c | 27 ++++++++++++++++++--
src/conf/domain_conf.h | 2 ++
src/qemu/qemu_command.c | 27 ++++++++++++++++----
.../qemuxml2argv-disk-virtio-scsi-cmd_per_lun.args | 9 +++++++
.../qemuxml2argv-disk-virtio-scsi-cmd_per_lun.xml | 29 ++++++++++++++++++++++
.../qemuxml2argv-disk-virtio-scsi-max_sectors.args | 9 +++++++
.../qemuxml2argv-disk-virtio-scsi-max_sectors.xml | 29 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 6 +++++
tests/qemuxml2xmltest.c | 2 ++
11 files changed, 168 insertions(+), 11 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 691a451..8ffb247 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2559,11 +2559,32 @@
<p>
An optional sub-element <code>driver</code> can specify the driver
- specific options. Currently it only supports attribute <code>queues</code>
- (<span class="since">1.0.5</span>, QEMU and KVM only), which specifies the
- number of queues for the controller. For best performance, it's recommended
- to specify a value matching the number of vCPUs.
+ specific options:
</p>
+ <dl>
+ <dt><code>queues</code></dt>
+ <dd>
+ The optional <code>queues</code> attribute specifies the number of
+ queues for the controller. For best performance, it's recommended to
+ specify a value matching the number of vCPUs.
+ <span class="since">Since 1.0.5 (QEMU and KVM only)</span>
+ </dd>
+ <dt><code>cmd_per_lun</code></dt>
+ <dd>
+ The optional <code>cmd_per_lun</code> attribute specifies the maximum
+ number of commands that can be queued on devices controlled by the
+ host.
+ <span class="since">Since 1.2.5 (QEMU and KVM only)</span>
+ </dd>
+ <dt><code>max_sectors</code></dt>
+ <dd>
+ The optional <code>max_sectors</code> attribute specifies the maximum
+ amount of data in bytes that will be transferred to or from the device
+ in a single command. The transfer length is measured in sectors, where
+ a sector is 512 bytes.
+ <span class="since">Since 1.2.5 (QEMU and KVM only)</span>
+ </dd>
+ </dl>
<p>
USB companion controllers have an optional
sub-element <code><master></code> to specify the exact
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 4249ed5..4bf4699 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1735,6 +1735,16 @@
<ref name="unsignedInt"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="cmd_per_lun">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="max_sectors">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
</element>
</optional>
</interleave>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 40c385e..4388cb8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6041,6 +6041,8 @@ virDomainControllerDefParseXML(xmlNodePtr node,
char *idx = NULL;
char *model = NULL;
char *queues = NULL;
+ char *cmd_per_lun = NULL;
+ char *max_sectors = NULL;
xmlNodePtr saved = ctxt->node;
int rc;
@@ -6084,6 +6086,8 @@ virDomainControllerDefParseXML(xmlNodePtr node,
if (cur->type == XML_ELEMENT_NODE) {
if (xmlStrEqual(cur->name, BAD_CAST "driver"))
queues = virXMLPropString(cur, "queues");
+ cmd_per_lun = virXMLPropString(cur, "cmd_per_lun");
+ max_sectors = virXMLPropString(cur, "max_sectors");
}
cur = cur->next;
}
@@ -6094,6 +6098,17 @@ virDomainControllerDefParseXML(xmlNodePtr node,
goto error;
}
+ if (cmd_per_lun && virStrToLong_ui(cmd_per_lun, NULL, 10, &def->cmd_per_lun) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Malformed 'cmd_per_lun' value '%s'"), cmd_per_lun);
+ goto error;
+ }
+
+ if (max_sectors && virStrToLong_ui(max_sectors, NULL, 10, &def->max_sectors) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Malformed 'max_sectors' value %s'"), max_sectors);
+ }
+
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
goto error;
@@ -6201,6 +6216,8 @@ virDomainControllerDefParseXML(xmlNodePtr node,
VIR_FREE(idx);
VIR_FREE(model);
VIR_FREE(queues);
+ VIR_FREE(cmd_per_lun);
+ VIR_FREE(max_sectors);
return def;
@@ -15279,13 +15296,19 @@ virDomainControllerDefFormat(virBufferPtr buf,
break;
}
- if (def->queues || virDomainDeviceInfoIsSet(&def->info, flags) ||
- pcihole64) {
+ if (def->queues || def->cmd_per_lun || def->max_sectors ||
+ virDomainDeviceInfoIsSet(&def->info, flags) || pcihole64) {
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
if (def->queues)
virBufferAsprintf(buf, "<driver queues='%u'/>\n", def->queues);
+ if (def->cmd_per_lun)
+ virBufferAsprintf(buf, "<driver cmd_per_lun='%u'/>\n", def->cmd_per_lun);
+
+ if (def->max_sectors)
+ virBufferAsprintf(buf, "<driver max_sectors='%u'/>\n", def->max_sectors);
+
if (virDomainDeviceInfoIsSet(&def->info, flags) &&
virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
return -1;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index bde303c..66484a1 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -720,6 +720,8 @@ struct _virDomainControllerDef {
unsigned int idx;
int model; /* -1 == undef */
unsigned int queues;
+ unsigned int cmd_per_lun;
+ unsigned int max_sectors;
union {
virDomainVirtioSerialOpts vioserial;
virDomainPCIControllerOpts pciopts;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 193959f..5274d17 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4236,12 +4236,23 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
virBuffer buf = VIR_BUFFER_INITIALIZER;
int model;
- if (def->queues &&
- !(def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
+ if (!(def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
def->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("'queues' is only supported by virtio-scsi controller"));
- return NULL;
+ if (def->queues) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("'queues' is only supported by virtio-scsi controller"));
+ return NULL;
+ }
+ if (def->cmd_per_lun) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("'cmd_per_lun' is only supported by virtio-scsi controller"));
+ return NULL;
+ }
+ if (def->max_sectors) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("'max_sectors' is only supported by virtio-scsi controller"));
+ return NULL;
+ }
}
switch (def->type) {
@@ -4369,6 +4380,12 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
if (def->queues)
virBufferAsprintf(&buf, ",num_queues=%u", def->queues);
+ if (def->cmd_per_lun)
+ virBufferAsprintf(&buf, ",cmd_per_lun=%u", def->cmd_per_lun);
+
+ if (def->max_sectors)
+ virBufferAsprintf(&buf, ",max_sectors=%u", def->max_sectors);
+
if (qemuBuildDeviceAddressStr(&buf, domainDef, &def->info, qemuCaps) < 0)
goto error;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.args
new file mode 100644
index 0000000..2c75790
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.args
@@ -0,0 +1,9 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 214 -smp 8 -nographic -nodefconfig -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-device virtio-scsi-pci,id=scsi0,cmd_per_lun=50,bus=pci.0,addr=0x3 \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-scsi0-0-0-0 \
+-device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\
+drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.xml
new file mode 100644
index 0000000..615a7f5
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-cmd_per_lun.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>8</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='sdb' bus='scsi'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='scsi' index='0' model='virtio-scsi'>
+ <driver cmd_per_lun='50'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.args
new file mode 100644
index 0000000..895f379
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.args
@@ -0,0 +1,9 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 214 -smp 8 -nographic -nodefconfig -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-device virtio-scsi-pci,id=scsi0,max_sectors=512,bus=pci.0,addr=0x3 \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-scsi0-0-0-0 \
+-device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\
+drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.xml
new file mode 100644
index 0000000..cd7d4a7
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-virtio-scsi-max_sectors.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>8</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='sdb' bus='scsi'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='scsi' index='0' model='virtio-scsi'>
+ <driver max_sectors='512'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1ea7bf8..8ebb202 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -807,6 +807,12 @@ mymain(void)
DO_TEST("disk-virtio-scsi-num_queues",
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_VIRTIO_SCSI);
+ DO_TEST("disk-virtio-scsi-cmd_per_lun",
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
+ QEMU_CAPS_VIRTIO_SCSI);
+ DO_TEST("disk-virtio-scsi-max_sectors",
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
+ QEMU_CAPS_VIRTIO_SCSI);
DO_TEST("disk-scsi-megasas",
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_SCSI_MEGASAS);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index da528da..73c4ff1 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -223,6 +223,8 @@ mymain(void)
DO_TEST("disk-scsi-vscsi");
DO_TEST("disk-scsi-virtio-scsi");
DO_TEST("disk-virtio-scsi-num_queues");
+ DO_TEST("disk-virtio-scsi-cmd_per_lun");
+ DO_TEST("disk-virtio-scsi-max_sectors");
DO_TEST("disk-scsi-megasas");
DO_TEST_FULL("disk-mirror", false, WHEN_ACTIVE);
DO_TEST_FULL("disk-mirror", true, WHEN_INACTIVE);
--
1.9.1
10 years, 4 months
[libvirt] [PATCH] util: unify extra asterisk in viralloc.h
by Martin Kletzander
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Notes:
Pushed as trivial.
src/util/viralloc.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index 55372e5..7125e67 100644
--- a/src/util/viralloc.h
+++ b/src/util/viralloc.h
@@ -1,7 +1,7 @@
/*
* viralloc.h: safer memory allocation
*
- * Copyright (C) 2010-2013 Red Hat, Inc.
+ * Copyright (C) 2010-2014 Red Hat, Inc.
* Copyright (C) 2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -279,7 +279,7 @@ void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1);
# define VIR_SHRINK_N(ptr, count, remove) \
virShrinkN(&(ptr), sizeof(*(ptr)), &(count), remove)
-/*
+/**
* VIR_TYPEMATCH:
*
* The following macro seems a bit cryptic, so it needs a thorough
@@ -481,7 +481,7 @@ void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1);
# define VIR_DELETE_ELEMENT_INPLACE(ptr, at, count) \
virDeleteElementsN(&(ptr), sizeof(*(ptr)), at, &(count), 1, true)
-/*
+/**
* VIR_ALLOC_VAR_OVERSIZED:
* @M: size of base structure
* @N: number of array elements in trailing array
--
2.0.0
10 years, 4 months
[libvirt] [PATCH for 1.2.6] qemu: copy: Accept 'format' parameter when copying to a non-existing img
by Peter Krempa
We have the following matrix of possible arguments handled by the logic
statement touched by this patch:
| flags & _REUSE_EXT | !(flags & _REUSE_EXT)
-------+--------------------+----------------------
format| (1) | (2)
-------+--------------------+----------------------
!format| (3) | (4)
-------+--------------------+----------------------
In cases 1 and 2 the user provided a format, in cases 3 and 4 not. The
user requests to use a pre-existing image in 1 and 3 and libvirt shall
create a new image in 2 and 4.
The difference between cases 3 and 4 is that for 3 the format is probed
from the user-provided image, whereas in 4 we just use the existing disk
format.
The current code would treat cases 1,3 and 4 correctly but in case 2 the
format provided by the user would be ignored.
The particular piece of code was broken in commit 35c7701c64508f975dfeb8
but since it was introduced a few commits before that it was never
released as working.
---
src/qemu/qemu_driver.c | 37 +++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 775f6ab..d45a161 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15356,29 +15356,34 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
/* XXX Allow non-file mirror destinations */
mirror->type = VIR_STORAGE_TYPE_FILE;
+ if (format) {
+ if ((mirror->format = virStorageFileFormatTypeFromString(format)) <= 0) {
+ virReportError(VIR_ERR_INVALID_ARG, _("unrecognized format '%s'"),
+ format);
+ goto endjob;
+ }
+ } else {
+ if (!(flags & VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT)) {
+ mirror->format = disk->src->format;
+ } else {
+ /* If the user passed the REUSE_EXT flag, then either they
+ * also passed the RAW flag (and format is non-NULL), or it is
+ * safe for us to probe the format from the file that we will
+ * be using. */
+ mirror->format = virStorageFileProbeFormat(dest, cfg->user,
+ cfg->group);
+ }
+ }
+
+ /* pre-create the image file */
if (!(flags & VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT)) {
int fd = qemuOpenFile(driver, vm, dest, O_WRONLY | O_TRUNC | O_CREAT,
&need_unlink, NULL);
if (fd < 0)
goto endjob;
VIR_FORCE_CLOSE(fd);
- if (!format)
- mirror->format = disk->src->format;
- } else if (format) {
- mirror->format = virStorageFileFormatTypeFromString(format);
- if (mirror->format <= 0) {
- virReportError(VIR_ERR_INVALID_ARG, _("unrecognized format '%s'"),
- format);
- goto endjob;
- }
- } else {
- /* If the user passed the REUSE_EXT flag, then either they
- * also passed the RAW flag (and format is non-NULL), or it is
- * safe for us to probe the format from the file that we will
- * be using. */
- mirror->format = virStorageFileProbeFormat(dest, cfg->user,
- cfg->group);
}
+
if (!format && mirror->format > 0)
format = virStorageFileFormatTypeToString(mirror->format);
if (VIR_STRDUP(mirror->path, dest) < 0)
--
1.9.3
10 years, 4 months
[libvirt] [PATCH 0/2] Gluster: tweak two small issues
by Peter Krempa
Peter Krempa (2):
conf: storage: Add volume feature formatter for gluster pools
storage: gluster: Fix header reader function
src/conf/storage_conf.c | 2 ++
src/storage/storage_backend_gluster.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
--
1.9.3
10 years, 4 months
[libvirt] odd message from latest libvirt.git
by Eric Blake
# ./run daemon/libvirtd
2014-07-01 04:27:19.913+0000: 1160: info : libvirt version: 1.2.6
2014-07-01 04:27:19.913+0000: 1160: error : virFileReadAll:1297 : Failed
to read file '/sys/class/net/wlp3s0/speed': Invalid argument
This is probably a kernel bug in Fedora 20; but we shouldn't be
polluting the logs just because of the kernel being unable to read a
file that it claims exists:
# ls -l /sys/class/net/wlp3s0/speed
-r--r--r--. 1 root root 4096 Jun 28 07:41 /sys/class/net/wlp3s0/speed
# cat /sys/class/net/wlp3s0/speed
cat: /sys/class/net/wlp3s0/speed: Invalid argument
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
10 years, 4 months
[libvirt] [PATCH v1.2.[1-5]-maint] qemu: blockcopy: Don't remove existing disk mirror info
by Eric Blake
From: Peter Krempa <pkrempa(a)redhat.com>
When creating a new disk mirror the new struct is stored in a separate
variable until everything went well. The removed hunk would actually
remove existing mirror information for example when the api would be run
if a mirror still exists.
(cherry picked from commit 02b364e186d487f54ed410c01af042f23e812d42)
This fixes a regression introduced in commit ff5f30b.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
Conflicts:
src/qemu/qemu_driver.c - no refactoring of commit 7b7bf001
---
As Peter's patch resolves a regression, I'd like to backport it to
the maint branches; however, that means redoing the patch.
src/qemu/qemu_driver.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 59185c6..591864f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15203,6 +15203,7 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
struct stat st;
bool need_unlink = false;
char *mirror = NULL;
+ int mirrorFormat;
virQEMUDriverConfigPtr cfg = NULL;
/* Preliminaries: find the disk we are editing, sanity checks */
@@ -15290,10 +15291,10 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
goto endjob;
VIR_FORCE_CLOSE(fd);
if (!format)
- disk->mirrorFormat = disk->src.format;
+ mirrorFormat = disk->src.format;
} else if (format) {
- disk->mirrorFormat = virStorageFileFormatTypeFromString(format);
- if (disk->mirrorFormat <= 0) {
+ mirrorFormat = virStorageFileFormatTypeFromString(format);
+ if (mirrorFormat <= 0) {
virReportError(VIR_ERR_INVALID_ARG, _("unrecognized format '%s'"),
format);
goto endjob;
@@ -15303,11 +15304,11 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
* also passed the RAW flag (and format is non-NULL), or it is
* safe for us to probe the format from the file that we will
* be using. */
- disk->mirrorFormat = virStorageFileProbeFormat(dest, cfg->user,
- cfg->group);
+ mirrorFormat = virStorageFileProbeFormat(dest, cfg->user,
+ cfg->group);
}
- if (!format && disk->mirrorFormat > 0)
- format = virStorageFileFormatTypeToString(disk->mirrorFormat);
+ if (!format && mirrorFormat > 0)
+ format = virStorageFileFormatTypeToString(mirrorFormat);
if (VIR_STRDUP(mirror, dest) < 0)
goto endjob;
@@ -15333,13 +15334,12 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
/* Update vm in place to match changes. */
need_unlink = false;
disk->mirror = mirror;
+ disk->mirrorFormat = mirrorFormat;
mirror = NULL;
endjob:
if (need_unlink && unlink(dest))
VIR_WARN("unable to unlink just-created %s", dest);
- if (ret < 0 && disk)
- disk->mirrorFormat = VIR_STORAGE_FILE_NONE;
VIR_FREE(mirror);
if (!qemuDomainObjEndJob(driver, vm))
vm = NULL;
--
1.9.3
10 years, 4 months