- 03 11月, 2014 1 次提交
-
-
由 Martin Kletzander 提交于
Particularly in qemuBuildNumaArgStr(), there was a need for the advice due to memory backing, which needs to know the nodeset it will be pinned to. With newer qemu this caused the following error when starting domain: error: internal error: Advice from numad is needed in case of automatic numa placement even when starting perfectly valid domain, e.g.: ... <vcpu placement='auto'>4</vcpu> <numatune> <memory mode='strict' placement='auto'/> </numatune> <cpu> <numa> <cell id='0' cpus='0' memory='524288'/> <cell id='1' cpus='1' memory='524288'/> </numa> </cpu> ... Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1138545Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 19 9月, 2014 1 次提交
-
-
由 Pavel Hrdina 提交于
We are not detecting the presence of FIPS from QEMU, but from procfs and that means it's not QEMU capability. It was decided that we will pass this flag to QEMU even if it's not supported by old QEMU binaries. This patch also reverts changes done by commit a21cfb0f to qemucapabilitestest and implements a new test case in qemuxml2argvtest. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1135431Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
-
- 21 8月, 2014 1 次提交
-
-
由 John Ferlan 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1078126 Using 'virsh attach-device --config' (or --persistent) to attach a file backed lun device will succeed; however, subsequent domain restarts will result in failure because the configuration of a file backed lun is not supported. Although allowing 'illegal configurations' is something that can be allowed, it may not be practical in this case. Generally, when attaching a device to a domain means the domain must be running. A way around this is using the --config (or --persistent) option. When an attach is done to a running domain, a temporary configuration is modified first followed by the live update. The live update will make a number of disk validity checks when building the qemu command to attach the disk. If any fail, then change is rejected. Rather than allow a potentially illegal combination, adjust the code in the configuration path to make the same checks as the running path will make with respect to disk validity checks. This way we avoid having the potential for some subsequent start/reboot to fail because an illegal combination was allowed. NB: The live path still checks the configuration since it is possible to just do --live guest modification...
-
- 08 8月, 2014 1 次提交
-
-
由 John Ferlan 提交于
During review of the iSCSI hostdev series, eblake noted that the prototypes shouldn't have the extranenous space between the "*" and the function name: http://www.redhat.com/archives/libvir-list/2014-July/msg01227.html Since it was more invasive than 1 or 2 lines - I said I'd send a patch covering this once committed. Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
-
- 24 7月, 2014 1 次提交
-
-
由 John Ferlan 提交于
Add a conn for future patches to be able to grab the secret when authenticating an iSCSI host device
-
- 21 6月, 2014 1 次提交
-
-
由 Ján Tomko 提交于
Just code movement and rename.
-
- 14 5月, 2014 2 次提交
-
-
由 Roman Bogorodskiy 提交于
Move sharable PCI handling functions to domain_addr.[ch], and change theirs prefix from 'qemu' to 'vir': - virDomainPCIAddressAsString; - virDomainPCIAddressBusSetModel; - virDomainPCIAddressEnsureAddr; - virDomainPCIAddressFlagsCompatible; - virDomainPCIAddressGetNextSlot; - virDomainPCIAddressReleaseSlot; - virDomainPCIAddressReserveAddr; - virDomainPCIAddressReserveNextSlot; - virDomainPCIAddressReserveSlot; - virDomainPCIAddressSetFree; - virDomainPCIAddressSetGrow; - virDomainPCIAddressSlotInUse; - virDomainPCIAddressValidate; The only change here is function names, the implementation itself stays untouched. Extract common allocation code from DomainPCIAddressSetCreate into virDomainPCIAddressSetAlloc.
-
由 Roman Bogorodskiy 提交于
Introduce new files (domain_addr.[ch]) to provide an API for domain device handling that could be shared across the drivers. A list of data types were extracted and moved there: qemuDomainPCIAddressBus -> virDomainPCIAddressBus qemuDomainPCIAddressBusPtr -> virDomainPCIAddressBusPtr _qemuDomainPCIAddressSet -> virDomainPCIAddressSet qemuDomainPCIAddressSetPtr -> virDomainPCIAddressSetPtr qemuDomainPCIConnectFlags -> virDomainPCIConnectFlags Also, move the related definitions and macros.
-
- 06 5月, 2014 2 次提交
-
-
由 Laine Stump 提交于
This uses the new QEMU_CAPS_HOST_PCI_MULTIDOMAIN capability when present, for -devivce pci-assign, -device vfio-pci, and -pcidevice. While creating tests for this new functionality, I noticed that the xmls for two existing tests had erroneously specified an until-now-ignored domain="0x0002", so I corrected those two tests, and also added two failure tests to be sure that we alert users who attempt to use a non-zero domain with a qemu that doesn't support it.
-
由 Julio Faracco 提交于
In "src/util/" there are many enumeration (enum) declarations. Sometimes, it's better using a typedef for variable types, function types and other usages. Other enumeration will be changed to typedef's in the future. Signed-off-by: NJulio Faracco <jcfaracco@gmail.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 22 4月, 2014 1 次提交
-
-
由 Nehal J Wani 提交于
Fix minor typos in source comments Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 09 4月, 2014 2 次提交
-
-
由 Peter Krempa 提交于
The function isn't used in any other file. Convert it to static.
-
由 Peter Krempa 提交于
Refactor the function to avoid multiple wrappers splitting identical fields from the now common metadata struct. The refactor is done by folding in the wrapper used for disk sources which allows us to lookup secrets via the secret driver. This may allow using stored secrets for snapshot disk images too in the future.
-
- 08 4月, 2014 1 次提交
-
-
由 Daniel P. Berrange 提交于
Since it is an abbreviation, USB should always be fully capitalized or full lower case, never Usb. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 02 4月, 2014 1 次提交
-
-
由 Eric Blake 提交于
Continuing the refactoring of host-side storage descriptions out of conf/domain_conf and into util/virstoragefile, this patch focuses on details about a host name/port/transport as used by a network storage volume. * src/conf/domain_conf.h (virDomainDiskProtocolTransport) (virDomainDiskHostDef, virDomainDiskHostDefClear) (virDomainDiskHostDefFree, virDomainDiskHostDefCopy): Move... * src/util/virstoragefile.h (virStorageNetHostTransport) (virStorageNetHostDef, virStorageNetHostDefClear) (virStorageNetHostDefFree, virStorageNetHostDefCopy): ...here, with better names. * src/util/virstoragefile.c (virStorageNetHostDefClear) (virStorageNetHostDefFree, virStorageNetHostDefCopy): Moved from... * src/conf/domain_conf.c (virDomainDiskHostDefClear) (virDomainDiskHostDefFree, virDomainDiskHostDefCopy): ...here. (virDomainDiskSourceDefClear, virDomainDiskSourceDefParse) (virDomainDiskSourceDefFormatInternal): Adjust callers. * src/conf/snapshot_conf.h (_virDomainSnapshotDiskDef): Likewise. * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefClear): Likewise. * src/qemu/qemu_command.c (qemuAddRBDHost) (qemuParseDriveURIString, qemuParseNBDString) (qemuBuildNetworkDriveURI, qemuParseCommandLineDisk) (qemuParseCommandLine, qemuGetDriveSourceString): Likewise. * src/qemu/qemu_command.h: Likewise. * src/qemu/qemu_conf.c (qemuAddISCSIPoolSourceHost) (qemuTranslateDiskSourcePool): Likewise. * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateSingleDiskActive) (qemuDomainSnapshotUndoSingleDiskActive): Likewise. * src/storage/storage_backend_gluster.c (virStorageFileBackendGlusterInit): Likewise. * src/storage/storage_driver.c (virStorageFileFree) (virStorageFileInitInternal): Likewise. * src/storage/storage_driver.h (_virStorageFile): Likewise. * src/libvirt_private.syms (domain_conf.h): Move symbols... (virstoragefile.h): ...as appropriate. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 15 3月, 2014 1 次提交
-
-
由 Cole Robinson 提交于
-S causes qemu to start in the paused state. Since XML2Native is intended to generate something that users can run directly, this will trip them up.
-
- 14 2月, 2014 1 次提交
-
-
由 Peter Krempa 提交于
Add support for gluster backed images as sources for snapshots in the qemu driver. This will also simplify adding further network backed volumes as sources for snapshot in case qemu will support them.
-
- 30 1月, 2014 1 次提交
-
-
由 Osier Yang 提交于
To support passing the path of the test data to the utils, one more argument is added to virSCSIDeviceGetSgName, virSCSIDeviceGetDevName, and virSCSIDeviceNew, and the related code is changed accordingly. Later tests for the scsi utils will be based on this patch. Signed-off-by: NOsier Yang <jyang@redhat.com>
-
- 09 1月, 2014 1 次提交
-
-
由 Michal Privoznik 提交于
Yet another advice appeared on the Multiqueue wiki page: http://www.linux-kvm.org/page/Multiqueue#Enable_MQ_feature We should add vectors=N onto the qemu command line, where N = 2 * (number of queues) + 1.
-
- 03 12月, 2013 1 次提交
-
-
由 Peter Krempa 提交于
The snapshot code will need to use qemu-style formatted URIs of network disks. Split out the code to avoid duplication.
-
- 18 10月, 2013 1 次提交
-
-
由 Wang Yufei 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1019053 When we migrate vms concurrently, there's a chance that libvirtd on destination assigns the same port for different migrations, which will lead to migration failure during prepare phase on destination. So we use virPortAllocator here to solve the problem. Signed-off-by: NWang Yufei <james.wangyufei@huawei.com> Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
-
- 25 9月, 2013 1 次提交
-
-
由 Laine Stump 提交于
Part of the resolution to: https://bugzilla.redhat.com/show_bug.cgi?id=1003983 Although most devices available in qemu area defined as PCI devices, and strictly speaking should only be attached via a PCI slot, in practice qemu allows them to be attached to a PCIe slot and sometimes this makes sense. For example, The UHCI and EHCI USB controllers are usually attached directly to the PCIe "root complex" (i.e. PCIe slots) on real hardware, so that should be possible for a Q35-based qemu virtual machine as well. We still want to prefer a standard PCI slot when auto-assigning addresses, though, and in general to disallow attaching PCI devices via PCIe slots. This patch makes that possible by adding a new QEMU_PCI_CONNECT_TYPE_EITHER_IF_CONFIG flag. Three things are done with this flag: 1) It is set for the "pcie-root" controller 2) qemuCollectPCIAddress() now has a set of nested switches that set this "EITHER" flag for devices that we want to allow connecting to pcie-root when specifically requested in the config. 3) qemuDomainPCIAddressFlagsCompatible() adds this new flag to the "flagsMatchMask" if the address being checked came from config rather than being newly auto-allocated by libvirt (this knowledge is conveniently already available in the "fromConfig" arg). Now any device having the EITHER flag set can be connected to pcie-root if explicitly requested, but auto-allocated addresses for those devices will still be standard PCI slots instead. This patch only loosens the restrictions on devices that have been specifically requested, but the setup is such that it should be fairly easy to add new devices.
-
- 24 9月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
Most callers of qemuParseKeywords were assigning its return value to a 'size_t' variable. Then then also checked '< 0' for error condition, but this will never be true with the unsigned size_t variable. Rather than using 'ssize_t', change qemuParseKeywords so that the element count is returned via an output parameter, leaving the return value solely as an error indicator. This avoids a crash accessing beyond the end of an error upon OOM. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 05 9月, 2013 1 次提交
-
-
由 Eric Blake 提交于
No need to open code now that we have a nice function. Interestingly, our virStringFreeList function is typed correctly (a malloc'd list of malloc'd strings is NOT const, whether at the point where it is created, or at the point where it is cleand up), so using it with a 'const char **' argument would require a cast to keep the compiler. I chose instead to remove const from code even where we don't modify the argument, just to avoid the need to cast. * src/qemu/qemu_command.h (qemuParseCommandLine): Drop declaration. * src/qemu/qemu_command.c (qemuParseProcFileStrings) (qemuStringToArgvEnv): Don't force malloc'd result to be const. (qemuParseCommandLinePid, qemuParseCommandLineString): Simplify cleanup. (qemuParseCommandLine, qemuFindEnv): Drop const-correctness to avoid the need to cast in callers. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 22 8月, 2013 1 次提交
-
-
由 Michal Privoznik 提交于
If user requested multiqueue networking, beside multiple /dev/tap and /dev/vhost-net openings, we forgot to pass mq=on onto the -device virtio-net-pci command line. This is advised at: http://www.linux-kvm.org/page/Multiqueue#Enable_MQ_feature
-
- 06 8月, 2013 2 次提交
-
-
由 Laine Stump 提交于
We had been setting the device alias in the devinceinfo for pci controllers to "pci%u", but then hardcoding "pci.%u" when creating the device address for other devices using that pci bus. This all worked just fine until we encountered the built-in "pcie.0" bus (the PCIe root complex) in Q35 machines. In order to create the correct commandline for this one case, this patch: 1) sets the alias for PCI controllers correctly, to "pci.%u" (or "pcie.%u" for the pcie-root controller) 2) eliminates the hardcoded "pci.%u" for pci controllers when generatuing device address strings, and instead uses the controller's alias. 3) plumbs a pointer to the virDomainDef all the way down to qemuBuildDeviceAddressStr. This was necessary in order to make the aliase of the controller *used by a device* available (previously qemuBuildDeviceAddressStr only had the deviceinfo of the device itself, *not* of the controller it was connecting to). This made for a larger than desired diff, but at least in the future we won't have to do it again, since all the information we could possibly ever need for future enhancements is in the virDomainDef. (right?) This should be done for *all* controllers, but for now we just do it in the case of PCI controllers, to reduce the likelyhood of regression.
-
由 Laine Stump 提交于
This controller is implicit on q35 machinetypes. It provides 31 PCIe (*not* PCI) slots as controller 0. Currently there are no devices that can connect to pcie-root, and no implicit pci controller on a q35 machine, so q35 is still unusable. For a usable q35 system, we need to add a "dmi-to-pci-bridge" pci controller, which can connect to pcie-root, and provides standard pci slots that can be used to connect other devices.
-
- 04 8月, 2013 2 次提交
-
-
由 Laine Stump 提交于
* The functions qemuDomainPCIAddressReserveAddr and qemuDomainPCIAddressReserveSlot were very similar (and should have been more similar) and were about to get more code added to them which would create even more duplicated code, so this patch gives qemuDomainPCIAddressReserveAddr a "reserveEntireSlot" arg, then replaces the body of qemuDomainPCIAddressReserveSlot with a call to qemuDomainPCIAddressReserveAddr. You will notice that addrs->lastaddr was previously set in qemuDomainPCIAddressReserveAddr (but *not* set in qemuDomainPCIAddressReserveSlot). For consistency and cleanliness of code, that bit was removed and put into the one caller of qemuDomainPCIAddressReserveAddr (there is a similar place where the caller of qemuDomainPCIAddressReserveSlot sets lastaddr). This does guarantee identical functionality to pre-patch code, but in practice isn't really critical, because lastaddr is just keeping track of where to start when looking for a free slot - if it isn't updated, we will just start looking on a slot that's already occupied, then skip up to one that isn't. * qemuCollectPCIAddress was essentially doing the same thing as qemuDomainPCIAddressReserveAddr, but with some extra special case checking at the beginning. The duplicate code has been replaced with a call to qemuDomainPCIAddressReserveAddr. This required adding a "fromConfig" boolean, which is only used to change the log error code from VIR_ERR_INTERNAL_ERROR (when the address was auto-generated by libvirt) to VIR_ERR_XML_ERROR (when the address is coming from the config); without this differentiation, it would be difficult to tell if an error was caused by something wrong in libvirt's auto-allocate code or just bad config. * the bit of code in qemuDomainPCIAddressValidate that checks the connect type flags is going to be used in a couple more places where we don't need to also check the slot limits (because we're generating the slot number ourselves), so that has been pulled out into a separate qemuDomainPCIAddressFlagsCompatible function.
-
由 Laine Stump 提交于
* qemuDomainPCIAddressSetNextAddr The name of this function was confusing because 1) other functions in the file that end in "Addr" are only operating on a single function of one PCI slot, not the entire slot, while functions that do something with the entire slot end in "Slot", and 2) it didn't contain a verb describing what it is doing (the "Set" refers to the set that contains all PCI buses in the system, used to keep track of which slots in which buses are already reserved for use). It is now renamed to qemuDomainPCIAddressReserveNextSlot, which more clearly describes what it is doing. Arguably, it could have been changed to qemuDomainPCIAddressSetReserveNextSlot, but 1) the word "set" is confusing in this context because it could be intended as a verb or as a noun, and 2) most other functions that operate on a single slot or address within this set are also named qemuDomainPCIAddress... rather than qemuDomainPCIAddressSet... Only the Create, Free, and Grow functions for an address set (which modify the entire set, not just one element) use "Set" in their name. * qemuPCIAddressAsString, qemuPCIAddressValidate All the other functions in this set are named qemuDomainPCIAddressxxxxx, so I renamed these to be consistent.
-
- 24 7月, 2013 1 次提交
-
-
由 Laine Stump 提交于
Since PCI bridges, PCIe bridges, PCIe switches, and PCIe root ports all share the same namespace, they are all defined as controllers of type='pci' in libvirt (but with a differing model attribute). Each of these controllers has a certain connection type upstream, allows certain connection types downstream, and each can either allow a single downstream connection at slot 0, or connections from slot 1 - 31. Right now, we only support the pci-root and pci-bridge devices, both of which only allow PCI devices to connect, and both which have usable slots 1 - 31. In preparation for adding other types of controllers that have different capabilities, this patch 1) adds info to the qemuDomainPCIAddressBus object to indicate the capabilities, 2) sets those capabilities appropriately for pci-root and pci-bridge devices, and 3) validates that the controller being connected to is the proper type when allocating slots or validating that a user-selected slot is appropriate for a device.. Having this infrastructure in place will make it much easier to add support for the other PCI controller types. While it would be possible to do all the necessary checking by just storing the controller model in the qemyuDomainPCIAddressBus, it greatly simplifies all the validation code to also keep a "flags", "minSlot" and "maxSlot" for each - that way we can just check those attributes rather than requiring a nearly identical switch statement everywhere we need to validate compatibility. You may notice many places where the flags are seemingly hard-coded to QEMU_PCI_CONNECT_HOTPLUGGABLE | QEMU_PCI_CONNECT_TYPE_PCI This is currently the correct value for all PCI devices, and in the future will be the default, with small bits of code added to change to the flags for the few devices which are the exceptions to this rule. Finally, there are a few places with "FIXME" comments. Note that these aren't indicating places that are broken according to the currently supported devices, they are places that will need fixing when support for new PCI controller models is added. To assure that there was no regression in the auto-allocation of PCI addresses or auto-creation of integrated pci-root, ide, and usb controllers, a new test case (pci-bridge-many-disks) has been added to both the qemuxml2argv and qemuxml2xml tests. This new test defines a domain with several dozen virtio disks but no pci-root or pci-bridges. The .args file of the new test case was created using libvirt sources from before this patch, and the test still passes after this patch has been applied.
-
- 17 7月, 2013 1 次提交
-
-
由 Jiri Denemark 提交于
-
- 12 7月, 2013 2 次提交
-
-
由 Michal Privoznik 提交于
The function being introduced is responsible for creating command line argument for '-device' for given character device. Based on the chardev type, it calls appropriate qemuBuild.*ChrDeviceStr(), e.g. qemuBuildSerialChrDeviceStr() for serial chardev and so on.
-
由 Michal Privoznik 提交于
The chardev alias assignment is going to be needed in a separate places, so it should be moved into a separate function rather than copying code randomly around.
-
- 22 5月, 2013 1 次提交
-
-
由 Michal Privoznik 提交于
In order to learn libvirt multiqueue several things must be done: 1) The '/dev/net/tun' device needs to be opened multiple times with IFF_MULTI_QUEUE flag passed to ioctl(fd, TUNSETIFF, &ifr); 2) Similarly, '/dev/vhost-net' must be opened as many times as in 1) in order to keep 1:1 ratio recommended by qemu and kernel folks. 3) The command line construction code needs to switch from 'fd=X' to 'fds=X:Y:...:Z' and from 'vhostfd=X' to 'vhostfds=X:Y:...:Z'. 4) The monitor handling code needs to learn to pass multiple FDs.
-
- 20 5月, 2013 1 次提交
-
-
由 Osier Yang 提交于
Since 0d70656a, it starts to access the sysfs files to build the qemu command line (by virSCSIDeviceGetSgName, which is to find out the scsi generic device name by adpater:bus:target:unit), there is no way to work around, qemu wants to see the scsi generic device like "/dev/sg6" anyway. And there might be other places which need to access sysfs files when building qemu command line in future. Instead of increasing the arguments of qemuBuildCommandLine, this introduces a new callback for qemuBuildCommandLine, and thus tests can register their own callbacks for sysfs test input files accessing. * src/qemu/qemu_command.h: (New callback struct qemuBuildCommandLineCallbacks; extern buildCommandLineCallbacks) * src/qemu/qemu_command.c: (wire up the callback struct) * src/qemu/qemu_driver.c: (Use the new syntax of qemuBuildCommandLine) * src/qemu/qemu_hotplug.c: Likewise * src/qemu/qemu_process.c: Likewise * tests/testutilsqemu.[ch]: (Helper testSCSIDeviceGetSgName; callback struct testCallbacks;) * tests/qemuxml2argvtest.c: (Use testCallbacks) * src/tests/qemuxmlnstest.c: (Like above)
-
- 15 5月, 2013 1 次提交
-
-
由 Martin Kletzander 提交于
Adding a VNC WebSocket support for QEMU driver. This functionality is in upstream qemu from commit described as v1.3.0-982-g7536ee4, so the capability is being recognized based on QEMU version for now.
-
- 13 5月, 2013 1 次提交
-
-
由 Han Cheng 提交于
Except the scsi host device's controller is "lsilogic", mapping between the libvirt attributes and scsi-generic properties is: libvirt qemu ----------------------------------------- controller bus ($libvirt_controller.0) bus channel target scsi-id unit lun For scsi host device with "lsilogic" controller, the mapping is: ('target (libvirt)' must be 0, as it's not used; 'unit (libvirt) must <= 7). libvirt qemu ---------------------------------------------------------- controller && bus bus ($libvirt_controller.$libvirt_bus) unit scsi-id It's not good to hardcode/hard-check limits of these attributes, and even worse, these limits are not documented, one has to find out by either testing or reading the qemu code, I'm looking forward to qemu expose limits like these one day). For example, exposing "max_target", "max_lun" for megasas: static const struct SCSIBusInfo megasas_scsi_info = { .tcq = true, .max_target = MFI_MAX_LD, .max_lun = 255, .transfer_data = megasas_xfer_complete, .get_sg_list = megasas_get_sg_list, .complete = megasas_command_complete, .cancel = megasas_command_cancel, }; Example of the qemu command line (lsilogic controller): -drive file=/dev/sg2,if=none,id=drive-hostdev-scsi_host7-0-0-0 \ -device scsi-generic,bus=scsi0.0,scsi-id=8,\ drive=drive-hostdev-scsi_host7-0-0-0,id=hostdev-scsi_host7-0-0-0 Example of the qemu command line (virtio-scsi controller): -drive file=/dev/sg2,if=none,id=drive-hostdev-scsi_host7-0-0-0 \ -device scsi-generic,bus=scsi0.0,channel=0,scsi-id=128,lun=128,\ drive=drive-hostdev-scsi_host7-0-0-0,id=hostdev-scsi_host7-0-0-0 Signed-off-by: NHan Cheng <hanc.fnst@cn.fujitsu.com> Signed-off-by: NOsier Yang <jyang@redhat.com>
-
- 07 5月, 2013 1 次提交
-
-
由 Laine Stump 提交于
VFIO device assignment requires a cgroup ACL to be setup for access to the /dev/vfio/nn "group" device for any devices that will be assigned to a guest. In the case of a host device that is allocated from a pool, it was being allocated during qemuBuildCommandLine(), which is called by qemuProcessStart() *after* the all-encompassing qemuSetupCgroup() was called, meaning that the standard Cgroup ACL setup wasn't creating ACLs for these devices allocated from pools. One possible solution was to manually add a single ACL down inside qemuBuildCommandLine() when networkAllocateActualDevice() is called, but that has two problems: 1) the function that adds the cgroup ACL requires a virDomainObjPtr, which isn't available in qemuBuildCommandLine(), and 2) we really shouldn't be doing network device setup inside qemuBuildCommandLine() anyway. Instead, I've created a new function called qemuNetworkPrepareDevices() which is called just before qemuPrepareHostDevices() during qemuProcessStart() (explanation of ordering in the comments), i.e. well before the call to qemuSetupCgroup(). To minimize code churn in a patch that will be backported to 1.0.5-maint, qemuNetworkPrepareDevices only does networkAllocateActualDevice() and the bare amount of setup required for type='hostdev network devices, but it eventually should do *all* device setup for guest network devices. Note that some of the code that was previously needed in qemuBuildCommandLine() is no longer required when networkAllocateActualDevice() is called earlier: * qemuAssignDeviceHostdevAlias() is already done further down in qemuProcessStart(). * qemuPrepareHostdevPCIDevices() is called by qemuPrepareHostDevices() which is called after qemuNetworkPrepareDevices() in qemuProcessStart(). As hinted above, this new function should be moved into a separate qemu_network.c (or similarly named) file along with qemuPhysIfaceConnect(), qemuNetworkIfaceConnect(), and qemuOpenVhostNet(), and expanded to call those functions as well, then the nnets loop in qemuBuildCommandLine() should be reduced to only build the commandline string (which itself can be in a separate qemuInterfaceBuilldCommandLine() function as suggested by Michal). However, this will require storing away an array of tapfd and vhostfd that are needed for the commandline, so I would rather do that in a separate patch and leave this patch at the minimum to fix the bug.
-
- 27 4月, 2013 1 次提交
-
-
由 Paolo Bonzini 提交于
<source type='bridge'> uses a helper application to do the necessary TUN/TAP setup to use an existing network bridge, thus letting unprivileged users use TUN/TAP interfaces. However, libvirt should be preventing QEMU from running any setuid programs at all, which would include this helper program. From a security POV, any setuid helper needs to be run by libvirtd itself, not QEMU. This is what this patch does. libvirt now invokes the setuid helper, gets the TAP fd and then passes it to QEMU in the normal manner. The path to the helper is specified in qemu.conf. As a small advantage, this adds a <target dev='tap0'/> element to the XML of an active domain using <interface type='bridge'>. Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
-
- 25 4月, 2013 1 次提交
-
-
由 Ján Tomko 提交于
Add a "dry run" address allocation to figure out how many bridges will be needed for all the devices without explicit addresses. Auto-add just enough bridges to put all the devices on, or up to the bridge with the largest specified index.
-