- 08 9月, 2014 1 次提交
-
-
由 Peter Krempa 提交于
Be consistent with naming of private defines. Also line up code correctly in few places where the macro is used.
-
- 06 9月, 2014 5 次提交
-
-
由 Eric Blake 提交于
To date, anyone performing a block copy and pivot ends up with the destination being treated as <disk type='file'>. While this works for data access for a block device, it has at least one noticeable shortcoming: virDomainGetBlockInfo() reports allocation differently for block devices visited as files (the size of the device) than for block devices visited as <disk type='block'> (the maximum sector used, as reported by qemu); and this difference is significant when trying to manage qcow2 format on block devices that can be grown as needed. Of course, the more powerful virDomainBlockCopy() API can already express the ability to set the <disk> type. But a new API can't be backported, while a new flag to an existing API can; and it is also rather inconvenient to have to resort to the full power of generating XML when just adding a flag to the older call will do the trick. So this patch enhances blockcopy to let the user flag when the resulting XML after the copy must list the device as type='block'. * include/libvirt/libvirt.h.in (VIR_DOMAIN_BLOCK_REBASE_COPY_DEV): New flag. * src/libvirt.c (virDomainBlockRebase): Document it. * tools/virsh-domain.c (opts_block_copy, blockJobImpl): Add --blockdev option. * tools/virsh.pod (blockcopy): Document it. * src/qemu/qemu_driver.c (qemuDomainBlockRebase): Allow new flag. (qemuDomainBlockCopy): Remember the flag, and make sure it is only used on actual block devices. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Test it. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
While reviewing the new virDomainBlockCopy API, Peter Krempa pointed out that our existing design of using MiB/s for block job bandwidth is rather coarse, especially since qemu tracks it in bytes/s; so virDomainBlockCopy only accepts bytes/s. But once the new API is implemented for qemu, we will be in the situation where it is possible to set a value that cannot be accurately reflected back to the user, because the existing virDomainGetBlockJobInfo defaults to the coarser units. Fortunately, we have an escape hatch; and one that has already served us well in the past: we can use the flags argument to specify which scale to use (see virDomainBlockResize for prior art). This patch fixes the query side of the API; made easier by previous patches that split the query side out from the modification code. Later patches will address the virsh interface, as well retrofitting all other blockjob APIs to also accept a flag for toggling bandwidth units. * include/libvirt/libvirt.h.in (_virDomainBlockJobInfo) (VIR_DOMAIN_BLOCK_COPY_BANDWIDTH): Document sizing issues. (virDomainBlockJobInfoFlags): New enum. * src/libvirt.c (virDomainGetBlockJobInfo): Document new flag. * src/qemu/qemu_monitor.h (qemuMonitorBlockJobInfo): Add parameter. * src/qemu/qemu_monitor.c (qemuMonitorBlockJobInfo): Likewise. * src/qemu/qemu_monitor_json.h (qemuMonitorJSONBlockJobInfo): Likewise. * src/qemu/qemu_monitor_json.c (qemuMonitorJSONBlockJobInfo) (qemuMonitorJSONGetBlockJobInfoOne): Likewise. Don't scale here. * src/qemu/qemu_migration.c (qemuMigrationDriveMirror): Update callers. * src/qemu/qemu_driver.c (qemuDomainBlockPivot) (qemuDomainBlockJobImpl): Likewise. (qemuDomainGetBlockJobInfo): Likewise, and support new flag. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
The previous patch hoisted some bounds checks to the callers; but someone that is not aware of the hoisted check could now try passing an integer between LLONG_MAX and ULLONG_MAX. As a safety measure, add new json conversion modes that let libvirt error out early instead of pass bad numbers to qemu, if the caller ever makes a mistake due to later refactoring. Convert the various blockjob QMP calls to use the new modes, and switch some of them to be optional (QMP has always supported an omitted "speed" the same as "speed":0, for everything except block-job-set-speed). * src/qemu/qemu_monitor_json.c (qemuMonitorJSONMakeCommandRaw): Add 'j'/'y' and 'J'/'Y' to error out on negative input. (qemuMonitorJSONDriveMirror, qemuMonitorJSONBlockCommit) (qemuMonitorJSONBlockJob): Use it. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
qemu treats blockjob bandwidth as a 64-bit number, in the units of bytes/second. But we stupidly modeled block job bandwidth after migration bandwidth, which in turn was an 'unsigned long' and therefore subject to 32-bit vs. 64-bit interpretations, and with a scale of MiB/s. Our code already has to convert between the two scales, and report overflow as appropriate; although this conversion currently lives in the monitor code. In fact, our conversion code limited things to 63 bits, because we checked against LLONG_MAX and reject what would be negative bandwidth if treated as signed. On the bright side, our use of MiB/s means that even with a 32-bit unsigned long, we still have no problem representing a bandwidth of 2GiB/s, which is starting to be more feasible as 10-gigabit or even faster interfaces are used. And once you get past the physical speeds of existing interfaces, any larger bandwidth number behaves the same - effectively unlimited. But on the low side, the granularity of 1MiB/s tuning is rather coarse. So the new virDomainBlockJob API decided to go with a direct 64-bit bytes/sec number instead of the scaled number that prior blockjob APIs had used. But there is no point in rounding this number to MiB/s just to scale it back to bytes/s for handing to qemu. In order to make future code sharing possible between the old virDomainBlockRebase and the new virDomainBlockCopy, this patch moves the scaling and overflow detection into the driver code. Several of the block job calls that can set speed are fed through a common interface, so it was easier to adjust all block jobs at once, for consistency. This patch is just code motion; there should be no user-visible change in behavior. * src/qemu/qemu_monitor.h (qemuMonitorBlockJob) (qemuMonitorBlockCommit, qemuMonitorDriveMirror): Change parameter type and scale. * src/qemu/qemu_monitor.c (qemuMonitorBlockJob) (qemuMonitorBlockCommit, qemuMonitorDriveMirror): Move scaling and overflow detection... * src/qemu/qemu_driver.c (qemuDomainBlockJobImpl) (qemuDomainBlockRebase, qemuDomainBlockCommit): ...here. (qemuDomainBlockCopy): Use bytes/sec. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Another layer of overly-multiplexed code that deserves to be split into obviously separate paths for query vs. modify. This continues the cleanup started in commit cefe0ba3. In the process, make some tweaks to simplify the logic when parsing the JSON reply. There should be no user-visible semantic changes. * src/qemu/qemu_monitor.h (qemuMonitorBlockJob): Drop parameter. (qemuMonitorBlockJobInfo): New prototype. (BLOCK_JOB_INFO): Drop enum. * src/qemu/qemu_monitor_json.h (qemuMonitorJSONBlockJob) (qemuMonitorJSONBlockJobInfo): Likewise. * src/qemu/qemu_monitor.c (qemuMonitorBlockJob): Split... (qemuMonitorBlockJobInfo): ...into second function. * src/qemu/qemu_monitor_json.c (qemuMonitorJSONBlockJob): Move block info portions... (qemuMonitorJSONGetBlockJobInfo): ...here, and rename... (qemuMonitorJSONBlockJobInfo): ...and export. (qemuMonitorJSONGetBlockJobInfoOne): Alter return semantics. * src/qemu/qemu_driver.c (qemuDomainBlockPivot) (qemuDomainBlockJobImpl, qemuDomainGetBlockJobInfo): Adjust callers. * src/qemu/qemu_migration.c (qemuMigrationDriveMirror) (qemuMigrationCancelDriveMirror): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 05 9月, 2014 2 次提交
-
-
由 Eric Blake 提交于
The qemu implementation for virDomainGetBlockJobInfo() has a minor bug: it grabs the qemu job with intent to QEMU_JOB_MODIFY, which means it cannot be run in parallel with any other domain-modifying command. Among others, virDomainBlockJobAbort() is such a modifying command, and it defaults to being synchronous, and can wait as long as several seconds to ensure that the job has actually finished. Due to the job rules, this means a user cannot obtain status about the job during that timeframe, even though we know that some client management code exists which is using a polling loop on status to see when a job finishes. This bug has been present ever since blockpull support was first introduced (commit b976165c, v0.9.4 in Jul 2011), all because we stupidly tried to cram too much multiplexing through a single helper routine, but was made worse in 97c59b9c (v1.2.7) when BlockJobAbort was fixed to wait longer. It's time to disentangle some of the mess in qemuDomainBlockJobImpl, and in the process relax block job query to use QEMU_JOB_QUERY, since it can safely be used in parallel with any long running modify command. Technically, there is one case where getting block job info can modify domain XML - we do snooping to see if a 2-phase job has transitioned into the second phase, for an optimization in the case of old qemu that lacked an event for the transition. I claim this optimization is safe (the jobs are all about modifying qemu state, not necessarily xml state); but if it proves to be a problem, we could use the difference between the capabilities QEMU_CAPS_BLOCKJOB_{ASYNC,SYNC} to determine whether we even need snooping, and only request a modifying job in the case of older qemu. * src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Move info handling... (qemuDomainGetBlockJobInfo): ...here, and relax job type. (qemuDomainBlockJobAbort, qemuDomainBlockJobSetSpeed) (qemuDomainBlockRebase, qemuDomainBlockPull): Adjust callers. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
The existing virDomainBlockRebase code rejected the combination of _RELATIVE and _COPY flags, but only by accident. It makes sense to add support for the combination someday, at least for the case of _SHALLOW and not _REUSE_EXT; but to implement it, libvirt would have to pre-create the file with a relative backing name, and I'm not ready to code that in yet. Meanwhile, the code to forward on to the block copy code is getting longer, and reorganizing the function to have the block pull done early makes it easier to add even more block copy prep code. This patch should have no semantic difference other than the quality of the error message on the unsupported flag combination. Pre-patch: error: unsupported flags (0x10) in function qemuDomainBlockCopy Post-patch: error: argument unsupported: Relative backing during copy not supported yet * src/qemu/qemu_driver.c (qemuDomainBlockRebase): Reorder code, and improve error message of relative copy. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 04 9月, 2014 2 次提交
-
-
由 Eric Blake 提交于
I'm about to add a syntax check that enforces our documented HACKING style of always using matching {} on if-else statements. This commit focuses on the qemu driver. * src/qemu/qemu_command.c (qemuParseISCSIString) (qemuParseCommandLineDisk, qemuParseCommandLine) (qemuBuildSmpArgStr, qemuBuildCommandLine) (qemuParseCommandLineDisk, qemuParseCommandLineSmp): Correct use of {}. * src/qemu/qemu_capabilities.c (virQEMUCapsProbeCPUModels): Likewise. * src/qemu/qemu_driver.c (qemuDomainCoreDumpWithFormat) (qemuDomainRestoreFlags, qemuDomainGetInfo) (qemuDomainMergeBlkioDevice): Likewise. * src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise. * src/qemu/qemu_monitor_text.c (qemuMonitorTextCreateSnapshot) (qemuMonitorTextLoadSnapshot, qemuMonitorTextDeleteSnapshot): Likewise. * src/qemu/qemu_process.c (qemuProcessStop): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Wang Rui 提交于
If virSecurityManagerClearSocketLabel() fails, 'agent' won't be freed before jumping to cleanup. Signed-off-by: NWang Rui <moon.wangrui@huawei.com>
-
- 03 9月, 2014 1 次提交
-
-
由 Chunyan Liu 提交于
Add umask to _virCommand, allow user to set umask to command. Set umask(002) to qemu process to overwrite the default umask of 022 set by many distros, so that unix sockets created for virtio-serial has expected permissions. Fix problem reported here: https://sourceware.org/bugzilla/show_bug.cgi?id=13078#c11 https://bugzilla.novell.com/show_bug.cgi?id=888166 To use virtio-serial device, unix socket created for chardev with default umask(022) has insufficient permissions. e.g.: -device virtio-serial \ -chardev socket,path=/tmp/foo,server,nowait,id=foo \ -device virtserialport,chardev=foo,name=org.fedoraproject.port.0 srwxr-xr-x 1 qemu qemu 0 21. Jul 14:19 /tmp/somefile.sock Other users in the same group (like real user, test engines, etc) cannot write to this socket. Signed-off-by: NChunyan Liu <cyliu@suse.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 02 9月, 2014 1 次提交
-
-
由 Matthew Rosato 提交于
Currently, there is one flag passed in during macvtap creation (withTap) -- Let's convert this field to an unsigned int flag field for future expansion. Signed-off-by: NMatthew Rosato <mjrosato@linux.vnet.ibm.com> Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 29 8月, 2014 3 次提交
-
-
由 John Ferlan 提交于
In qemuDomainSnapshotCreateDiskActive() if we jumped to cleanup from a failed actions = virJSONValueNewArray(), then 'cfg' would be NULL. So just return -1, which in turn removes the need for cleanup:
-
由 John Ferlan 提交于
For virtio-blk-pci disks with the disk iothread attribute that are running the correct emulator, add the "iothread=iothread#" to the -device command line in order to enable iothreads for the disk as long as the command is available, the disk iothread value provided is valid, and is supported for the disk device being added
-
由 John Ferlan 提交于
Add a new capability to ensure the iothreads feature exists for the qemu emulator being run - requires the "query-iothreads" QMP command. Using the domain XML add correspoding command argument in order to generate the threads. The iothreads will use a name space "iothread#" where, the future patch to add support for using an iothread to a disk definition to merely define which of the available threads to use. Add tests to ensure the xml/argv processing is correct. Note that no change was made to qemuargv2xmltest.c as processing the -object element would require knowing more than just iothreads.
-
- 28 8月, 2014 12 次提交
-
-
由 Peter Krempa 提交于
Implement the API function for virDomainListGetStats and virConnectGetAllDomainStats in a modular way and implement the VIR_DOMAIN_STATS_STATE group of statistics. Although it may look like the function looks universal I'd rather not expose it to other drivers as the coming stats groups are likely to do qemu specific stuff to obtain the stats.
-
由 John Ferlan 提交于
One useless warning, but the other one rather pertinent. On entry the 'trans' variable is initialized to VIR_DOMAIN_DISK_TRANS_DEFAULT. When the "trans" was found in the parsing loop it def->geometry.trans was assigned to the return from virDomainDiskGeometryTransTypeFromString and then 'trans' was used to do the comparison to see if it was valid. So remove 'trans' and use def->geometry.trans properly
-
由 John Ferlan 提交于
A bunch of false positives brought on by our own doings
-
由 John Ferlan 提交于
The PROBE macro can expand to more than one line/statement - put curly braces around the if statement to be safe
-
由 John Ferlan 提交于
Coverity found that the 'buf' wasn't VIR_FREE'd at exit.
-
由 John Ferlan 提交于
Coverity determined that on error path that 'mach' wouldn't be free'd Since virCapabilitiesFreeGuestMachine() isn't globally available, we'll insert first and then if the VIR_STRDUP's fail they it will eventually cause the 'mach' to be freed in the error path
-
由 John Ferlan 提交于
Coverity found that on error paths, the 'arg' value wasn't be cleaned up. Followed the example in qemuAgentSetVCPUs() where upon successful call to qemuAgentCommand() the 'cpus' is set to NULL; otherwise, when cleanup occurs the free the memory for 'arg'
-
由 John Ferlan 提交于
In qemuParseISCSIString() if an error was returned, then the call to qemuParseDriveURIString() where the uri is free'd wouldn't be run
-
由 Wang Rui 提交于
In function virQEMUCapsParseMachineTypesStr, VIR_STRNDUP allocates memory for 'name' in {do,while} loop. If 'name' isn't freed before 'continue', its memory will be allocated again in the next loop. In this case the memory allocated for 'name' in privious loop is useless and not freed. Free it before continue this loop to fix that. Signed-off-by: NWang Rui <moon.wangrui@huawei.com>
-
由 John Ferlan 提交于
Adjust the initialization of qemuCaps() to check for a NULL before attempting to dereference like other callers/users do.
-
由 John Ferlan 提交于
The call to virDomainSnapshotRedefinePrep() had a spurrious ! in front of it which caused Coverity to complan that the expression is always false.
-
由 John Ferlan 提交于
In qemuNetworkIfaceConnect() a call to virNetDevBandwidthSet() is made where the function prototype requires the first parameter (net->ifname) to be non NULL. Coverity complains that the subsequent non NULL check for net->ifname prior to the next call gets flagged as an unnecessary check. Resolve by removing the extra check
-
- 27 8月, 2014 3 次提交
-
-
由 Jincheng Miao 提交于
In qemuDomainRevertToSnapshot(), it will check snap->def->state. But when the state is PMSUSPENDED/NOSTATE/BLOCKED, it forgets to call qemuDomainObjEndJob. https://bugzilla.redhat.com/show_bug.cgi?id=1134154 Bug introduced in commit 1e833899. Signed-off-by: NJincheng Miao <jmiao@redhat.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Let's fix this before we bake in a painful API. Since we know that we have exactly one non-negative fd on success, we might as well return the fd directly instead of forcing the user to pass in a pointer. Furthermore, I found some memory and fd leaks while reviewing the code - the idea is that on success, libvirtd will have handed two fds in two different directions: one to qemu, and one to the RPC client. * include/libvirt/libvirt.h.in (virDomainOpenGraphicsFD): Drop unneeded parameter. * src/driver.h (virDrvDomainOpenGraphicsFD): Likewise. * src/libvirt.c (virDomainOpenGraphicsFD): Adjust interface to return fd directly. * daemon/remote.c (remoteDispatchDomainOpenGraphicsFd): Adjust semantics. * src/qemu/qemu_driver.c (qemuDomainOpenGraphicsFD): Likewise, and plug fd leak. * src/remote/remote_driver.c (remoteDomainOpenGraphicsFD): Likewise, and plug memory and fd leak. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Ján Tomko 提交于
Should fix https://bugzilla.redhat.com/show_bug.cgi?id=999926
-
- 26 8月, 2014 2 次提交
-
-
由 Erik Skultety 提交于
According to docs/schemas/domaincommon.rng and _virDomainBlockIoTuneInfo all the iotune values are interpreted as unsigned long long, however according to qemu_monitor_json.c, qemu silently truncates numbers larger than LLONG_MAX. There's really not much of a usage for such large numbers anyway yet. This patch provides the same overflow check during a domain start as it does during setting a blkdeviotune element in qemu_driver.c and thus reports an error when a larger number than LLONG_MAX is detected. https://bugzilla.redhat.com/show_bug.cgi?id=1131876
-
由 Alex Williamson 提交于
QEMU 2.1 added support for the kvm=off option to the -cpu command, allowing the KVM hypervisor signature to be hidden from the guest. This enables disabling of some paravirualization features in the guest as well as allowing certain drivers which test for the hypervisor to load. Domain XML syntax is as follows: <domain type='kvm> ... <features> ... <kvm> <hidden state='on'/> </kvm> </features> ... Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
-
- 25 8月, 2014 2 次提交
-
-
由 Martin Kletzander 提交于
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1021703Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
由 Martin Kletzander 提交于
Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 23 8月, 2014 1 次提交
-
-
由 Eric Blake 提交于
Commit b606bbb4 reminded me that any time we drop locks to run back-to-back guest interaction commands, we have to check that the guest didn't disappear in between the two commands. A quick audit found a couple of spots that were missing this check. * src/qemu/qemu_driver.c (qemuDomainShutdownFlags) (qemuDomainSetVcpusFlags): Check that domain is still up. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 22 8月, 2014 2 次提交
-
-
由 Erik Skultety 提交于
The 'min_guarantee' is used by VMware ESX and OpenVZ drivers, with qemu however, libvirt should report error when starting a domain, because this element is not used. Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1122455
-
由 Michal Privoznik 提交于
On some places in the libvirt code we have: f(a,z) instead of f(a, z) This trivial patch fixes couple of such occurrences. Signed-off-by: NMichal Privoznik <mprivozn@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...
-
- 20 8月, 2014 2 次提交
-
-
由 Martin Kletzander 提交于
And add a syntax-check for '){$'. It's not perfect, but better than nothing. Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
由 Michal Privoznik 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1103245 An advice appeared there on the qemu-devel list [1]. When a domain is suspended and then resumed guest kernel is not aware of this. So we've introduced virDomainSetTime API that resets the time within guest using qemu-ga. On the other hand, qemu itself is trying to make RTC beat faster to catch the difference. But if we don't tell qemu that guest's time was reset via the other method, both mechanisms are applied resulting in again wrong guest time. In order to avoid summing both corrections we need to tell qemu that it should not use the RTC injection if the guest time is set via guest agent. 1: http://www.mail-archive.com/qemu-devel@nongnu.org/msg236435.htmlSigned-off-by: NMichal Privoznik <mprivozn@redhat.com>
-