- 11 9月, 2014 4 次提交
-
-
由 John Ferlan 提交于
Coverity notes that if the virConnectListAllDomains returns a negative value then the loop at the cleanup label that ends on numDomains will have issues. Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
-
由 John Ferlan 提交于
If we jump to cleanup before allocating the 'result', then the call to virBlkioDeviceArrayClear will deref result causing a problem. Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
-
由 John Ferlan 提交于
Coverity complains that checking for !domlist after setting doms = domlist and making a deref of doms just above It seems the call in question was intended to me made in the case that 'doms' was passed in and not when the virDomainObjListExport() call allocated domlist and already called virConnectGetAllDomainStatsCheckACL(). Thus rather than check for !domlist - check that "doms != domlist" in order to avoid the Coverity message. Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
-
由 John Ferlan 提交于
In qemuDomainSetBlkioParameters(), Coverity points out that the calls to qemuDomainParseBlkioDeviceStr() are slightly different and points out there may be a cut-n-paste error. In the first call (AFFECT_LIVE), the second parameter is "param->field"; however, for the second call (AFFECT_CONFIG), the second parameter is "params->field". It seems the "param->field" is correct especially since each path as a setting of "param" to "¶ms[i]". Furthermore, there were a few more instances of using "params[i]" instead of "param->" which I cleaned up. Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
-
- 10 9月, 2014 4 次提交
-
-
由 Peter Krempa 提交于
Check if the VM is alive after we possibly called into monitor to reset the guest.
-
由 Peter Krempa 提交于
Also drop a comment with obvious content.
-
由 Jiri Denemark 提交于
virDomainGetJobStats gains new VIR_DOMAIN_JOB_STATS_COMPLETED flag that can be used to fetch statistics of a completed job rather than a currently running job. Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
-
由 Jiri Denemark 提交于
Job statistics data were tracked in several structures and variables. Let's make a new qemuDomainJobInfo structure which can be used as a single source of statistics data as a preparation for storing data about completed a job. Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
-
- 08 9月, 2014 5 次提交
-
-
由 Peter Krempa 提交于
Return failure right away when the domain object can't be looked up instead of jumping to cleanup. This allows to remove the condition before unlocking the domain object.
-
由 Peter Krempa 提交于
-
由 Jincheng Miao 提交于
The code would lookup the snapshot object before acquiring the job. This could lead to a crash as one thread could delete the snapshot object, while a second thread already had the reference. Signed-off-by: NJincheng Miao <jmiao@redhat.com> Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
-
由 Peter Krempa 提交于
Creating snapshots modifies the domain state. Currently we wouldn't enter the job for certain operations although they would modify the state. Refactor job handling so that everything is covered by an async job.
-
由 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 4 次提交
-
-
由 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 提交于
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 1 次提交
-
-
由 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>
-
- 29 8月, 2014 1 次提交
-
-
由 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:
-
- 28 8月, 2014 4 次提交
-
-
由 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 提交于
A bunch of false positives brought on by our own doings
-
由 John Ferlan 提交于
Coverity found that the 'buf' wasn't VIR_FREE'd at exit.
-
由 John Ferlan 提交于
The call to virDomainSnapshotRedefinePrep() had a spurrious ! in front of it which caused Coverity to complan that the expression is always false.
-
- 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
-
- 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>
-
- 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 10 次提交
-
-
由 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>
-
由 Martin Kletzander 提交于
Partially resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1131306Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
由 Peter Krempa 提交于
The build failure is caused by a false positive of some static analysys steps done by gcc (that don't happen on -O0).
-
由 Peter Krempa 提交于
When a user would try changing the persistent IO tuning settings for a disk that was hotplugged to a vm in a transient way, the qemuDomainSetBlockIoTune API would use the same index for both the live and config disk array. The disk was missing from the config array though causing a crash of libvirtd. To fix the issue, determine the indexes separately. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1131819
-
由 Peter Krempa 提交于
Instead of tediously copying of the disk source to remove it later ensure that the media change function removes the old device after it succeeds.
-
由 Peter Krempa 提交于
Use the qemu source string formatter to format the source string correctly for remote and other storage instead of passing source->path blindly.
-
由 Peter Krempa 提交于
Pass the source of the changed media instead of a complete disk definition. Note that the @disk argument now contains what @olddisk would contain. The new source is passed as a virStorageSource struct.
-
由 Peter Krempa 提交于
When we are changing media (or doing other hotplug operations) we need to setup cgroups, locking and seclabels on the new disk. This is a multi-step process where every piece can fail. To simplify dealing with this introduce qemuDomainPrepareDisk that similarly to qemuDomainPrepareDiskChainElement initializes/tears down a whole new disk to be used with the domain. Additionally the function supports passing a different source struct for media changes of cdroms that will be refactored later.
-
由 Roman Bogorodskiy 提交于
Currently, qemu driver uses qemuTranslateDiskSourcePool() to translate disk volume information. This function is general enough and could be used for other drivers as well, so move it to conf/domain_conf.c along with its helpers. - qemuTranslateDiskSourcePool: move to storage/storage_driver.c and rename to virStorageTranslateDiskSourcePool, - qemuAddISCSIPoolSourceHost: move to storage/storage_driver.c and rename to virStorageAddISCSIPoolSourceHost, - qemuTranslateDiskSourcePoolAuth: move to storage/storage_driver.c and rename to virStorageTranslateDiskSourcePoolAuth, - Update users of qemuTranslateDiskSourcePool to use a new name.
-