summaryrefslogtreecommitdiff
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
* virsh: avoid uninitialized variableEric Blake2011-06-301-1/+4
| | | | | | | Detected by Coverity; neither vshCmddefHelp nor vshCmdOptParse was initializing opts_required. * tools/virsh.c (vshCmddefOptParse): Always initialize bitmaps.
* virsh: avoid integer overflowEric Blake2011-06-301-1/+1
| | | | | | | | | Detected by Coverity. info.nrVirtCpu is unsigned short, but if cpumaplen is int, then the product of the two in vshMalloc risks unintended sign extension. cmdVcpuinfo had already solved this by using size_t cpumaplen. * tools/virsh.c (cmdVcpuPin): Use correct type.
* virsh: Fix a problem of buildPoolXMLOsier Yang2011-06-301-1/+1
| | | | | It doesn't generate "<name>" and "<format>" nodes for "<source>" even if they are explicitly specified. This patch fixes it.
* build: avoid pod2man on tarballEric Blake2011-06-291-0/+1
| | | | | | | | | | | | | virt-sanlock-cleanup.8 has static contents (no dependency on configure), but is generated by pod2man (a perl dependency that maintainers must have, but which ordinary tarball users need not have). Therefore, ensure that it is always part of the tarball, even though it is only conditionally installed. This is similar to commit 6db98a2d4b, but made simpler by the fact that the .8 page is static content. * tools/Makefile.am (EXTRA_DIST): Add virt-sanlock-cleanup.8.
* Support automatic creation of leases for disks in sanlockDaniel P. Berrange2011-06-283-1/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current sanlock plugin requires a central management application to manually add <lease> elements to each guest, to protect resources that are assigned to it (eg writable disks). This makes the sanlock plugin useless for usage in more ad hoc deployment environments where there is no central authority to associate disks with leases. This patch adds a mode where the sanlock plugin will automatically create leases for each assigned read-write disk, using a md5 checksum of the fully qualified disk path. This can work pretty well if guests are using stable disk paths for block devices eg /dev/disk/by-path/XXXX symlinks, or if all hosts have NFS volumes mounted in a consistent pattern. The plugin will create one lockspace for managing disks with filename /var/lib/libvirt/sanlock/__LIBVIRT__DISKS__. For each VM disks, there will be another file to hold a lease /var/lib/libvirt/sanlock/5903e5d25e087e60a20fe4566fab41fd Each VM disk lease is usually 1 MB in size. The script virt-sanlock-cleanup should be run periodically to remove unused lease files from the lockspace directory. To make use of this capability the admin will need to do several tasks: - Mount an NFS volume (or other shared filesystem) on /var/lib/libvirt/sanlock - Configure 'host_id' in /etc/libvirt/qemu-sanlock.conf with a unique value for each host with the same NFS mount - Toggle the 'auto_disk_leases' parameter in qemu-sanlock.conf Technically the first step can be skipped, in which case sanlock will only protect against 2 vms on the same host using the same disk (or the same VM being started twice due to error by libvirt). * src/locking/libvirt_sanlock.aug, src/locking/sanlock.conf, src/locking/test_libvirt_sanlock.aug: Add config params for configuring auto lease setup * libvirt.spec.in: Add virt-sanlock-cleanup program, man page * tools/virt-sanlock-cleanup.in: Script to purge unused disk resource lease files
* Add node prefix to virNodeGet(CPU|Memory)Stats structs and definesMatthias Bolte2011-06-281-9/+9
|
* build: rename Vcpupin to VcpuPinEric Blake2011-06-271-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | We already have a public virDomainPinVcpu, which implies that Pin and Vcpu are treated as separate words. Unreleased commit e261987c introduced virDomainGetVcpupinInfo as the first public API that used Vcpupin, although we had prior internal uses of that spelling. For consistency, change the spelling to be two words everywhere, regardless of whether pin comes first or last. * daemon/remote.c: Treat vcpu and pin as separate words. * include/libvirt/libvirt.h.in: Likewise. * src/conf/domain_conf.c: Likewise. * src/conf/domain_conf.h: Likewise. * src/driver.h: Likewise. * src/libvirt.c: Likewise. * src/libvirt_private.syms: Likewise. * src/libvirt_public.syms: Likewise. * src/libxl/libxl_driver.c: Likewise. * src/qemu/qemu_driver.c: Likewise. * src/remote/remote_driver.c: Likewise. * src/xen/xend_internal.c: Likewise. * tools/virsh.c: Likewise. * src/remote/remote_protocol.x: Likewise. * src/remote_protocol-structs: Likewise. Suggested by Matthias Bolte.
* vcpupin: add query option to virsh vcpupin commandTaku Izumi2011-06-242-17/+82
| | | | | | | | | | | | | | | | | | | | This patch teaches "virsh vcpupin" command to query if no list is given. Its feature is to show CPU affinity information in more reader-friendly way. # virsh vcpupin VM --config VCPU: CPU Affinity ---------------------------------- 0: 1-6,9-20 1: 10 2: 5,9-11,15-20 3: 1,3,5,7,9,11,13,15 When cpulist is omitted, vcpu number is optional. When vcpu number is provided, information of only specified vcpu is displayed. Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com> Signed-off-by: Eric Blake <eblake@redhat.com>
* vcpuinfo: add the code to fallback to try new APITaku Izumi2011-06-241-14/+34
| | | | | | | | | The "virsh vcpuinfo" command results in failure when the target domain is inactive on KVM. This patch improves this behavior by adding the fallback to invoke virDomainGetVcpupinInfo API in case of virDomainGetVcpus API returns error and the target domain is inactive. Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
* Revert "Enable the virDomainBlockPull API in virsh"Eric Blake2011-06-242-130/+4
| | | | This reverts commit 3e2493ce28b7e20416e916fdf893a9569c267925.
* Allow automatic kill of guests when a connection is closedDaniel P. Berrange2011-06-242-2/+14
| | | | | | | | | | | | | | | If an application is using libvirt + KVM as a piece of its internal infrastructure to perform a specific task, it can be desirable to guarentee the VM dies when the virConnectPtr disconnects from libvirtd. This ensures the app can't leak any VMs it was using. Adding VIR_DOMAIN_START_AUTOKILL as a flag when starting guests enables this to be done. * include/libvirt/libvirt.h.in: All VIR_DOMAIN_START_AUTOKILL * src/qemu/qemu_driver.c: Support automatic killing of guests upon connection close * tools/virsh.c: Add --autokill flag to 'start' and 'create' commands
* maint: remove syntax-check exceptionEric Blake2011-06-221-2/+2
| | | | | | | | | | | We weren't using the @FOO@ notation for a Makefile substitution, but instead for a sed rule, so using [@]FOO@ instead avoids the need to exempt this syntax check. * cfg.mk (_makefile_at_at_check_exceptions): Delete. * tools/Makefile.am (virt-xml-validate, virt-pki-validate): Avoid tripping syntax-check. Reported by Daniel P. Berrange.
* virsh: avoid bogus descriptionEric Blake2011-06-211-2/+3
| | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=682121 Gettext reserves the empty string for internal use, and it must not be passed through _(). We were violating this for commands that (for whatever reason) used "" for their description. * tools/virsh.c (vshCmddefHelp): Don't translate empty string. Reported by Tatsuo Kawasaki.
* Promote virEvent*Handle/Timeout to public APICole Robinson2011-06-211-1/+0
| | | | | | | | | | Since we virEventRegisterDefaultImpl is now a public API, callers need a way to invoke the default registered Handle and Timeout functions. We already have general functions for these internally, so promote them to the public API. v2: Actually add APIs to libvirt.h
* virsh: enhance snapshot-create-asEric Blake2011-06-202-2/+11
| | | | | | | Similar to pool-create-as. * tools/virsh.c (cmdSnapshotCreateAs): Add --print-xml. * tools/virsh.pod: Document it.
* virsh: add snapshot-create-as commandEric Blake2011-06-202-1/+109
| | | | | | | | | Producing an xml file just for name and description fields is overkill; this makes life easier from virsh. * tools/virsh.c (cmdSnapshotCreateAs): New command. (snapshotCmds): Install it. * tools/virsh.pod: Document it.
* virsh: clarify snapshot vs. saveEric Blake2011-06-202-4/+10
| | | | | | * tools/virsh.c (info_snapshot_create, info_save): Clarify description. * tools/virsh.pod (save): Likewise.
* Fix compile warnings in virsh vcpupinDaniel P. Berrange2011-06-201-2/+2
| | | | | | | | | | The 'char *cur' variable was being assigned from a 'const char *' string, thus discarding constness. As well as causing a compile warning, it masked a piece of code which attempts to assign to the previously const string. * tools/virsh.c: Fix const-ness of 'cur' variable in vcpupin
* vcpupin: add reset option to virsh vcpupin commandTaku Izumi2011-06-202-1/+8
| | | | | | | | | | | | | | | | | When resetting vcpupin setting, we have to specify all host physical cpus as a cpulist parameter of virsh vcpupin command. It's a little tedious. This patch changes to allow to receive the special keyword 'r' as a cpulist parameter of virsh vcpupin command when resetting vcpupin setting. If you set the following: # virsh vcpupin VM 0 r the vcpu0 will be pinned to all physical cpus. Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
* vcpupin: improve vcpupin definition of virsh vcpupinTaku Izumi2011-06-202-56/+76
| | | | | | | | | | | | | | | | | | | | When using vcpupin command, we have to speficy comma-separated list as cpulist, but this is tedious in case the number of phsycal cpus is large. This patch improves this by introducing special markup "-" and "^" which are similar to XML schema of "cpuset" attribute. The example: # virsh vcpupin Guest 0 0-15,^8 is identical to # virsh vcpupin Guest 0 0,1,2,3,4,5,6,7,9,10,11,12,13,14,15 NOTE: The expression is sequentially evaluated, so "0-15,^8" is not identical to "^8,0-15". Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
* Add new parameters for blkiotuneHu Tao2011-06-202-3/+30
| | | | Add --config, --live and --current for command blkiotune
* virsh: Add support for virDomainGetControlInfoJiri Denemark2011-06-162-0/+72
|
* virsh: reduce complexity in argv iterationEric Blake2011-06-151-9/+12
| | | | | | | | This reduces things from O(n^2) to O(n). * tools/virsh.c (vshCommandOptArgv): Change signature. (cmdEcho): Update caller. Based on a patch by Lai Jiangshan.
* Enable the virDomainBlockPull API in virshAdam Litke2011-06-142-4/+130
| | | | | | | | | | | | | Define two new virsh commands: * blockpull: Perform block pull operations (incremental plus start and stop continuous streams) * blockpullinfo: Retrieve progress info for continuous block pull Share print_job_progress() with the migration code. * tools/virsh.c: implement the new commands Signed-off-by: Adam Litke <agl@us.ibm.com>
* virNodeGetMemoryStats: Implement virsh supportMinoru Usui2011-06-142-3/+70
| | | | Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
* virNodeGetCPUStats: Implement virsh supportMinoru Usui2011-06-142-0/+137
| | | | Signed-off-by: Minoru Usui <usui@mxm.nes.nec.co.jp>
* add VSH_OFLAG_REQ_OPT optionsLai Jiangshan2011-06-141-0/+7
| | | | | | | | | | | A VSH_OFLAG_REQ_OPT option means --optionname is required when used. It will kill any ambiguity, even a !VSH_OFLAG_REQ option listed before a VSH_OFLAG_REQ option, if the !VSH_OFLAG_REQ option is a VSH_OFLAG_REQ_OPT option. It will help us use optional argument with VSH_OT_ARGV argument. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
* allow name for VSH_OT_ARGV optionsLai Jiangshan2011-06-141-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | A name will improve the usege, example # virsh help echo NAME echo - echo arguments SYNOPSIS echo [--shell] [--xml] [<string>]... DESCRIPTION Echo back arguments, possibly with quoting. OPTIONS --shell escape for shell use --xml escape for XML use <string> arguments to echo "[<string>]..." is added to SYNOPSIS. "<string> arguments to echo" is added to OPTIONS. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
* virsh: Add daemon version reportingMichal Privoznik2011-06-141-1/+21
| | | | | 'virsh version' might report against which version of libvirtd is running.
* qemu: Parse current balloon value returned by query_balloonOsier Yang2011-06-141-0/+2
| | | | | | | | | | | | | | | | | | | | Qemu once supported following memory stats which will returned by "query_balloon": stat_put(dict, "actual", actual); stat_put(dict, "mem_swapped_in", dev->stats[VIRTIO_BALLOON_S_SWAP_IN]); stat_put(dict, "mem_swapped_out", dev->stats[VIRTIO_BALLOON_S_SWAP_OUT]); stat_put(dict, "major_page_faults", dev->stats[VIRTIO_BALLOON_S_MAJFLT]); stat_put(dict, "minor_page_faults", dev->stats[VIRTIO_BALLOON_S_MINFLT]); stat_put(dict, "free_mem", dev->stats[VIRTIO_BALLOON_S_MEMFREE]); stat_put(dict, "total_mem", dev->stats[VIRTIO_BALLOON_S_MEMTOT]); But it later disabled all the stats except "actual" by commit 07b0403dfc2b2ac179ae5b48105096cc2d03375a. libvirt doesn't parse "actual", so user will always see a empty result with "virsh dommemstat $domain". Even qemu haven't disabled the stats, we should support parsing "actual".
* Deprecate several CURRENT/LIVE/CONFIG enumsHu Tao2011-06-131-26/+26
| | | | | | | | | | | | | | | | | This patch deprecates following enums: VIR_DOMAIN_MEM_CURRENT VIR_DOMAIN_MEM_LIVE VIR_DOMAIN_MEM_CONFIG VIR_DOMAIN_VCPU_LIVE VIR_DOMAIN_VCPU_CONFIG VIR_DOMAIN_DEVICE_MODIFY_CURRENT VIR_DOMAIN_DEVICE_MODIFY_LIVE VIR_DOMAIN_DEVICE_MODIFY_CONFIG And modify internal codes to use virDomainModificationImpact.
* vcpupin: add the new option to "virsh vcpupin" commandTaku Izumi2011-06-132-3/+38
| | | | | | | | | | This patch adds the new option (--live, --config and --current) to "virsh vcpupin" command. The behavior of above aption is the same as that of "virsh setmem", "virsh setvcpus", and whatnot. When the --config option is specified, the command affects a persistent domain, while --live option is specified, it affects a running (live) domain. The --current option cannot be used with --config or --live at the same time, and when --current is specified, it affects a "current" domain.
* build: silence coverity false positivesEric Blake2011-06-081-0/+3
| | | | | | | | | | | | | Coverity complained about these intentional fallthrough cases, but not about other cases that were explicitly marked with nice comments. For some reason, Coverity doesn't seem smart enough to parse the up-front English comment in virsh about intentional fallthrough :) * tools/virsh.c (cmdVolSize): Mark fallthrough in a more typical fashion. * src/conf/nwfilter_conf.c (virNWFilterRuleDefDetailsFormat) (virNWFilterRuleDetailsParse): Mark explicit fallthrough.
* virsh: Expose virDomainMigrateSetMaxSpeed API to virshOsier Yang2011-06-082-0/+51
| | | | | API virDomainMigrateSetMaxSpeed was introduced since 0.9.0, but no command in virsh yet.
* API: consolidate common unreleased enumsEric Blake2011-06-041-6/+6
| | | | | | | | | | | | | | | | | | | | | | | This commit is safe precisely because there has been no release for any of the enum values being deleted (they were added post-0.9.1). After the 0.9.2 release, we can then take advantage of virDomainModificationImpact in more places. * include/libvirt/libvirt.h.in (virDomainModificationImpact): New enum. (virDomainSchedParameterFlags, virMemoryParamFlags): Delete, since these were never released, and the new enum works fine here. * src/libvirt.c (virDomainGetMemoryParameters) (virDomainSetMemoryParameters) (virDomainGetSchedulerParametersFlags) (virDomainSetSchedulerParametersFlags): Update documentation. * src/qemu/qemu_driver.c (qemuDomainSetMemoryParameters) (qemuDomainGetMemoryParameters, qemuSetSchedulerParametersFlags) (qemuSetSchedulerParameters, qemuGetSchedulerParametersFlags) (qemuGetSchedulerParameters): Adjust clients. * tools/virsh.c (cmdSchedinfo, cmdMemtune): Likewise. Based on ideas by Daniel Veillard and Hu Tao.
* virsh: Document nodeinfo outputJiri Denemark2011-06-031-1/+3
|
* docs: document iface-* commandsEric Blake2011-06-022-9/+106
| | | | | | | | | I intentionally set things up so 'virsh help interface' lists commands in alphabetical order, but 'man virsh' lists them in topical order; this matches our practice on some other commands. * tools/virsh.pod: Document all iface commands. * tools/virsh.c (ifaceCmds): Sort.
* screenshot: Expose the new API in virshMichal Privoznik2011-06-022-11/+185
| | | | | | * tools/virsh.c: Add screenshot command * tools/virsh.pod: Document new command * src/libvirt.c: Fix off-be-one error
* Fix sysinfo/virsh build problems on Win32Daniel P. Berrange2011-05-311-2/+2
| | | | | | | | | | | | | | | The virSysinfoIsEqual method was mistakenly inside a #ifndef WIN32 conditional. The existing virSysinfoFormat is also stubbed out on Win32, even though the code works without any trouble. This breaks XML output on Win32, so the stub is removed. virsh migrate mistakenly had some variables inside the conditional * src/util/sysinfo.c: Build virSysinfoIsEqual on Win32 and remove Win32 stub for virSysinfoFormat * tools/virsh.c: Fix variable declaration on Win32
* Allow virsh to pass in a custom XML document for migrationDaniel P. Berrange2011-05-311-2/+17
| | | | | | | | | | | | | | | | Switch virsh migrate over to use virDomainMigrate2 and virDomainMigrateToURI2. This is still compatible with older libvirts, because these methods dynamically choose whether to perform v1, v2 or v3 migration based on declared RPC support from the libvirtd instances Add a --xml arg which allows the user to pass in a custom XML document. This XML document must be ABI compatible with the current *live* XML document for the running guest on the source host. ABI compatibility will be enforced by any driver supporting this function * tools/virsh.c: Add '--xml' arg to migrate command
* virsh: improve schedinfo querying abilityEric Blake2011-05-291-5/+27
| | | | | | | | | | | Since we can now set just --live or --config, we also need to be able to query that back. In the case of setting both --live and --config, it shouldn't matter which value we read back; otherwise, since querying treats the two flags as mutually exclusive, so does this patch. * tools/virsh.c (cmdSchedinfo): Use new API where appropriate.
* maint: prefer newer API names internallyEric Blake2011-05-291-34/+34
| | | | | | | | | | | | | | | | | | | Rather mechanical in nature. * src/driver.h: Use newer virTypedParameter API names. * src/libvirt.c: Likewise. * daemon/remote.c: Likewise. * src/esx/esx_driver.c: Likewise. * src/libxl/libxl_driver.c: Likewise. * src/lxc/lxc_driver.c: Likewise. * src/qemu/qemu_driver.c: Likewise. * src/remote/remote_driver.c: Likewise. * src/test/test_driver.c: Likewise. * src/xen/xen_driver.c: Likewise. * src/xen/xen_hypervisor.c: Likewise. * src/xen/xen_hypervisor.h: Likewise. * src/xen/xend_internal.c: Likewise. * tools/virsh.c: Likewise.
* interface: expose network config transaction API to virshMichal Privoznik2011-05-271-0/+91
| | | | | This implements the commands iface-begin, iface-commit, and iface-rollback, which simply call the corresponding functions in the libvirt API.
* Add new flags for setting memory parametersHu Tao2011-05-272-3/+30
| | | | | | | | | | | The new flags allow to pick current state, config or the live parameter, with current being the existing API default (0). This also hooks this to --config, --live, --current parameters for the memtune virsh command * include/libvirt/libvirt.h.in: defines the new flags * tools/virsh.c: adds support at virsh level * tools/virsh.pod: updates virsh documentation
* virsh: time_t is not a long on FreeBSDMatthias Bolte2011-05-251-4/+10
| | | | localtime_r expects time_t.
* virsh: Use Env variables for debug level and logfileSupriya Kannery2011-05-191-3/+28
| | | | | | Use variables VIRSH_DEBUG and VIRSH_LOG_FILE for controlling virsh logging. Signed-off-by: Supriya Kannery <supriyak@in.ibm.com>
* virsh: optimize creation of default connectionEric Blake2011-05-181-179/+250
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ramon de Carvalho Valle reported a problem with: virsh connect qemu:///system as a non-root user. The real root problem appears to be a regression in libvirtd being auto-started on the default qemu:///session URI; however, the symptom points to an independent flaw in virsh - we shouldn't be wasting efforts on making a connection if we aren't going to be using that connection. Fixing virsh avoids Ramon's issue, while I work in the meantime to fix the real libvirtd regression. This patch looks big, but that's because 'gcc -Wmissing-field-initializers' gets triggered by './autobuild.sh --enable-compile-warnings=error', so I had to add 0 initialization to everyone (rather than my preference of just adding the non-zero flags to virshCmds and to cmdConnect). Meanwhile, if you use 'virsh -c URI', the connection must succeed; this patch _only_ optimizes the default connection to be deferred to a later point where we know if a particular command to be run needs a connection. * tools/virsh.c (VSH_CMD_FLAG_NOCONNECT): New flag. (vshCmdDef): Add new flags field. (vshCommandRun): Honor new flag. (domManagementCmds, domMonitoringCmds, storagePoolCmds) (storageVolCmds, networkCmds, nodedevCmds, ifaceCmds) (nwfilterCmds, secretCmds, virshCmds, snapshotCmds) (hostAndHypervisorCmds): Populate new field. (vshReconnect): Don't warn on initial connection.
* virsh: add parameters --live, --config and --current to cmd schedinfoHu Tao2011-05-172-5/+36
| | | | This enables user to modify cpu.shares even when domain is inactive.
* virsh: Correctly initialize libvirtJiri Denemark2011-05-171-4/+9
| | | | | | | | | | | virsh didn't call virInitialize(), which (among other things) initializes virLastErr thread local variable. As a result of that, virsh could just segfault in virEventRegisterDefaultImpl() since that is the first call that touches (resets) virLastErr. I have no idea what lucky coincidence made this bug visible but I was able to reproduce it in 100% cases but only in one specific environment which included building in sandbox.
* virsh: Report an error when virGetUserDirectory failsMatthias Bolte2011-05-161-1/+3
| | | | | Otherwise virsh shows the interactive greeting and then silently exists instead of entering interactive mode.