summaryrefslogtreecommitdiff
path: root/src/ch
Commit message (Collapse)AuthorAgeFilesLines
* meson: Use initconfdirAndrea Bolognani2023-05-051-1/+1
| | | | | Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
* ch: pinVcpuLive: remove unused variableJán Tomko2023-04-201-5/+0
| | | | | Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
* qemu, ch: Move threads to cgroup dir before changing parametersMartin Kletzander2023-04-201-6/+6
| | | | | | | | | | | | | | | | | | | | | With cgroupv2 this has better effect on the resource allocation. An excerpt from Documentation/admin-guide/cgroup-v2.rst explains is this way: Migrating a process across cgroups is a relatively expensive operation and stateful resources such as memory are not moved together with the process. This is an explicit design decision as there often exist inherent trade-offs between migration and various hot paths in terms of synchronization cost. [...] Setting a non-empty value to "cpuset.mems" causes memory of tasks within the cgroup to be migrated to the designated nodes if they are currently using memory outside of the designated nodes. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* virStringParseVersion: Parse into 'unsigned long long'Peter Krempa2023-04-031-1/+1
| | | | | | | Phase out 'unsigned long' Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
* ch: Update format strings in translated messagesJiri Denemark2023-04-015-29/+30
| | | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
* ch: Do not add stub console to ch VMsPraveen K Paladugu2023-02-101-0/+1
| | | | | | | | | | | | | virDomainDefAddConsoleCompat in post parsing step appends a stub console of type VIR_DOMAIN_CHR_TYPE_NULL to ch VMs' Domain XML. Cloud-hypervisor's deviceValidateCallback (chValidateDomainDeviceDef) checks that the type of stub console is not of type VIR_DOMAIN_CHR_TYPE_PTY and throws an error. This commit introduces NO_STUB_CONSOLE feature check to Domain features and uses it to skip adding stub console to ch VMs. Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* conf: introduce crypto devicezhenwei pi2023-01-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce crypto device like: <crypto model='virtio' type='qemu'> <backend model='builtin' queues='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/> </crypto> <crypto model='virtio' type='qemu'> <backend model='lkcf'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/> </crypto> Currently, crypto model supports virtio only, type supports qemu only (vhost-user in the plan). For the qemu type, backend supports modle builtin/lkcf, and the queues is optional. Changes in this commit: - docs: formatdomain.rst - schemas: domaincommon.rng - conf: crypto related domain conf - qemu: crypto related - tests: crypto related test Signed-off-by: zhenwei pi <pizhenwei@bytedance.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* src: Don't use virReportSystemError() on virProcessGetStatInfo() failureMichal Privoznik2023-01-231-2/+2
| | | | | | | | | | | | | | | | Firstly, the virProcessGetStatInfo() does not fail really. But even if it did, it sets correct errno only sometimes (and even that is done in a helper it's calling - virProcessGetStat() and even there it's the case only in very few error paths). Therefore, using virReportSystemError() to report errors is very misleading. Use plain virReportError() instead. Luckily, there are only two places where the former was used: chDomainHelperGetVcpus() and qemuDomainHelperGetVcpus() (not a big surprise since CH driver is heavily inspired by QEMU driver). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
* ch: use CURLOPT_UPLOAD instead of CURLOPT_PUTDaniel P. Berrangé2023-01-181-1/+1
| | | | | | | | | | | | | | | | The CURLOPT_PUT constant causes a deprecation warning when compiling on Alpine Edge. The docs indicate it is deprecated since 7.2.1 https://curl.se/libcurl/c/CURLOPT_PUT.html Since 7.87 the deprecation is now exposed at build time via a compiler warning. We already use CURLOPT_UPLOAD in the ESX driver, so this brings the CH driver into line. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* Remove Before=libvirt-guests.service from other servicesMartin Kletzander2022-10-271-1/+0
| | | | | | | | | | | | | libvirt-guests has After= dependency for all the sockets and that is enough. With the extra Before= in the service file systemd postpones the start of the socket activated service (when libvirt-guests is trying to connect to the socket) until after libvirt-guests is stopped effectively making `systemctl stop libvirt-guests` deadlock. The reason for that is that all stop jobs are scheduled before any start job. Removing the redundant Before= specification fixes this behaviour. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* virStateInitialize: Propagate whether running in monolithic daemon mode to ↵Peter Krempa2022-09-131-0/+1
| | | | | | | | | | | | | stateful driver init Upcoming patch which is fixing the opening of drivers in monolithic mode needs to know whether we are inside 'libvirtd' but the code where the decision needs to happen is not re-compiled per daemon. Thus we need to pass this information to the stateful driver init function so that it can be remebered. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* CH: use virDomainObjEndJob()Kristina Hanicova2022-09-073-31/+10
| | | | | | | | | This patch removes virCHDomainObjEndJob() and replaces it with call to the generalized virDomainObjEndJob(). Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
* CH: use virDomainObjBeginJob()Kristina Hanicova2022-09-073-67/+11
| | | | | | | | | This patch removes virCHDomainObjBeginJob() and replaces it with call to the generalized virDomainObjBeginJob(). Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* virdomainjob: make drivers use job object in the domain objectKristina Hanicova2022-09-072-21/+10
| | | | | | | | | | | This patch uses the job object directly in the domain object and removes the job object from private data of all drivers that use it as well as other relevant code (initializing and freeing the structure). Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* conf: extend xmlopt with job config & add job object into domain objectKristina Hanicova2022-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | This patch adds the generalized job object into the domain object so that it can be used by all drivers without the need to extract it from the private data. Because of this, the job object needs to be created and set during the creation of the domain object. This patch also extends xmlopt with possible job config containing virDomainJobObj callbacks, its private data callbacks and one variable (maxQueuedJobs). This patch includes: * addition of virDomainJobObj into virDomainObj (used in the following patches) * extending xmlopt with job config structure * new function for freeing the virDomainJobObj Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
* move files: hypervisor/domain_job -> conf/virdomainjobKristina Hanicova2022-09-071-1/+1
| | | | | | | | | | | | | The following patches move job object as a member into the domain object. Because of this, domain_conf (where the domain object is defined) needs to import the file with the job object. It makes sense to move jobs to the same level as the domain_conf: into src/conf/ Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
* util: Extend virProcessGetStatInfo() for sysTime and userTimeMichal Privoznik2022-09-051-0/+1
| | | | | | | | | | | The virProcessGetStatInfo() helper parses /proc stat file for given PID and/or TID and reports cumulative cpuTime which is just a sum of user and sys times. But in near future, we'll need those times separately, so make the function return them too (if caller desires). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* Rename iterface type='dummy' to type='null'Martin Kletzander2022-08-251-1/+1
| | | | | | | | | | When commit bac6b266fb6a added this "functionality" this was the only naming I could think of, but after discussion with Dan we found the name 'null' fits a bit better, so change it before we make a release with the old name. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
* conf, docs, schemas: Add support for interface type vdsMartin Kletzander2022-08-181-0/+1
| | | | | | | | This represents an interface connected to a VMWare Distributed Switch, previously obscured as a dummy interface. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Reviewed-by: Ján Tomko <jtomko@redhat.com>
* hypervisor: domain_job: add JobData private callbacks into virDomainJobObjKristina Hanicova2022-08-101-1/+1
| | | | | | | | | | | We need this callback structure for qemu driver only, but it makes more sense to include it in the virDomainJobObj in case of other future additions than as a parameter of a beginJob functions. Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
* CH: use virDomainObjClearJob() instead of virCHDomainObjFreeJob()Kristina Hanicova2022-08-081-8/+2
| | | | | Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* conf, docs: Add support for dummy network interfaceMartin Kletzander2022-08-051-0/+1
| | | | | Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Reviewed-by: Ján Tomko <jtomko@redhat.com>
* CH: use virDomainObjResetJob()Kristina Hanicova2022-08-021-11/+2
| | | | | | | | This patch removes and replaces virCHDomainObjResetJob() with general virDomainObjResetJob(). Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
* CH: use virDomainObjInitJob()Kristina Hanicova2022-07-211-12/+1
| | | | | | | | This patch removes and replaces virCHDomainObjInitJob() with general virDomainObjInitJob(). Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* CH: use virDomainJobObjKristina Hanicova2022-07-202-10/+3
| | | | | | | | This patch replaces struct virCHDomainJobObj with generalized virDomainJobObj. Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* ch: Remove unused includesPeng Liang2022-06-165-13/+0
| | | | | Signed-off-by: Peng Liang <tcx4c70@gmail.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* lib: Be consistent about vm->pidMichal Privoznik2022-06-012-2/+2
| | | | | | | | | | | | | | | | | | | | | | The virDomainObj struct has @pid member where the domain's hypervisor PID is stored (e.g. QEMU/bhyve/libvirt_lxc/... PID). However, we are not consistent when it comes to shutoff state. Initially, because virDomainObjNew() uses g_new0() the @pid is initialized to 0. But when domain is shut off, some functions set it to -1 (virBhyveProcessStop, virCHProcessStop, qemuProcessStop, ..). In other places, the @pid is tested to be 0, on some other places it's tested for being negative and in the rest for being positive. To solve this inconsistency we can stick with either value, -1 or 0. I've chosen the latter as it's safer IMO. For instance if by mistake we'd kill(vm->pid, SIGTERM) we would kill ourselves instead of init's process group. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
* drivers: Group global features togetherAndrea Bolognani2022-04-071-6/+9
| | | | | | | | | | | All these features are supposed to be handled by the call to virDriverFeatureIsGlobal() placed right above the switch statement, so if any of them is actually encountered inside the switch statement it means there's a bug in the driver and we should report an error. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* lib: Set up cpuset controller for restrictive numatuneMichal Privoznik2022-04-071-1/+2
| | | | | | | | | | | | | | | | | The aim of 'restrictive' numatune mode is to rely solely on CGroups to have QEMU running on configured NUMA nodes. However, we were never setting the cpuset controller when a domain was starting up. We are doing so only when virDomainSetNumaParameters() is called (aka live pinning). This is obviously wrong. Fortunately, fix is simple as 'restrictive' is similar to 'strict' - every location where VIR_DOMAIN_NUMATUNE_MEM_STRICT occurs can be audited and VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE case can be added. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2070380 Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* ch: Explicitly forbid live changing nodeset for strict numatuneMichal Privoznik2022-04-071-1/+1
| | | | | | | | | | | | | This is similar to v7.10.0-354-g06f405c627 except this time it fixes CH driver. With strict numatune we can't guarantee that all memory is moved to new location. Therefore, let's forbid moving memory in that case. However, allow it for restrictive mode, which is documented to be best effort. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* hypervisor: Drop dead code in virDomainCgroupSetupGlobalCpuCgroup()Michal Privoznik2022-04-071-2/+1
| | | | | | | | | | Since its introduction in v1.3.2-43-gef1fa55e46 there is a dead code in virDomainCgroupSetupGlobalCpuCgroup() (well, qemuSetupGlobalCpuCgroup() back then). The code formats NUMA nodeset but never sets it. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* ch_monitor: Use automatic mutex managementTim Wiederhake2022-04-051-31/+24
| | | | | Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* ch: use virDomainJob enum instead of virCHDomainJobKristina Hanicova2022-03-253-41/+21
| | | | | Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* virStorageSource: Convert 'type' to proper enumPeter Krempa2022-03-111-0/+1
| | | | | | | | Use 'virStorageType' as type for the 'type' member and convert the code to work properly. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* driver: Introduce global driver feature flag handling functionPeter Krempa2022-02-171-0/+5
| | | | | | | | | | | | | | | The 'virDrvFeature' has a combination of features which are asserted by the specific driver and features which are actually global. In many cases the implementation was cargo-culted into newer drivers without re-assesing whether it makes sense. This patch introduces a global function which will specifically handle these global flags and defer the rest to the driver. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
* ch: Report VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER as supportedMichal Privoznik2022-02-111-1/+1
| | | | | | | | | | | | Even though the CH driver doesn't implement virNetworkUpdate() API, when it does it will see the arguments in correct order. This is similar to other drivers that don't implement the API, like ESX, libxl, LXC, etc. Enabling this driver feature stops clients from swapping the arguments (see comment in the API for more info). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
* ch: Use automatic mutex managementTim Wiederhake2022-02-112-22/+8
| | | | | Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* ch: Prepare virCHDriverGetCapabilities for automatic mutex managementTim Wiederhake2022-02-111-8/+9
| | | | | | | | No functional change intended. This change makes the refactoring to automatic mutex management easier to follow. Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* ch_process: Check whether domain is already running before starting itMichal Privoznik2022-02-111-0/+6
| | | | | | | | | | | | There are two places where a domain can be started in CH driver: chDomainCreateXML() and chDomainCreateWithFlags(). Both acquire a job (good), but neither of them checks whether the domain isn't already running. This is wrong. Fortunately, both function call the very same virCHProcessStart() rendering it the best place for such check. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
* ch_driver: Introduce and use virCHDomainRemoveInactive()Michal Privoznik2022-02-113-8/+22
| | | | | | | | | | | | | There are few places where a call to virDomainObjListRemove() is guarded with !vm->persistent check. And there are some places which are missing this check completely (leading us to losing a domain). To prevent such mistakes introduce virCHDomainRemoveInactive() which does the check for us. Also replace all occurrences of virDomainObjListRemove() with the call to the new function. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
* ch_driver: End job properly on failed chDomainCreateXML()Michal Privoznik2022-02-111-1/+2
| | | | | | | | | When creating a domain failed, then the virCHDomainObjEndJob() would be jumped over. Fix this by creating enjob label and fixing one goto. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
* chDomainCreateXML: Drop spurious driver unlockMichal Privoznik2022-02-111-1/+0
| | | | | | | | | Inside chDomainCreateXML(), towards the end, the driver is unlocked even though there is no corresponding driver lock call before that. Drop it. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
* ch_driver: Don't lock driver when looking up domainsMichal Privoznik2022-02-111-9/+0
| | | | | | | | | | There is no need to lock whole driver when accessing virDomainObjList. Those APIs were specifically tailored to be thread safe (when we were dropping QEMU driver lock). Don't resurrect old history. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
* ch_driver: Don't lock driver when getting versionMichal Privoznik2022-02-111-2/+0
| | | | | | | | | | | | In chConnectGetVersion() the CH driver is locked in order to read driver->version. This is needless, because not only is the version set with driver unlocked (chStateInitialize() calls chExtractVersion() which sets the version), but the version is practically immutable. Once driver initialized itself it's never changed. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
* lib: Use g_clear_pointer() moreMichal Privoznik2022-02-082-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change was generated using the following spatch: @ rule1 @ expression a; identifier f; @@ <... - f(*a); ... when != a; - *a = NULL; + g_clear_pointer(a, f); ...> @ rule2 @ expression a; identifier f; @@ <... - f(a); ... when != a; - a = NULL; + g_clear_pointer(&a, f); ...> Then, I left some of the changes out, like tools/nss/ (which doesn't link with glib) and put back a comment in qemuBlockJobProcessEventCompletedActiveCommit() which coccinelle decided to remove (I have no idea why). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* ch: virCHProcessSetupIOThreads: use correct type for return valueJán Tomko2022-02-031-2/+4
| | | | | | | | | | | virCHMonitorGetIOThreads returns an int, not size_t. Also return early if it's negative, because promoting it to an unsigned type in the for loop condition could lead to an infinte loop. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
* ch: virCHMonitorGetIOThreads: fix g_steal_pointer usageJán Tomko2022-02-031-1/+1
| | | | | | Fixes: 81226d88034fd460855ac75dd2c985ca91ff6219 Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
* virParseVersionString: rename to virStringParseVersionJán Tomko2022-02-031-1/+1
| | | | | Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
* meson: Add missing virt_install_dirsAndrea Bolognani2022-02-021-0/+1
| | | | | | | | | | We recently started listing these in the spec file and, since we were not creating them during the installation phase, that broke RPM builds. Fixes: 4b43da0bff9b78dcf1189388d4c89e524238b41d Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* systemd: Use correct man page name in modular daemon service filesPeter Krempa2022-02-011-1/+1
| | | | | | | | | The service files were copied out of the service file for libvirtd and the name of the corresponding manpage was not fixed. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2045959 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>