- 16 3月, 2019 1 次提交
-
-
由 Eric Blake 提交于
Checking that the derived class is larger than the requested parent class saves us from some obvious mistakes, but as written, it does not catch all the cases; in particular, it is easy to forget to update a VIR_CLASS_NEW when changing the 'parent' member from virObject to virObjectLockabale, but where the size checks don't catch that. Add a parameter for one more layer of sanity checking. It would be cool if we could get gcc to stringize typeof(parent) into the string name of that type, so that we could confirm that the precise parent class is in use rather than just a struct that happens to have the same size as the parent class. But sizeof checks are better than nothing. Note that I did NOT change the fact that we require derived classes to be larger (as the difference in size makes it easy to tell classes apart), which means that even if a derived class has no functionality to add (but rather exists for compiler-enforced type-safety), it must still include a dummy member. But I did fix the wording of the error message to match the code. Signed-off-by: NEric Blake <eblake@redhat.com> Reviewed-by: NJán Tomko <jtomko@redhat.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
- 15 3月, 2019 19 次提交
-
-
由 Erik Skultety 提交于
By default, qemu user's home dir points to '/' which shouldn't be used at all. We therefore pass the HOME variable from the current variable iff not running as SUID, which means that for systemd we never set it. This patch makes sure, that for system QEMU this is always set to libDir/<driver>, session mode is left untouched. Signed-off-by: NErik Skultety <eskultet@redhat.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
由 Erik Skultety 提交于
For session mode, only XDG_CACHE_HOME is set, because we want to remain integrating with services in user session, but for system mode, this would have become reading/writing to '/' which carries the obvious issue with permissions (also, '/' is the wrong location in 99.9% cases anyway). Signed-off-by: NErik Skultety <eskultet@redhat.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
由 Erik Skultety 提交于
Some modules/libraries within QEMU could make use of the XDG_ vars when writing their data to the disk. Define the most common XDG variables and point them to the specific driver's libDir, i.e. XDG_CACHE_HOME -> /var/lib/libvirt/<driver>/.cache XDG_DATA_HOME -> /var/lib/libvirt/<driver>/.local/share XDG_CONFIG_HOME -> /var/lib/libvirt/<driver>/.config Signed-off-by: NErik Skultety <eskultet@redhat.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
由 Peter Krempa 提交于
The functions do basically exactly the same thing modulo few checks. In case of virtio disks we check that the device is not multifunction as that can't be unplugged at once. In case of USB and SCSI disks we checked that no active block job is running. The check for running blockjobs should have also been done for virtio disks. By moving the multifunction check into the common function we fix this case and also simplify the code. Signed-off-by: NPeter Krempa <pkrempa@redhat.com> Reviewed-by: NJán Tomko <jtomko@redhat.com>
-
由 Peter Krempa 提交于
Signed-off-by: NPeter Krempa <pkrempa@redhat.com> Reviewed-by: NJán Tomko <jtomko@redhat.com>
-
由 Peter Krempa 提交于
Use the correct type in switch and populate the missing cases. Signed-off-by: NPeter Krempa <pkrempa@redhat.com> Reviewed-by: NJán Tomko <jtomko@redhat.com>
-
由 Peter Krempa 提交于
We don't have any cleanup section, we can return the value directly. Signed-off-by: NPeter Krempa <pkrempa@redhat.com> Reviewed-by: NJán Tomko <jtomko@redhat.com>
-
由 Eric Blake 提交于
Based on recent list questions about the proposed addition of virDomainCheckpointCreateXML(REDEFINE), it is worth adding some clarification to the existing snapshot redefine documentation that is serving as the basis for checkpoints. Normal snapshot creation requires very few elements from the user XML (libvirt can pick sane defaults for items that are omitted, and many fields, including <domain>, are documented as readonly output fields ignored on input, produced by drivers that track it). But during REDEFINE, the API wants the complete XML produced by an earlier virDomainSnapshotGetXMLDesc; as the domain definition has likely changed since the snapshot was first created, libvirt is unable to recreate a <domain> sub-element that matches the original output representing the domain state at the time the snapshot was first created. In fact, reverting without a <domain> sub-element is risky enough that we had to add a FORCE flag for virDomainSnapshotRevert(). In short, we only support omitting domain for qemu because of backwards-compatibility to snapshots created before 0.9.5 started capturing <domain>; even though there are other drivers like vbox that do not output <domain> because they have other reliable ways to revert. And based on the confusion caused when omitting <domain> from snapshot XML, the initial design for checkpoints in later patches will make <domain> a mandatory element during its REDEFINE. [Side note: the fact that <domain> can appear in <domainsnapshot> is a reason we cannot add a new API for a bulk listing or redefine of all snapshots of a single domain in one XML call (for example, a 1M <domain> XML * 16 snapshots explodes into 16M in a bulk form, which gets difficult to send over RPC). Perhaps we could add a flag to request that the <domain> sub-element be omitted on output, but such output is no longer suitable for sane REDEFINE input.] Signed-off-by: NEric Blake <eblake@redhat.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
由 Eric Blake 提交于
I had to inspect the code to learn whether a final virObjectUnref() calls ALL dispose callbacks in child-to-parent order (akin to C++ destructors), or whether I manually had to call a parent-class dispose when writing a child class dispose method. The answer is the former. (Thankfully, since VIR_FREE wipes out pointers for safety, even if I had guessed wrong, I probably would not have tripped over a double-free fault when the parent dispose ran for the second time). I also had to read the code to learn if a dispose method was even mandatory (it is not, although getting NULL through VIR_CLASS_NEW requires a macro). While at it, the VIR_CLASS_NEW macro requires that the virObject component at offset 0 be reached through the name 'parent', not 'object'. Signed-off-by: NEric Blake <eblake@redhat.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
由 Michal Privoznik 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1623389 If a device is detached twice from the same domain the following race condition may happen: 1) The first DetachDevice() call will issue "device_del" on qemu monitor, but since the DEVICE_DELETED event did not arrive in time, the API ends claiming "Device detach request sent successfully". 2) The second DetachDevice() therefore still find the device in the domain and thus proceeds to detaching it again. It calls EnterMonitor() and qemuMonitorSend() trying to issue "device_del" command again. This gets both domain lock and monitor lock released. 3) At this point, qemu sends us the DEVICE_DELETED event which is going to be handled by the event loop which ends up calling qemuDomainSignalDeviceRemoval() to determine who is going to remove the device from domain definition. Whether it is the caller that marked the device for removal or whether it is going to be the event processing thread. 4) Because the device was marked for removal, qemuDomainSignalDeviceRemoval() returns true, which means the event is to be processed by the thread that has marked the device for removal (and is currently still trying to issue "device_del" command) 5) The thread finally issues the "device_del" command, which fails (obviously) and therefore it calls qemuDomainResetDeviceRemoval() to reset the device marking and quits immediately after, NOT removing any device from the domain definition. At this point, the device is still present in the domain definition but doesn't exist in qemu anymore. Worse, there is no way to remove it from the domain definition. Solution is to note down that we've seen the event and if the second "device_del" fails, not take it as a failure but carry on with the usual execution. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> ACKed-by: NPeter Krempa <pkrempa@redhat.com>
-
由 Michal Privoznik 提交于
A caller might be interested in differentiating the cause for error, especially if DeviceNotFound error occurred. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> ACKed-by: NPeter Krempa <pkrempa@redhat.com>
-
由 Michal Privoznik 提交于
The aim of this function will be to fix return value of qemuMonitorDelDevice() in one specific case. But that is yet to come. Right now this is nothing but a plain substitution. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> ACKed-by: NPeter Krempa <pkrempa@redhat.com>
-
由 Andrea Bolognani 提交于
We're using virFileFindResourceFull() to locate resources nowadays, which makes exporting these information in the environment unnecessary: see virDriverLoadModule() for LIBVIRT_DRIVER_DIR virLockManagerPluginNew() for LIBVIRT_LOCK_MANAGER_PLUGIN_DIR virLockManagerLockDaemonConnectionNew() for VIRTLOCKD_PATH doRemoteOpen() for LIBVIRTD_PATH As further proof that we don't need to expose the information this way anymore, we're not even exporting VIRTLOGD_PATH, which would be necessary if virLogManagerConnect() didn't already take care of that for us. Signed-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
由 Jiri Denemark 提交于
Any job which is able to provide statistics that can be queried via virDomainGetJob{Stats,Info} has to set an appropriate statsType. Without a proper statsType qemuDomainJobInfoToParams and qemuDomainJobInfoToInfo have no idea what statistics should be sent to the API caller. https://bugzilla.redhat.com/show_bug.cgi?id=1688774Signed-off-by: NJiri Denemark <jdenemar@redhat.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
由 Cole Robinson 提交于
Fill in a default volume type for every pool type, as reported by the VolGetInfo API. Now that we cover the whole enum, report an error for invalid values. Reviewed-by: NAndrea Bolognani <abologna@redhat.com> Signed-off-by: NCole Robinson <crobinso@redhat.com>
-
由 Cole Robinson 提交于
Reviewed-by: NMartin Kletzander <mkletzan@redhat.com> Signed-off-by: NCole Robinson <crobinso@redhat.com>
-
由 Cole Robinson 提交于
We provide a custom configure option --enable-test-coverage and 'make cov' target to generate code coverage reports. However gnulib already provides a 'make coverage' which 'just works' and doesn't require a special configure option. This drops our custom implementation in favor of 'make coverage'. Reports are now output to cov/index.html Reviewed-by: NMartin Kletzander <mkletzan@redhat.com> Signed-off-by: NCole Robinson <crobinso@redhat.com>
-
由 Michal Privoznik 提交于
There is no way that qemu driver can work without being able to format/parse JSON. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> Reviewed-by: NJán Tomko <jtomko@redhat.com>
-
由 Michal Privoznik 提交于
The basic idea of our configure script is to probe for things rather than have them enabled by default. This is even more visible in the next commit where configure fails if qemu driver is enabled but no yajl is found. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
-
- 14 3月, 2019 20 次提交
-
-
由 Michal Privoznik 提交于
The code tries to detect installed version of qemu to learn if it uses HMP or QMP and enable YAJL based on that. Well, we support only QMP and also minimal required version of qemu is 1.5.0 so the check would have enabled yajl anyway. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> Reviewed-by: NJán Tomko <jtomko@redhat.com>
-
由 Eric Blake 提交于
A new API flag is news-worthy. Signed-off-by: NEric Blake <eblake@redhat.com> Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
-
由 Suyang Chen 提交于
Introduce a simple validation helper to perform the cputune period and quota checks so that we can get rid of those repetitive chunks. Since this is a validation helper, this patch also moves the checks from the 'parse' phase into the 'validation' phase. Signed-off-by: NSuyang Chen <dawson0xff@gmail.com> Reviewed-by: NErik Skultety <eskultet@redhat.com>
-
由 Andrea Bolognani 提交于
Apparently this was necessary in the past because old versions of autoconf/automake didn't make them available, but these days all of the platforms we target include recent enough autotools - as evidenced by the fact that, for example, we already use abs_top_srcdir in tools/ despite the fact that tools/Makefile.am is missing the same boilerplate. Signed-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
-
由 Andrea Bolognani 提交于
We already have code that defines all abs_* variables at the top of tests/Makefile.am, so there is no point in redefining them a second time (using a slightly different shell incantation to boot). Signed-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
-
由 Andrea Bolognani 提交于
According to the official documentation for autoconf[1], the correct names for these variables are abs_top_{src,build}dir rather than abs_top{src,build}dir; in fact, we're already using the correct names in various places, so let's just make everything nice and consistent. [1] https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Preset-Output-Variables.htmlSigned-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
-
由 Andrea Bolognani 提交于
This code snippet has clearly been cargo-culted, and all its instances can be safely dropped seeing as 1) a much better way to handle the scenario in C programs would be to pass the value via the preprocessor, and 2) the value is actually not used anywhere after being defined. Signed-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
-
由 Andrea Bolognani 提交于
It's no longer used anywhere. Signed-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
-
由 Andrea Bolognani 提交于
TEST_DRIVER_DIR is defined as "$(top_builddir)/src/.libs"; however, as of commit bc6e2063, virDriverLoadModule() will search (the absolute version of) that directory automatically, which means passing it through the environment is no longer necessary. Signed-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
-
由 Andrea Bolognani 提交于
LIBVIRT_DRIVER_DIR is defined as (what is for all intents and purposes equivalent to) "$(abs_top_builddir)/src/.libs"; however, as of commit bc6e2063, virDriverLoadModule() will search that directory automatically, which means passing it through the environment is no longer necessary. Signed-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
-
由 Andrea Bolognani 提交于
It's no longer used as of commit a9694a8e. Signed-off-by: NAndrea Bolognani <abologna@redhat.com> Reviewed-by: NMartin Kletzander <mkletzan@redhat.com>
-
由 Eric Blake 提交于
Use VIR_AUTOFREE and saner formatting. No semantic change. Signed-off-by: NEric Blake <eblake@redhat.com> Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
-
由 Eric Blake 提交于
An upcoming patch wants to reuse XML parsing of both unix and tcp network host descriptions in the context of setting up a backup NBD server. Make that easier by refactoring the existing parser. Signed-off-by: NEric Blake <eblake@redhat.com> Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
-
由 Eric Blake 提交于
We copy-and-paste a lot of our docs, as evidenced by the number of *GetXMLDesc() functions which had the same unusual indentation and missing capital in the second sentence of the returns paragraph. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Commit 09eb1ae0 added a new enum type for xenbus, and adjusted affected switch statements in the qemu driver, but failed to notice that the vbox driver had a similar switch statement. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Jim Fehlig 提交于
Add support in the domXML<->native config converter for max_grant_frames. Include a test for the conversion. Signed-off-by: NJim Fehlig <jfehlig@suse.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
由 Jim Fehlig 提交于
Add support for setting max_grant_frames in libxl domain config object and include a test to check that it is properly converted from XML to libxl domain config. Signed-off-by: NJim Fehlig <jfehlig@suse.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
由 Jim Fehlig 提交于
All Xen domains have a xenbus device. Implicitly add one if not already explicitly specified in the domain config. Signed-off-by: NJim Fehlig <jfehlig@suse.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
由 Jim Fehlig 提交于
xenbus is virtual controller (akin to virtio controllers) for Xen paravirtual devices. Although all Xen VMs have a xenbus, it has never been modeled in libvirt, or in Xen native VM config format for that matter. Recently there have been requests to support Xen's max_grant_frames setting in libvirt. max_grant_frames is best modeled as an attribute of xenbus. It describes the maximum IO buffer space (or DMA space) available in xenbus for use by connected paravirtual devices. This patch introduces a new xenbus controller type that includes a maxGrantFrames attribute. Signed-off-by: NJim Fehlig <jfehlig@suse.com> Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
-
由 Jim Fehlig 提交于
Commit a3ab6d42 changed the libvirtd profile to a named profile, breaking the apparmor driver's ability to detect if the profile is active. When the apparmor driver loads it checks the status of the libvirtd profile using the full binary path, which fails since the profile is now referenced by name. If the apparmor driver is explicitly requested in /etc/libvirt/qemu.conf, then libvirtd fails to load too. Instead of only checking the profile status by full binary path, also check by profile name. The full path check is retained in case users have a customized libvirtd profile with full path. Signed-off-by: NJim Fehlig <jfehlig@suse.com> Acked-by: NJamie Strandboge <jamie@canonical.com>
-