summaryrefslogtreecommitdiff
path: root/src/uml
Commit message (Collapse)AuthorAgeFilesLines
* Drop paths.h includeMichal Privoznik2016-03-181-1/+0
| | | | | | | | | | | We include the file in plenty of places. This is mostly due to historical reasons. The only place that needs something from the header file is storage_backend_fs which opens _PATH_MOUNTED. But it gets the file included indirectly via mntent.h. At no other place in our code we need _PATH_.*. Drop the include and configure check then. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* conf: refactor checking for unsupported memory devicesPeter Krempa2016-03-091-8/+1
| | | | | | | | | | Introduce a helper to check supported device and domain config and move the memory hotplug checks to it. The advantage of this approach is that by default all new features are considered unsupported by all hypervisors unless specifically changed rather than the previous approach where every hypervisor would need to declare that a given feature is unsupported.
* util: Add a return value to void hash iteratorsErik Skultety2016-02-171-6/+7
| | | | | | | | | | | | Our existing virHashForEach method iterates through all items disregarding the fact, that some of the iterators might have actually failed. Errors are usually dispatched through an error element in opaque data which then causes the original caller of virHashForEach to return -1. In that case, virHashForEach could return as soon as one of the iterators fail. This patch changes the iterator return type and adjusts all of its instances accordingly, so the actual refactor of virHashForEach method can be dealt with later. Signed-off-by: Erik Skultety <eskultet@redhat.com>
* Clean up usage of 'ret' variableJán Tomko2016-02-111-3/+2
| | | | | | | | | Do not store the return value of called functions in the same variable as the (future) return value of the current function. This makes tracking the origin of the value easier and reduces the chance of introducing a new point of exit without resetting the return value back to -1.
* conf: add caps to virDomainSaveConfigJoao Martins2016-02-041-1/+1
| | | | | | | | | | virDomainSaveConfig calls virDomainDefFormat which was setting the caps to NULL, thus keeping the old behaviour (i.e. not looking at netprefix). This patch adds the virCapsPtr to the function and allows the configuration to be saved and skipping interface names that were registered with virCapabilitiesSetNetPrefix(). Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
* conf: add caps to virDomainDefFormat*Joao Martins2016-02-041-1/+1
| | | | | | | And use the newly added caps->host.netprefix (if it exists) for interface names that match the autogenerated target names. Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
* Provide parse flags to PostParse functionsMartin Kletzander2016-01-111-0/+2
| | | | | | | This way both Domain and Device PostParse functions can act based on the flags. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
* conf: Replace read accesses to def->vcpus with accessorPeter Krempa2015-12-091-1/+1
|
* conf: Split virDomainObjList into a separate fileMichal Privoznik2015-11-301-1/+1
| | | | | | | | | | | Our domain_conf.* files are big enough. Not only they contain XML parsing code, but they served as a storage of all functions whose name is virDomain prefixed. This is just wrong as it gathers not related functions (and modules) into one big file which is then harder to maintain. Split virDomainObjList module into a separate file called virdomainobjlist.[ch]. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* virDomainCreateXML: Make domain definition transientMichal Privoznik2015-09-241-0/+1
| | | | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=871452 So, you want to create a domain from XML. The domain already exists in libvirt's database of domains. It's okay, because name and UUID matches. However, on domain startup, internal representation of the domain is overwritten with your XML even though we claim that the XML you've provided is a transient one. The bug is to be found across nearly all the drivers. Le sigh. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* virDomainCreateXML: Don't remove persistent domains on errorMichal Privoznik2015-09-241-3/+4
| | | | | | | | | | | | | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=871452 Okay, so we allow users to 'virsh create' an already existing domain, providing completely different XML than the one stored in Libvirt. Well, as long as name and UUID matches. However, in some drivers the code that handles errors unconditionally removes the domain that failed to start even though the domain might have been persistent. Fortunately, the domain is removed just from the internal list of domains and the config file is kept around. Steps to reproduce: 1) virsh dumpxml $dom > /tmp/dom.xml 2) change XML so that it is still parse-able but won't boot, e.g. change guest agent path to /foo/bar 3) virsh create /tmp/dom.xml 4) virsh dumpxml $dom 5) Observe "No such domain" error Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* conf: Rename max_balloon to total_memoryPeter Krempa2015-09-221-1/+1
| | | | | The name of the variable was misleading. Rename it and it's setting accessor before other fixes.
* qemu: add udp interface supportJonathan Toppins2015-09-021-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a new interface type using UDP sockets, this seems only applicable to QEMU but have edited tree-wide to support the new interface type. The interface type required the addition of a "localaddr" (local address), this then maps into the following xml and qemu call. <interface type='udp'> <mac address='52:54:00:5c:67:56'/> <source address='127.0.0.1' port='11112'> <local address='127.0.0.1' port='22222'/> </source> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </interface> QEMU call: -net socket,udp=127.0.0.1:11112,localaddr=127.0.0.1:22222 Notice the xml "local" entry becomes the "localaddr" for the qemu call. reference: http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg00629.html Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
* nodeinfo: Add sysfs_prefix to nodeGetMemoryStatsJohn Ferlan2015-07-131-1/+1
| | | | | Add the sysfs_prefix argument to the call to allow for setting the path for tests to something other than SYSFS_SYSTEM_PATH.
* nodeinfo: Add sysfs_prefix to nodeCapsInitNUMAJohn Ferlan2015-07-131-1/+1
| | | | | | | | Add the sysfs_prefix argument to the call to allow for setting the path for tests to something other than SYSFS_CPU_PATH which is a derivative of SYSFS_SYSTEM_PATH Use cpupath for nodeCapsInitNUMAFake and remove SYSFS_CPU_PATH
* nodeinfo: Add sysfs_prefix to nodeGetInfoJohn Ferlan2015-07-131-1/+1
| | | | | Add the sysfs_prefix argument to the call to allow for setting the path for tests to something other than SYSFS_SYSTEM_PATH.
* nodeinfo: Add sysfs_prefix to nodeGetCPUMapJohn Ferlan2015-07-131-1/+1
| | | | | Add the sysfs_prefix argument to the call to allow for setting the path for tests to something other than SYSFS_SYSTEM_PATH.
* Improve some errors for openconsole/channelLuyao Huang2015-06-241-1/+2
| | | | | | | | | | | | | | Functions like virDomainOpenConsole() and virDomainOpenChannel() accept NULL as a dev_name parameter. Try using alias for the error message if dev_name is not specified. Before: error: internal error: character device <null> is not using a PTY After: error: internal error: character device serial0 is not using a PTY Signed-off-by: Luyao Huang <lhuang@redhat.com>
* uml: s/virDomainObjListFindByID/virDomainObjListFindByUUID/Michal Privoznik2015-04-241-2/+2
| | | | | | | | | | | | | ListFindByID() still requires to step through items in the hash table (in the worst case scenario through all of them), lock each one and compare whether we've found what we're looking for. This is suboptimal as locking a domain object means we need to wait for the current API running over the object to finish. Unfortunately, we can't drop the function completely because we have this public API virDomainLookupByID which we can't drop. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* virDomainObjListFindByName: Return referenced objectMichal Privoznik2015-04-241-22/+11
| | | | | | | Every domain that grabs a domain object to work over should reference it to make sure it won't disappear meanwhile. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* domain: conf: Drop expectedVirtTypesCole Robinson2015-04-201-4/+0
| | | | | | This needs to specified in way too many places for a simple validation check. The ostype/arch/virttype validation checks later in DomainDefParseXML should catch most of the cases that this was covering.
* caps: Convert to use VIR_DOMAIN_VIRT internallyCole Robinson2015-04-201-1/+1
|
* domain: Convert os.type to VIR_DOMAIN_OSTYPE enumCole Robinson2015-04-201-1/+1
|
* caps: Switch AddGuest to take VIR_DOMAIN_OSTYPE valueCole Robinson2015-04-201-1/+1
| | | | Rather than an opencoded string. This should be a no-op
* Remove unused macrosJán Tomko2015-04-021-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the order of appearance: * MAX_LISTEN - never used added by 23ad665c (qemud) and addec57 (lock daemon) * NEXT_FREE_CLASS_ID - never used, added by 07d1b6b * virLockError - never used, added by eb8268a4 * OPENVZ_MAX_ARG, CMDBUF_LEN, CMDOP_LEN unused since the removal of ADD_ARG_LIT in d8b31306 * QEMU_NB_PER_CPU_STAT_PARAM - unused since 897808e * QEMU_CMD_PROMPT, QEMU_PASSWD_PROMPT - unused since 1dc10a7 * TEST_MODEL_WORDSIZE - unused since c25c18f7 * TEMPDIR - never used, added by 714bef5 * NSIG - workaround around old headers added by commit 60ed1d2 unused since virExec was moved by commit 02e8691 * DO_TEST_PARSE - never used, added by 9afa006 * DIFF_MSEC, GETTIMEOFDAY - unused since eee6eb6
* conf: Add interface to parse and format memory device informationPeter Krempa2015-03-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds code that parses and formats configuration for memory devices. A simple configuration would be: <memory model='dimm'> <target> <size unit='KiB'>524287</size> <node>0</node> </target> </memory> A complete configuration of a memory device: <memory model='dimm'> <source> <pagesize unit='KiB'>4096</pagesize> <nodemask>1-3</nodemask> </source> <target> <size unit='KiB'>524287</size> <node>1</node> </target> </memory> This patch preemptively forbids use of the <memory> device in individual drivers so the users are warned right away that the device is not supported.
* conf: Add support for parsing and formatting max memory and slot countPeter Krempa2015-03-231-1/+5
| | | | | | | | | | Add a XML element that will allow to specify maximum supportable memory and the count of memory slots to use with memory hotplug. To avoid possible confusion and misuse of the new element this patch also explicitly forbids the use of the maxMemory setting in individual drivers's post parse callbacks. This limitation will be lifted when the support is implemented.
* conf: Replace access to def->mem.max_balloon with accessor functionsPeter Krempa2015-03-161-4/+4
| | | | | | | | | | | | | | | | | | | | As there are two possible approaches to define a domain's memory size - one used with legacy, non-NUMA VMs configured in the <memory> element and per-node based approach on NUMA machines - the user needs to make sure that both are specified correctly in the NUMA case. To avoid this burden on the user I'd like to replace the NUMA case with automatic totaling of the memory size. To achieve this I need to replace direct access to the virDomainMemtune's 'max_balloon' field with two separate getters depending on the desired size. The two sizes are needed as: 1) Startup memory size doesn't include memory modules in some hypervisors. 2) After startup these count as the usable memory size. Note that the comments for the functions are future aware and document state that will be present after a few later patches.
* Trivially support DomainHasManagedSaveImageJán Tomko2015-02-061-1/+32
| | | | | | | | | | Return 0 instead of ERR_NO_SUPPORT in each driver where we don't support managed save or -1 if the domain does not exist. This avoids spamming daemon logs when 'virsh dominfo' is run. https://bugzilla.redhat.com/show_bug.cgi?id=1095637
* Removing probing of secondary driversDaniel P. Berrange2015-01-271-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For stateless, client side drivers, it is never correct to probe for secondary drivers. It is only ever appropriate to use the secondary driver that is associated with the hypervisor in question. As a result the ESX & HyperV drivers have both been forced to do hacks where they register no-op drivers for the ones they don't implement. For stateful, server side drivers, we always just want to use the same built-in shared driver. The exception is virtualbox which is really a stateless driver and so wants to use its own server side secondary drivers. To deal with this virtualbox has to be built as 3 separate loadable modules to allow registration to work in the right order. This can all be simplified by introducing a new struct recording the precise set of secondary drivers each hypervisor driver wants struct _virConnectDriver { virHypervisorDriverPtr hypervisorDriver; virInterfaceDriverPtr interfaceDriver; virNetworkDriverPtr networkDriver; virNodeDeviceDriverPtr nodeDeviceDriver; virNWFilterDriverPtr nwfilterDriver; virSecretDriverPtr secretDriver; virStorageDriverPtr storageDriver; }; Instead of registering the hypervisor driver, we now just register a virConnectDriver instead. This allows us to remove all probing of secondary drivers. Once we have chosen the primary driver, we immediately know the correct secondary drivers to use. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Remove use of nwfilterPrivateData from nwfilter driverDaniel P. Berrange2015-01-271-5/+4
| | | | | The nwfilter driver can rely on its global state instead of the connect private data.
* Add support for schema validation when passing in XMLDaniel P. Berrange2015-01-151-4/+13
| | | | | | | The virDomainDefineXMLFlags and virDomainCreateXML APIs both gain new flags allowing them to be told to validate XML. This updates all the drivers to turn on validation in the XML parser when the flags are set
* Give virDomainDef parser & formatter their own flagsDaniel P. Berrange2015-01-131-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | The virDomainDefParse* and virDomainDefFormat* methods both accept the VIR_DOMAIN_XML_* flags defined in the public API, along with a set of other VIR_DOMAIN_XML_INTERNAL_* flags defined in domain_conf.c. This is seriously confusing & error prone for a number of reasons: - VIR_DOMAIN_XML_SECURE, VIR_DOMAIN_XML_MIGRATABLE and VIR_DOMAIN_XML_UPDATE_CPU are only relevant for the formatting operation - Some of the VIR_DOMAIN_XML_INTERNAL_* flags only apply to parse or to format, but not both. This patch cleanly separates out the flags. There are two distint VIR_DOMAIN_DEF_PARSE_* and VIR_DOMAIN_DEF_FORMAT_* flags that are used by the corresponding methods. The VIR_DOMAIN_XML_* flags received via public API calls must be converted to the VIR_DOMAIN_DEF_FORMAT_* flags where needed. The various calls to virDomainDefParse which hardcoded the use of the VIR_DOMAIN_XML_INACTIVE flag change to use the VIR_DOMAIN_DEF_PARSE_INACTIVE flag.
* Add stub virDomainDefineXMLFlags implsDaniel P. Berrange2015-01-131-2/+12
| | | | | | Make sure every virt driver implements virDomainDefineXMLFlags by adding a trivial passthrough from the existing impl with no flags set.
* Domain conf: allow more than one IP address for net devicesCédric Bosdonnat2015-01-051-1/+1
| | | | | | Add the possibility to have more than one IP address configured for a domain network interface. IP addresses can also have a prefix to define the corresponding netmask.
* Replace virNetworkFree with virObjectUnrefJohn Ferlan2014-12-021-1/+1
| | | | | | Since virNetworkFree will call virObjectUnref anyway, let's just use that directly so as to avoid the possibility that we inadvertently clear out a pending error message when using the public API.
* Remove unnecessary curly brackets in rest of src/[o-u]*/Martin Kletzander2014-11-142-10/+5
| | | | Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
* maint: avoid static zero init in driversEric Blake2014-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | C guarantees that static variables are zero-initialized. Some older compilers (and also gcc -fno-zero-initialized-in-bss) create larger binaries if you explicitly zero-initialize a static variable. * src/libxl/libxl_driver.c: Fix initialization. * src/lxc/lxc_controller.c: Likewise. * src/openvz/openvz_util.c (openvzKBPerPages): Likewise. * src/phyp/phyp_driver.c: Likewise. * src/remote/remote_driver.c: Likewise. * src/test/test_driver.c: Likewise. * src/uml/uml_driver.c: Likewise. * src/vbox/vbox_XPCOMCGlue.c: Likewise. * src/vbox/vbox_tmpl.c: Likewise. * src/xen/xen_driver.c: Likewise. * src/xen/xen_hypervisor.c: Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
* Rename virDriver to virHypervisorDriverDaniel P. Berrange2014-10-231-2/+2
| | | | | | To prepare for introducing a single global driver, rename the virDriver struct to virHypervisorDriver and the registration API to virRegisterHypervisorDriver()
* Implement empty post parse callbacks for all driversPeter Krempa2014-10-151-0/+10
| | | | | To allow easy implementation of a callback check this patch adds empty post parse callbacks to drivers that were missing them.
* nodeinfo: fix version of nodeAllocPagesTomoki Sekiyama2014-09-261-1/+1
| | | | | | Fix comments about the version in which '.nodeAllocPages' are added. Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
* nodeinfo: Implement nodeAllocPagesMichal Privoznik2014-09-251-0/+22
| | | | | | And add stubs to other drivers like: lxc, qemu, uml and vbox. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* Wire up the interface backend optionsJán Tomko2014-09-162-2/+3
| | | | | | | Pass the user-specified tun path down when creating tap device when called from the qemu driver. Also honor the vhost device path specified by user.
* maint: use consistent if-else braces in remaining spotsEric Blake2014-09-041-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm about to add a syntax check that enforces our documented HACKING style of always using matching {} on if-else statements. This patch focuses on all remaining problems, where there weren't enough issues to warrant splitting it further. * src/remote/remote_driver.c (doRemoteOpen): Correct use of {}. * src/security/virt-aa-helper.c (vah_add_path, valid_path, main): Likewise. * src/rpc/virnetsocket.c (virNetSocketNewConnectLibSSH2): Likewise. * src/esx/esx_vi_types.c (esxVI_Type_FromString): Likewise. * src/uml/uml_driver.c (umlDomainDetachDevice): Likewise. * src/util/viralloc.c (virShrinkN): Likewise. * src/util/virbuffer.c (virBufferURIEncodeString): Likewise. * src/util/virdbus.c (virDBusCall): Likewise. * src/util/virnetdev.c (virNetDevValidateConfig): Likewise. * src/util/virnetdevvportprofile.c (virNetDevVPortProfileGetNthParent): Likewise. * src/util/virpci.c (virPCIDeviceIterDevices) (virPCIDeviceWaitForCleanup) (virPCIDeviceIsBehindSwitchLackingACS): Likewise. * src/util/virsocketaddr.c (virSocketAddrGetNumNetmaskBits): Likewise. * src/util/viruri.c (virURIParseParams): Likewise. * daemon/stream.c (daemonStreamHandleAbort): Likewise. * tests/testutils.c (virtTestResult): Likewise. * tests/cputest.c (cpuTestBaseline): Likewise. * tools/virsh-domain.c (cmdDomPMSuspend): Likewise. * tools/virsh-host.c (cmdNodeSuspend): Likewise. * src/esx/esx_vi_generator.py (Type.generate_typefromstring): Tweak generated code. Signed-off-by: Eric Blake <eblake@redhat.com>
* support for QEMU vhost-userMichele Paolino2014-07-161-0/+5
| | | | | | | | | | | | | | | | | | | This patch adds support for the QEMU vhost-user feature to libvirt. vhost-user enables the communication between a QEMU virtual machine and other userspace process using the Virtio transport protocol. It uses a char dev (e.g. Unix socket) for the control plane, while the data plane based on shared memory. The XML looks like: <interface type='vhostuser'> <mac address='52:54:00:3b:83:1a'/> <source type='unix' path='/tmp/vhost.sock' mode='server'/> <model type='virtio'/> </interface> Signed-off-by: Michele Paolino <m.paolino@virtualopensystems.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* util: virstatslinux: make more genericRoman Bogorodskiy2014-07-151-1/+1
| | | | | | | | | | Rename linuxDomainInterfaceStats to virNetInterfaceStats in order to allow adding platform specific implementations without making consumer worrying about specific implementation to be used. Also, rename util/virstatslinux.c to util/virstats.c so placing other platform specific implementations into this file don't look unexpected from the file name.
* capabilities: use bool instead of intEric Blake2014-07-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While preparing to add a capability for active commit, I noticed that the existing code was abusing int for boolean values. * src/conf/capabilities.h (_virCapsGuestFeature, _virCapsHost) (virCapabilitiesNew, virCapabilitiesAddGuestFeature): Improve types. * src/conf/capabilities.c (virCapabilitiesNew) (virCapabilitiesAddGuestFeature): Adjust signature. * src/bhyve/bhyve_capabilities.c (virBhyveCapsBuild): Update clients. * src/esx/esx_driver.c (esxCapsInit): Likewise. * src/libxl/libxl_conf.c (libxlMakeCapabilities): Likewise. * src/lxc/lxc_conf.c (virLXCDriverCapsInit): Likewise. * src/openvz/openvz_conf.c (openvzCapsInit): Likewise. * src/parallels/parallels_driver.c (parallelsBuildCapabilities): Likewise. * src/phyp/phyp_driver.c (phypCapsInit): Likewise. * src/qemu/qemu_capabilities.c (virQEMUCapsInit) (virQEMUCapsInitGuestFromBinary): Likewise. * src/security/virt-aa-helper.c (get_definition): Likewise. * src/test/test_driver.c (testBuildCapabilities): Likewise. * src/uml/uml_conf.c (umlCapsInit): Likewise. * src/vbox/vbox_tmpl.c (vboxCapsInit): Likewise. * src/vmware/vmware_conf.c (vmwareCapsInit): Likewise. * src/xen/xen_hypervisor.c (xenHypervisorBuildCapabilities): Likewise. * src/xenapi/xenapi_driver.c (getCapsObject): Likewise. * tests/qemucaps2xmltest.c (testGetCaps): Likewise. * tests/testutils.c (virTestGenericCapsInit): Likewise. * tests/testutilslxc.c (testLXCCapsInit): Likewise. * tests/testutilsqemu.c (testQemuCapsInit): Likewise. * tests/testutilsxen.c (testXenCapsInit): Likewise. * tests/vircaps2xmltest.c (buildVirCapabilities): Likewise. * tests/vircapstest.c (buildNUMATopology): Likewise. * tests/vmx2xmltest.c (testCapsInit): Likewise. * tests/xml2vmxtest.c (testCapsInit): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
* Use virBufferCheckError everywhere we report OOM errorJán Tomko2014-07-031-3/+1
| | | | | | | | | | | | | | | | | Replace: if (virBufferError(&buf)) { virBufferFreeAndReset(&buf); virReportOOMError(); ... } with: if (virBufferCheckError(&buf) < 0) ... This should not be a functional change (unless some callers misused the virBuffer APIs - a different error would be reported then)
* Report errors in virCapabilitiesFormatXMLJán Tomko2014-07-031-2/+1
| | | | | | | So far, we only report an error if formatting the siblings bitmap in NUMA topology fails. Be consistent and always report error in virCapabilitiesFormatXML.
* enhance hostdev mode 'capabilities' processJincheng Miao2014-06-251-0/+10
| | | | | | | | | | | | Currently, only LXC has hostdev mode 'capabilities' support, so the other drivers should forbid to define it in XML. The hostdev mode check is added to devicesPostParseCallback() for each hypervisor driver. But there are some drivers lack function devicesPostParseCallback(), so only add check for qemu, libxl, openvz, uml, xen, xenapi. Signed-off-by: Jincheng Miao <jmiao@redhat.com>