aboutsummaryrefslogtreecommitdiff
path: root/src/qemu
Commit message (Collapse)AuthorAgeFilesLines
* qemu: Pin the emulator when only cpuset is specifiedMartin Kletzander2012-10-174-20/+28
| | | | | | | | According to our recent changes (clarifications), we should be pinning qemu's emulator processes using the <vcpu> 'cpuset' attribute in case there is no <emulatorpin> specified. This however doesn't work entirely as expected and this patch should resolve all the remaining issues.
* qemu: Clear async job when p2p migration fails earlyJiri Denemark2012-10-171-2/+2
| | | | | | | | | | When p2p migration fails early because qemuMigrationIsAllowed or qemuMigrationIsSafe say migration should be cancelled, we fail to clear the migration-out async job. As a result of that, further APIs called for the same domain may fail with Timed out during operation: cannot acquire state change lock. Reported by Guido Winkelmann.
* Fix potential deadlock when agent is closedDaniel P. Berrange2012-10-051-9/+3
| | | | | | | | | | | | | If the qemuAgentClose method is called from a place which holds the domain lock, it is theoretically possible to get a deadlock in the agent destroy callback. This has not been observed, but the equivalent code in the QEMU monitor destroy callback has seen a deadlock. Remove the redundant locking while unrefing the object and the bogus assignment Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Fix (rare) deadlock in QEMU monitor callbacksDaniel P. Berrange2012-10-051-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some users report (very rarely) seeing a deadlock in the QEMU monitor callbacks Thread 10 (Thread 0x7fcd11e20700 (LWP 26753)): #0 0x00000030d0e0de4d in __lll_lock_wait () from /lib64/libpthread.so.0 #1 0x00000030d0e09ca6 in _L_lock_840 () from /lib64/libpthread.so.0 #2 0x00000030d0e09ba8 in pthread_mutex_lock () from /lib64/libpthread.so.0 #3 0x00007fcd162f416d in virMutexLock (m=<optimized out>) at util/threads-pthread.c:85 #4 0x00007fcd1632c651 in virDomainObjLock (obj=<optimized out>) at conf/domain_conf.c:14256 #5 0x00007fcd0daf05cc in qemuProcessHandleMonitorDestroy (mon=0x7fcccc0029e0, vm=0x7fcccc00a850) at qemu/qemu_process.c:1026 #6 0x00007fcd0db01710 in qemuMonitorDispose (obj=0x7fcccc0029e0) at qemu/qemu_monitor.c:249 #7 0x00007fcd162fd4e3 in virObjectUnref (anyobj=<optimized out>) at util/virobject.c:139 #8 0x00007fcd0db027a9 in qemuMonitorClose (mon=<optimized out>) at qemu/qemu_monitor.c:860 #9 0x00007fcd0daf61ad in qemuProcessStop (driver=driver@entry=0x7fcd04079d50, vm=vm@entry=0x7fcccc00a850, reason=reason@entry=VIR_DOMAIN_SHUTOFF_DESTROYED, flags=flags@entry=0) at qemu/qemu_process.c:4057 #10 0x00007fcd0db323cf in qemuDomainDestroyFlags (dom=<optimized out>, flags=<optimized out>) at qemu/qemu_driver.c:1977 #11 0x00007fcd1637ff51 in virDomainDestroyFlags ( domain=domain@entry=0x7fccf00c1830, flags=1) at libvirt.c:2256 At frame #10 we are holding the domain lock, we call into qemuProcessStop() to cleanup QEMU, which triggers the monitor to close, which invokes qemuProcessHandleMonitorDestroy() which tries to obtain the domain lock again. This is a non-recursive lock, hence hang. Since qemuMonitorPtr is a virObject, the unref call in qemuProcessHandleMonitorDestroy no longer needs mutex protection. The assignment of priv->mon = NULL, can be instead done by the caller of qemuMonitorClose(), thus removing all need for locking. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Remove redundant lines in src/qemu/qemu_driver.cTang Chen2012-09-211-18/+0
| | | | | | | maxcpu and hostcpus are defined and calculated in qemudDomainPinVcpuFlags() and qemudDomainPinEmulator(), but never used. So remove them including nodeinfo. Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
* qemu: Fix failure path in disk hotplugJiri Denemark2012-09-211-4/+10
| | | | | | Disk hotplug is a two phase action: qemuMonitorAddDrive followed by qemuMonitorAddDevice. When the first part succeeds but the second one fails, we need to rollback the drive addition.
* Remove a redundant line in src/qemu/qemu_driver.cTang Chen2012-09-211-1/+0
| | | | Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
* maint: fix up copyright notice inconsistenciesEric Blake2012-09-2030-30/+30
| | | | | | | | | https://www.gnu.org/licenses/gpl-howto.html recommends that the 'If not, see <url>.' phrase be a separate sentence. * tests/securityselinuxhelper.c: Remove doubled line. * tests/securityselinuxtest.c: Likewise. * globally: s/; If/. If/
* qemu: add support for dump-guest-core optionMartin Kletzander2012-09-203-9/+76
| | | | | | | | | | | | | | The "dump-guest-core' option is new option for the machine type (-machine pc,dump-guest-core) that controls whether the guest memory will be marked as dumpable. While testing this, I've found out that the value for the '-M' options is not parsed correctly when additional parameters are used. However, when '-machine' is used for the same options, it gets parsed as expected. That's why this patch also modifies the parsing and creating of the command line, so both '-M' and '-machine' are recognized. In QEMU's help there is only mention of the 'machine parameter now with no sign of the older '-M'.
* qemu: Add support for reboot-timeoutMartin Kletzander2012-09-203-0/+36
| | | | | This patch adds support for "-boot reboot-timeout=rb_time" that is added in QEMU.
* qemu: Cleanup boot parameter buildingMartin Kletzander2012-09-201-25/+68
| | | | | | | | | | | | | | | | | | | | | | This patch cleans up building the "-boot" parameter and while on that fixes one inconsistency by modifying these things: - I completed the unfinished virDomainBootMenu enum by specifying LAST, declaring it and also declaring the TypeFromString and TypeToString parameters. - Previously mentioned TypeFromString and TypeToString are used when parsing the XML. - Last, but not least, visible change is that the "-boot" parameter is built and parsed properly: - The "order=" prefix is used only when additional parameters are used (menu, etc.). - It's rewritten in a way that other parameters can be added easily in the future (used in following patch). - The "order=" parameter is properly parsed regardless to where it is placed in the string (e.g. "menu=on,order=nc"). - The "menu=" parameter (and others in the future) are created when they should be (i.e. even when bootindex is supported and used, but not when bootloader is selected).
* qemu: Transition domain to PAUSED after 'stop' commandMichal Privoznik2012-09-201-6/+1
| | | | | | | | | | Currently, we mark domain PAUSED (but not emit an event) just before we issue 'stop' on monitor; This command can take ages to finish, esp. when domain's doing a lot of IO - users can enforce qemu to open files with O_DIRECT which doesn't return from write() until data reaches the block device. Having said that, we report PAUSED even if domain is not paused yet.
* virBitmap: fix build without HAVE_NUMACTLJán Tomko2012-09-181-1/+1
| | | | | | Commit 75b198b3e7b2c8b4106afbd42f8bb795c4773511 forgot to change arguments of dummy qemuProcessInitNumaMemoryPolicy from char* to virBitmapPtr.
* Fix the augea test for qemu libvirtd optionsDaniel Veillard2012-09-181-0/+1
| | | | | Commit 1ccf22277be013beb3f26f0083867c9c9eddca18 forgot to add the output to the augeas test
* qemu: add -sandbox to command line if requestedJán Tomko2012-09-181-0/+11
|
* qemu: conf: add seccomp_sandbox optionJán Tomko2012-09-184-0/+15
|
* qemu: add capability flag for seccomp sandboxJán Tomko2012-09-182-0/+4
| | | | | | This series adds support to run QEMU with seccomp sandbox enabled. It can be configured in qemu.conf to on, off, or the QEMU default, which is off in 1.2. Default value is the QEMU default.
* qemu: Avoid deadlock on HandleAgentEOFMichal Privoznik2012-09-181-3/+3
| | | | | | | | On agent EOF the qemuProcessHandleAgentEOF() callback is called which locks virDomainObjPtr. Then qemuAgentClose() is called (with domain object locked) which eventually calls qemuAgentDispose() and qemuProcessHandleAgentDestroy(). This tries to lock the domain object again. Hence the deadlock.
* qemu: Use disk wwn in qemu command lineOsier Yang2012-09-181-0/+33
| | | | | | | | | | | | | | All of ide-drive, ide-hd, ide-cd, scsi-disk, scsi-hd, and scsi-cd supports wwn property. (NB, scsi-block doesn't support to set wwn). * src/qemu/qemu_command.c: Error out if underlying QEMU doesn't support wwn property for the device; Set wwn for the device otherwise. * tests/qemuxml2argvdata/qemuxml2argv-disk-ide-wwn.args: New test * tests/qemuxml2argvdata/qemuxml2argv-disk-ide-wwn.xml: Likewise * tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-wwn.args: Likewise * tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-disk-wwn.xml: Likewise * tests/qemuxml2argvtest.c: Add the new tests.
* qemu: Add caps to indentify if setting wwn is supported by qemuOsier Yang2012-09-182-0/+10
| | | | | | | This assumes ide-drive.wwn, ide-hd.wwn, ide-cd.wwn were supported at the same time, similar for scsi-disk.wwn, scsi-hd.wwn, and scsi-cd.wwn. So only two new caps (QEMU_CAPS_IDE_DRIVE_WWN, and QEMU_CAPS_SCSI_DISK_WWN) are introduced.
* qemu: drop unused arguments for dump-guest-memoryEric Blake2012-09-175-40/+14
| | | | | | | | | | | | | | | | | Upstream qemu has raised a concern about whether dumping guest memory by reading guest paging tables is a security hole: https://lists.gnu.org/archive/html/qemu-devel/2012-09/msg02607.html While auditing libvirt to see if we would be impacted, I noticed that we had some dead code. It is simpler to nuke the dead code and limit our monitor code to just the subset we make use of. * src/qemu/qemu_monitor.h (QEMU_MONITOR_DUMP): Drop poorly named and mostly-unused enum. * src/qemu/qemu_monitor.c (qemuMonitorDumpToFd): Drop arguments. * src/qemu/qemu_monitor_json.h (qemuMonitorJSONDump): Likewise. * src/qemu/qemu_monitor_json.c (qemuMonitorJSONDump): Likewise. * src/qemu/qemu_driver.c (qemuDumpToFd): Update caller.
* use virBitmap to store nodeinfo.Hu Tao2012-09-171-7/+12
|
* use virBitmap to store cells' cpumask info.Hu Tao2012-09-171-36/+7
|
* use virBitmap to store cpumask info.Hu Tao2012-09-171-7/+5
|
* use virBitmap to store numa nodemask info.Hu Tao2012-09-174-75/+44
|
* use virBitmap to store cpu affinity infoHu Tao2012-09-172-95/+52
|
* use virBitmap to store cpupin infoHu Tao2012-09-173-24/+28
|
* bitmap: new member variable and function renamingHu Tao2012-09-172-2/+2
| | | | | | | Add a new member variable map_len to store map len of bitmap. and rename size to max_bit accordingly. rename virBitmapAlloc to virBitmapNew.
* node_memory: Support get/set memory parameters for driversOsier Yang2012-09-171-0/+2
| | | | Including QEMU, LXC, UML, XEN drivers.
* Add missing 'goto error' in QEMU command line buildingDaniel P. Berrange2012-09-141-0/+2
| | | | | If reporting case of a binary not supporting KVM or kQEMU, libvirt forgot to jump to the error branch for cleanup
* Fix initialization of virCommandPtr when creating QEMU argvDaniel P. Berrange2012-09-141-1/+7
| | | | | | | If the qemuBuildCommandLine method raised an error before the virCommandPtr instance was created, the local var would not be initialized, resulting in a possible SEGV in the error cleanup branch. Also add some debugging of the method params
* qemu: fix uninitialized variable in qemuParseCommandLineJán Tomko2012-09-141-2/+1
| | | | Newly added if branch for kvm_pv_eoi did not set the ret variable.
* Introduce a API for creating QEMU capabilities for a binaryDaniel P. Berrange2012-09-142-0/+139
| | | | | | | | | | Introduce a qemuCapsNewForBinary() API which creates a new QEMU capabilities object, populated with data relating to a specific QEMU binary. The qemuCaps object is also given a timestamp, which makes it possible to detect when the cached capabilities for a binary are out of date Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Remove upfront check for hmp - just try it cope with failureDaniel P. Berrange2012-09-144-59/+29
| | | | | | | Don't bother checking for the existance of the HMP passthrough command. Just try to execute it, and propagate the failure. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Don't overwrite errors raised by qemuMonitorHMPCommandDaniel P. Berrange2012-09-141-259/+76
| | | | | | | | The qemuMonitorHMPCommand() API and things it calls will report a wide variety of errors. The QEMU text monitor should not be overwriting these errors Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* qemu: Add support for EOI with APICMartin Kletzander2012-09-141-0/+17
| | | | | | | | | This patch adds full support for EOI setting for domains. Because this is CPU feature (flag), the model needs to be added even when it's not specified. Fortunately this problem was already solved with kvmclock, so this patch simply abuses that. And due to the size of the patch (17 lines) I dared to include the tests.
* snapshot: fix rollback failure in transaction modeGuannan Ren2012-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BZ:https://bugzilla.redhat.com/show_bug.cgi?id=843372 when qemu supports the 'transaction' monitor command, and libvirt's --reuse-ext flag was not specified, libvirt created a stub file with zero size in first place. After the failure of QEMU transaction command performing qcow2 snapshots on more than one drives, the stub file is left behind with non-empty by the QEMU transaction command. In order to unlink the file, the patch removes the file size checking. Steps to reproduce the issue: Steps: 1, Create a qemu instance with two drive images of qcow2 type (root user) /usr/libexec/qemu-kvm -m 1024 -smp 1 -name "rhel6u1" \ -drive file=/var/lib/libvirt/images/firstqcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -drive file=/var/lib/libvirt/images/secondqcow2,if=none,id=drive-virtio-disk1,format=qcow2,cache=none \ -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk1,id=virtio-disk1 -qmp stdio 2, Initialize qemu qmp {"execute":"qmp_capabilities"} 3, Remove the second drive image file rm -f /var/lib/libvirt/images/secondqcow2 4, Run 'transaction' command with snapshot qemu commands in. {"execute":"transaction","arguments": {"actions": [{"type":"blockdev-snapshot-sync","data": {"device":"drive-virtio-disk0","snapshot-file":"/var/lib/libvirt/images/firstqcow2-snapshot.img","format":"qcow2"} }, {"type":"blockdev-snapshot-sync","data": {"device":"drive-virtio-disk1","snapshot-file":"/var/lib/libvirt/images/secondqcow2-snapshot.img","format":"qcow2"} }] }, "id":"libvirt-6"} 5, Got the error as follows: {"id": "libvirt-6", "error": {"class": "OpenFileFailed", "desc": "Could not open '/var/lib/libvirt/images/secondqcow2-snapshot.img'", "data": {"filename": "/var/lib/libvirt/images/secondqcow2-snapshot.img"} } } 6, List first newly-created snapshot file: -rw-r--r--. 1 root root 262144 Sep 13 11:43 firstqcow2-snapshot.img
* Fix data types used for list sizes in QEMU capabilitiesDaniel P. Berrange2012-09-134-15/+15
| | | | | | | | The QEMU capabilities APIs used a misc of 'int' and 'unsigned int' for variables relating to array sizes. Change all these to use 'size_t' Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Add API for copying instances of the qemuCapsPtr objectDaniel P. Berrange2012-09-132-0/+48
| | | | | | To allow each VM instance to record additional capabilities without affecting other VMs, there needs to be a way to do a deep copy of the qemuCapsPtr object
* Add ability to store other metadata in the qemu capabilities objectDaniel P. Berrange2012-09-132-0/+88
| | | | | | | Add struct fields and APIs to allow the qemu capabilities object to store version, arch, machines & cpu names, etc Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Make qemuCapsProbeCommand staticDaniel P. Berrange2012-09-132-23/+20
| | | | | | | The qemuCapsProbeCommand API is only used by the capabilities code, so can be static Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Turn QEMU capabilities object into a full virObjectPtrDaniel P. Berrange2012-09-1314-647/+700
| | | | | | | | | | | | | The current qemu capabilities are stored in a virBitmapPtr object, whose type is exposed to callers. We want to store more data besides just the flags, so we need to move to a struct type. This object will also need to be reference counted, since we'll be maintaining a cache of data per binary. This change introduces a 'qemuCapsPtr' virObject class. Most of the change is just renaming types and variables in all the callers Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Wait to receive QMP greeting before sending any monitor commandsDaniel P. Berrange2012-09-131-1/+8
| | | | | | | | | | | Technically speaking we should wait until we receive the QMP greeting message before attempting to send any QMP monitor commands. Mostly we've got away with this, but there is a race in some QEMU which cause it to SEGV if you sent it data too soon after startup. Waiting for the QMP greeting avoids the race Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* qemu: build USB redirection filter qemu command lineGuannan Ren2012-09-133-5/+48
| | | | | | | | | | | | | | | | Input XML snip: <redirdev bus='usb' type='spicevmc'> <address type='usb' bus='0' port='4'/> </redirdev> <redirfilter> <usbdev class='0x08' vendor='0x1234' product='0xbeef' \ version='2.00' allow='yes'/> <usbdev class='-1' vendor='-1' product='-1' version='-1' allow='no'/> </redirfilter> will be converted to: -device usb-redir,chardev=charredir0,id=redir0,\ filter=0x08:0x1234:0xBEEF:0x2000:1|-1:-1:-1:-1:0,bus=usb.0,port=4
* qemu: add usb-redir.filter qemu capability flagGuannan Ren2012-09-132-0/+5
| | | | | | | | | | Add a qemu flag for USB redirection filter support. The output: usb-redir.chardev=chr usb-redir.debug=uint8 usb-redir.filter=string usb-redir.port=string
* maint: fix missing spaces in messageEric Blake2012-09-123-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | I got an off-list report about a bad diagnostic: Target network card mac 52:54:00:49:07:ccdoes not match source 52:54:00:49:07:b8 True to form, I've added a syntax check rule to prevent it from recurring, and found several other offenders. * cfg.mk (sc_require_whitespace_in_translation): New rule. * src/conf/domain_conf.c (virDomainNetDefCheckABIStability): Add space. * src/esx/esx_util.c (esxUtil_ParseUri): Likewise. * src/qemu/qemu_command.c (qemuCollectPCIAddress): Likewise. * src/qemu/qemu_driver.c (qemuDomainSetMetadata) (qemuDomainGetMetadata): Likewise. * src/qemu/qemu_hotplug.c (qemuDomainChangeNetBridge): Likewise. * src/rpc/virnettlscontext.c (virNetTLSContextCheckCertDNWhitelist): Likewise. * src/vmware/vmware_driver.c (vmwareDomainResume): Likewise. * src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc, vboxAttachDrives): Avoid false negatives. * tools/virsh-domain.c (info_save_image_dumpxml): Reword. Based on a report by Luwen Su.
* Add API for opening a QEMU monitor from a socket FDDaniel P. Berrange2012-09-122-25/+61
| | | | | | | | | | Currently qemuMonitorOpen() requires an address of the QEMU monitor. When doing QMP based capabilities detection it is easier if a pre-opened FD can be provided, since then the monitor can be run on the STDIO console. Add a new API qemuMonitorOpenFD() for such usage Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* fix bug in qemuSetupCgroupForEmulatorHu Tao2012-09-111-4/+8
| | | | Should not return 0 when failed to setup cgroup.
* Add non-null annotations to qemuMonitorOpenDaniel P. Berrange2012-09-072-2/+8
| | | | | | | Add some non-null annotations to qemuMonitorOpen and also check that the error callback is set, since it is mandatory Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Add PMSUSPENDED life cycle eventJiri Denemark2012-09-071-2/+10
| | | | | While PMSUSPENDED state was added a long time ago, we didn't have corresponding life cycle event.