- 14 3月, 2014 1 次提交
-
-
由 Laine Stump 提交于
These are never seen externally, only passed into libvirt APIs, so in practice this makes no real difference, but it's good to be consistent.
-
- 04 3月, 2014 3 次提交
-
-
由 Eric Blake 提交于
'virsh lxc-enter-namespace' does not have a way to reflect exit status to the caller in single-command mode, but we might as well at least report the exit status. Prior to this patch, $ virsh -c lxc:/// lxc-enter-namespace shell /bin/sh 'exit 3'; echo $? 1 now it gives some details: $ virsh -c lxc:/// lxc-enter-namespace shell /bin/sh -c 'exit 3'; echo $? error: internal error: Child process (31557) unexpected exit status 3 1 Also useful: $ virsh -c lxc:/// lxc-enter-namespace shell /bin/sh -c 'kill $$'; echo $? error: internal error: Child process (31585) unexpected fatal signal 15 1 * tools/virsh-domain.c (cmdLxcEnterNamespace): Avoid magic numbers. Dispatch any error. * tools/virsh.pod: Document that non-zero exit status is collapsed. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
The old semantics of virFork() violates the priciple of good usability: it requires the caller to check the pid argument after use, *even when virFork returned -1*, in order to properly abort a child process that failed setup done immediately after fork() - that is, the caller must call _exit() in the child. While uses in virfile.c did this correctly, uses in 'virsh lxc-enter-namespace' and 'virt-login-shell' would happily return from the calling function in both the child and the parent, leading to very confusing results. [Thankfully, I found the problem by inspection, and can't actually trigger the double return on error without an LD_PRELOAD library.] It is much better if the semantics of virFork are impossible to abuse. Looking at virFork(), the parent could only ever return -1 with a non-negative pid if it misused pthread_sigmask, but this never happens. Up until this patch series, the child could return -1 with non-negative pid if it fails to set up signals correctly, but we recently fixed that to make the child call _exit() at that point instead of forcing the caller to do it. Thus, the return value and contents of the pid argument are now redundant (a -1 return now happens only for failure to fork, a child 0 return only happens for a successful 0 pid, and a parent 0 return only happens for a successful non-zero pid), so we might as well return the pid directly rather than an integer of whether it succeeded or failed; this is also good from the interface design perspective as users are already familiar with fork() semantics. One last change in this patch: before returning the pid directly, I found cases where using virProcessWait unconditionally on a cleanup path of a virFork's -1 pid return would be nicer if there were a way to avoid it overwriting an earlier message. While such paths are a bit harder to come by with my change to a direct pid return, I decided to keep the virProcessWait change in this patch. * src/util/vircommand.h (virFork): Change signature. * src/util/vircommand.c (virFork): Guarantee that child will only return on success, to simplify callers. Return pid rather than status, now that the situations are always the same. (virExec): Adjust caller, also avoid open-coding process death. * src/util/virprocess.c (virProcessWait): Tweak semantics when pid is -1. (virProcessRunInMountNamespace): Adjust caller. * src/util/virfile.c (virFileAccessibleAs, virFileOpenForked) (virDirCreate): Likewise. * tools/virt-login-shell.c (main): Likewise. * tools/virsh-domain.c (cmdLxcEnterNamespace): Likewise. * tests/commandtest.c (test23): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Right now, a caller waiting for a child process either requires the child to have status 0, or must use WIFEXITED() and friends itself. But in many cases, we want the middle ground of treating fatal signals as an error, and directly accessing the normal exit value without having to use WEXITSTATUS(), in order to easily detect an expected non-zero exit status. This adds the middle ground to the low-level virProcessWait; the next patch will add it to virCommand. * src/util/virprocess.h (virProcessWait): Alter signature. * src/util/virprocess.c (virProcessWait): Add parameter. (virProcessRunInMountNamespace): Adjust caller. * src/util/vircommand.c (virCommandWait): Likewise. * src/util/virfile.c (virFileAccessibleAs): Likewise. * src/lxc/lxc_container.c (lxcContainerHasReboot) (lxcContainerAvailable): Likewise. * daemon/libvirtd.c (daemonForkIntoBackground): Likewise. * tools/virt-login-shell.c (main): Likewise. * tools/virsh-domain.c (cmdLxcEnterNamespace): Likewise. * tests/testutils.c (virtTestCaptureProgramOutput): Likewise. * tests/commandtest.c (test23): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 01 3月, 2014 2 次提交
-
-
由 Eric Blake 提交于
Similar to our event-test demo program, it's nice to be able to have a mode where we can sniff all events at once, rather than having to spawn multiple virsh in parallel with one for each event type. (Can I just say our RegisterAny design is lousy? The fact that the majority of our callback pointers have a function signature with the opaque data in a different position, and that we have to cast the function signature before registering it, makes it hard to write a generic callback function; we have to write one for every type of event id. Life would have been easier if we had designed the callback as a fixed signature with a void* and size parameter, and then allowed the caller to downcast the void* to a particular struct for data specific to their callback id, where we could have then had a single function with a switch statement for each event id, and register that one function for all types of events. It would also be nicer if the callback functions knew which callbackID was being used when invoking that callback, so that I could use a common data structure among all registrations instead of having to create an array of one data per callback. But I really don't want to go add yet another event API design.) * tools/virsh-domain.c (cmdEvent): Add --all parameter; convert all callbacks to support shared counter. * tools/virsh.pod (event): Document it. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Earlier, I added 'virsh event' for lifecycle events, to get the concept approved; this patch finishes the support for all other events, although the user still has to register for one event type at a time. A future patch may add an --all parameter to make it possible to register for all events through a single call. * tools/virsh-domain.c (vshDomainEventWatchdogToString) (vshDomainEventIOErrorToString, vshGraphicsPhaseToString) (vshGraphicsAddressToString, vshDomainBlockJobStatusToString) (vshDomainEventDiskChangeToString) (vshDomainEventTrayChangeToString, vshEventGenericPrint) (vshEventRTCChangePrint, vshEventWatchdogPrint) (vshEventIOErrorPrint, vshEventGraphicsPrint) (vshEventIOErrorReasonPrint, vshEventBlockJobPrint) (vshEventDiskChangePrint, vshEventTrayChangePrint) (vshEventPMChangePrint, vshEventBalloonChangePrint) (vshEventDeviceRemovedPrint): New helper routines. (cmdEvent): Support full array of event callbacks. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 26 2月, 2014 1 次提交
-
-
由 Michal Privoznik 提交于
If user wants to grep some info from domain, e.g. disk paths: # virsh -q domblklist win7 | awk '{print $2}' Source /var/lib/libvirt/images/windows.qcow2 /home/zippy/work/tmp/en_windows_7_professional_x64_dvd_X15-65805.iso while with my change: # virsh -q domblklist win7 | awk '{print $2}' /var/lib/libvirt/images/windows.qcow2 /home/zippy/work/tmp/en_windows_7_professional_x64_dvd_X15-65805.iso We don't print table header in other commands, like list. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 25 2月, 2014 3 次提交
-
-
由 Chen Hanxiao 提交于
Fix a -Werror=maybe-uninitialized issue. Signed-off-by: NChen Hanxiao <chenhanxiao@cn.fujitsu.com> Signed-off-by: NJán Tomko <jtomko@redhat.com>
-
由 Eric Blake 提交于
Dan Berrange suggested that using VIR_ENUM_IMPL is more compact than open-coding switch statements, and still just as forceful at making us remember to update lists if we add enum values in the future. Make this change throughout virsh. Sure enough, doing this change caught that we missed at least VIR_STORAGE_VOL_NETDIR. * tools/virsh-domain-monitor.c (vshDomainIOErrorToString) (vshDomainControlStateToString, vshDomainStateToString) (vshDomainStateReasonToString): Change switch to enum lookup. (cmdDomControl, cmdDominfo): Update caller. * tools/virsh-domain.c (vshDomainVcpuStateToString) (vshDomainEventToString, vshDomainEventDetailToString): Change switch to enum lookup. (vshDomainBlockJobToString, vshDomainJobToString): New functions. (cmdVcpuinfo, cmdBlockJob, cmdDomjobinfo, cmdEvent): Update callers. * tools/virsh-network.c (vshNetworkEventToString): Change switch to enum lookup. * tools/virsh-pool.c (vshStoragePoolStateToString): New function. (cmdPoolList, cmdPoolInfo): Update callers. * tools/virsh-volume.c (vshVolumeTypeToString): Change switch to enum lookup. (cmdVolInfo, cmdVolList): Update callers. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Ján Tomko 提交于
Change the logic of the function to return false by default and move the freeing of the buffer to the cleanup section. https://bugzilla.redhat.com/show_bug.cgi?id=1067338
-
- 21 2月, 2014 2 次提交
-
-
由 Eric Blake 提交于
Add 'virsh event --list' and 'virsh event [dom] --event=name [--loop] [--timeout]'. Borrows somewhat from event-test.c, but defaults to a one-shot notification, and takes advantage of the event loop integration to allow Ctrl-C to interrupt the wait for an event. For now, this just does lifecycle events. * tools/virsh.pod (event): Document new command. * tools/virsh-domain.c (vshDomainEventToString) (vshDomainEventDetailToString, vshDomEventData) (vshEventLifecyclePrint, cmdEvent): New struct and functions. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Several virsh commands ask for a --timeout parameter in seconds, then use it to control interfaces that operate on millisecond limits; I also plan on adding a 'virsh event' command that also does this. Factor this into a common function. * tools/virsh.h (vshCommandOptTimeoutToMs): New prototype. * tools/virsh.c (vshCommandOptTimeoutToMs): New function. * tools/virsh-domain.c (cmdBlockCommit, cmdBlockCopy) (cmdBlockPull, cmdMigrate): Use it. (vshWatchJob): Adjust timeout scale. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 20 2月, 2014 1 次提交
-
-
由 Jincheng Miao 提交于
When start a guest with --pass-fd, if the argument of --pass-fd is invalid, virsh will exit, but doesn't free the variable 'dom'. The valgrind said: ... ==24569== 63 (56 direct, 7 indirect) bytes in 1 blocks are definitely lost in loss record 130 of 234 ==24569== at 0x4C2A1D4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==24569== by 0x4E879A4: virAllocVar (viralloc.c:544) ==24569== by 0x4EBD625: virObjectNew (virobject.c:190) ==24569== by 0x4F3A18A: virGetDomain (datatypes.c:226) ==24569== by 0x4F9311F: remoteDomainLookupByName (remote_driver.c:6636) ==24569== by 0x4F44F20: virDomainLookupByName (libvirt.c:2277) ==24569== by 0x12F616: vshCommandOptDomainBy (virsh-domain.c:105) ==24569== by 0x131C79: cmdStart (virsh-domain.c:3330) ==24569== by 0x12C4AB: vshCommandRun (virsh.c:1752) ==24569== by 0x127001: main (virsh.c:3218) https://bugzilla.redhat.com/show_bug.cgi?id=1067338Signed-off-by: NJincheng Miao <jmiao@redhat.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 20 1月, 2014 2 次提交
-
-
由 Thorsten Behrens 提交于
-
由 Gao feng 提交于
With this patch, user can setup the throttle blkio cgorup for domain through the virsh cmd, such as: virsh blkiotune domain1 --device-read-bytes-sec /dev/sda1,1000000,/dev/sda2,2000000 --device-write-bytes-sec /dev/sda1,1000000 --device-read-iops-sec /dev/sda1,10000 --device-write-iops-sec /dev/sda1,10000,/dev/sda2,0 This patch also add manpage for these new options. Signed-off-by: NGuan Qiang <hzguanqiang@corp.netease.com> Signed-off-by: NGao feng <gaofeng@cn.fujitsu.com>
-
- 08 1月, 2014 2 次提交
-
-
由 Peter Krempa 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1049529 The 'detach-disk' command in virsh used the active XML definition of a domain even when attempting to remove a disk from the config only. If the disk was only in the inactive definition the operation failed. Fix this by using the inactive XML in case that only the config is affected.
-
由 Peter Krempa 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1049529 The legacy virDomainAttachDevice and virDomainDetachDevice operate only on active domains. When a user specified --current flag with an inactive domain the old API was used and reported an error. Fix it by calling the new API if --current is specified explicitly.
-
- 25 12月, 2013 1 次提交
-
-
由 Michal Privoznik 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1044806 Currently, sending the ANSI_A keycode from os_x codepage doesn't work as it has a special value of 0x0. Our internal code handles that no different to other not defined keycodes. Hence, in order to allow it we must change all the undefined keycodes from 0 to -1 and adapt some code too. # virsh send-key guestname --codeset os_x ANSI_A error: invalid keycode: 'ANSI_A' # virsh send-key guestname --codeset os_x ANSI_B # virsh send-key guestname --codeset os_x ANSI_C Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 18 12月, 2013 1 次提交
-
-
由 Peter Krempa 提交于
The undefine code that removes the storage along with the VM didn't take into account the existence of 'volume' type disks. Add the functionality.
-
- 03 12月, 2013 1 次提交
-
-
由 Eric Blake 提交于
Based on a suggestion from Mauricio Tavares. * tools/virsh-domain.c (cmdDetachInterface, vshFindDisk): Improve wording. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 21 11月, 2013 1 次提交
-
-
由 Eric Blake 提交于
Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check. * tests/sysinfotest.c: Consistently use commas. * tests/viratomictest.c: Likewise. * tests/vircgroupmock.c: Likewise. * tools/virsh-domain.c: Likewise. * tools/virsh-volume.c: Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 11 11月, 2013 1 次提交
-
-
由 Peter Krempa 提交于
The 'vcpucount' command is a getter command for the vCPUu count. When one or more of the filtering flags are specified the command returns the value only for the selected combination. In this case the --live and --config combination isn't valid. This however didn't cause errors as the combination of flags was rejected by the libvirt API but then the fallback code kicked in and requested the count in a way where the clash of the flags didn't matter. Mark the flag combination mutually exclusive so that users aren't confused. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1024245
-
- 24 10月, 2013 1 次提交
-
-
由 Eric Blake 提交于
Commit e962a579 added 'attach-disk --shareable', even though we already had 'attach-disk --mode=shareable'. Worse, if the user types 'attach-disk --mode=readonly --shareable', we create non-sensical XML. The best solution is just to undocument the duplicate spelling, by having it fall back to the preferred spelling. * tools/virsh-domain.c (cmdAttachDisk): Let alias handling fix our mistake in exposing a second spelling for an existing option. * tools/virsh.pod: Fix documentation. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 22 10月, 2013 1 次提交
-
-
由 Peter Krempa 提交于
In commit b46c4787 I changed the code to watch long running jobs in virsh. Unfortunately I didn't take into account that poll may get a hangup if the terminal is not a TTY and will be closed. This patch avoids polling the STDIN fd when there's no TTY.
-
- 18 10月, 2013 1 次提交
-
-
由 Chen Hanxiao 提交于
'--print-xml' option is very useful for doing some test. But we had to specify a real domain for it. This patch could enable us to specify a fake domain when using --print-xml option. Signed-off-by: NChen Hanxiao <chenhanxiao@cn.fujitsu.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 17 10月, 2013 1 次提交
-
-
由 Chen Hanxiao 提交于
s/it's/its Signed-off-by: NChen Hanxiao <chenhanxiao@cn.fujitsu.com>
-
- 11 10月, 2013 1 次提交
-
-
由 Michal Privoznik 提交于
The parameter allows overriding default listen address for '-incoming' cmd line argument on destination. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 01 10月, 2013 1 次提交
-
-
由 Ján Tomko 提交于
Use virSocketAddrIsWildcard instead of STREQ to check for the ANY address and put brackets around the address if it contains ':'.
-
- 30 9月, 2013 1 次提交
-
-
由 Hongwei Bi 提交于
-
- 27 9月, 2013 1 次提交
-
-
由 Christophe Fergeau 提交于
It's possible to create a domain which will only use a TLS port and will not have a non-TLS port set by using: <graphics type='spice' autoport='yes' defaultMode='secure'/> In such a setup, the 'graphics' node for the running domain will be: <graphics type='spice' tlsPort='5900' autoport='yes' listen='127.0.0.1' defaultMode='secure'> However, cmdDomDisplay loops over all the 'graphics' node, and it ignores nodes which don't have a 'port' attribute. This means 'virsh domdisplay' will only return an empty string for domains as the one above. This commit looks for both 'port' and 'tlsPort' before deciding to ignore a graphics node. It also makes sure 'port' is not printed when it's not set. This makes 'virsh domdisplay' return 'spice://127.0.0.1?tls-port=5900' for domains using only a TLS port. Signed-off-by: NChristophe Fergeau <cfergeau@redhat.com>
-
- 25 9月, 2013 1 次提交
-
-
由 Hongwei Bi 提交于
Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 20 9月, 2013 1 次提交
-
-
由 Simone Gotti 提交于
After commit 8aecd351 it'll detect that a required option is not defined and it will assert and exit with: virsh.c:1364: vshCommandOpt: Assertion `valid->name' failed. Problem has been latent since commit ed23b106. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 17 9月, 2013 5 次提交
-
-
由 Peter Krempa 提交于
Some systems apparently have a global variable/function called remove and thus break compilation of virsh-domain.c. Rename the variable to avoid this. Reported by GuanQiang.
-
由 Peter Krempa 提交于
The metadata modification functions will support modification of the XML metadata. Add a virsh command to allow using this approach.
-
由 Peter Krempa 提交于
-
由 Peter Krempa 提交于
Line up the array so that the grid is visible.
-
由 Peter Krempa 提交于
The "cmd" variable is actually used so remove the attribute.
-
- 16 9月, 2013 1 次提交
-
-
由 yangdongsheng 提交于
Since the maxvcpus command query the maximum number of virtual CPUs supported for a guest VM on this connection, it should be in virsh-host.c but not virsh-domain.c. Signed-off-by: Nyangdongsheng <yangds.fnst@cn.fujitsu.com>
-
- 12 9月, 2013 1 次提交
-
-
由 Jiri Denemark 提交于
https://bugzilla.redhat.com/show_bug.cgi?id=1006864 Commit 38ab1225 changed the default value of ret from true to false but forgot to set ret = true when job is NONE. Thus, virsh domjobinfo returned 1 when there was no job running for a domain but it used to (and should) return 0 in this case.
-
- 05 9月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
The VIR_FREE() macro will cast away any const-ness. This masked a number of places where we passed a 'const char *' string to VIR_FREE. Fortunately in all of these cases, the variable was not in fact const data, but a heap allocated string. Fix all the variable declarations to reflect this. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-