Commit Graph

195 Commits

Author SHA1 Message Date
Daniel P. Berrange
aa2c97263d virsh additions for sVirt support (James Morris & Dan Walsh) 2009-03-03 09:59:02 +00:00
Jim Meyering
9883bec50d virsh: tweak a format string to avoid emitting trailing space
* src/virsh.c (cmdNetworkList): Change format not to right-pad
with spaces, as that would have required a trailing blank in
an expected output file.
2009-03-02 18:39:36 +00:00
Daniel Veillard
6427091ffe * src/virsh.c: add 3 new commands for node device detach, reattach and reset,
patch by Mark McLoughlin.
Daniel
2009-03-02 16:28:17 +00:00
Cole Robinson
3a53ab7913 Unbreak virsh *-edit commands: Don't pass unexpected flags to DumpXML 2009-02-16 22:51:31 +00:00
John Levon
f84c166013 Improve error reporting in virsh 2009-02-09 14:24:06 +00:00
Daniel P. Berrange
1290b28f59 Limit virsh history entries to 500 (Jim Paris) 2009-02-09 10:24:27 +00:00
John Levon
745c249a61 Fix yet another printf("%s", NULL) case
Fix getpwuid_r() usage
Fix virsh migrateuri handling
2009-01-30 15:43:05 +00:00
Daniel P. Berrange
3801794908 Support VNC password setting in QEMU driver 2009-01-29 17:50:00 +00:00
Guido Günther
a99e5ccba4 don't abort if setlocale() fails 2009-01-29 11:49:33 +00:00
Jim Meyering
8f06d6b103 avoid bogus descriptions due to use of gettext with the empty string
* src/virsh.c: Use `""', not `gettext_noop("")', in numerous
vshCmdInfo definitions.  The latter provokes a warning from gettext.
2009-01-05 13:27:43 +00:00
Guido Günther
043d702f02 use virAsprintf instead of asprintf 2008-12-23 13:03:29 +00:00
Cole Robinson
bd24695a23 Merge xml building for virsh pool-*-as 2008-12-22 16:23:36 +00:00
Jim Meyering
289d52c49e remove redundant optname arguments
This is the second part of the change mentioned here:

  http://thread.gmane.org/gmane.comp.emulators.libvirt/10331

It removes the essentially redundant "optname" parameter
from each of the vshCommandOptNetworkBy and vshCommandOptDomainBy
functions as well as the correspond macros (without "By" suffix).
Now, instead of always passing the optname, "domain", to
vshCommandOptDomainBy, that function requires that its command
argument refer to an opts array containing a "domain" option.

This normalization makes one more help-related change:
it renames the net-start "name" argument to the more
sensible and consistent "network".
* src/virsh.c (VSH_BYNAME, vshCommandOptDomain)
(cmd_has_option): New function, used in vshCommandOptDomainBy
and vshCommandOptNetworkBy.
(vshCommandOptDomainBy, vshCommandOptNetworkBy): Remove the optname
parameter, it's always "domain" ("network").  Update all callers.
Call cmd_has_option.
(vshCommandOptNetwork, cmdAutostart, cmdConsole, cmdDomstate)
(cmdDomblkstat, cmdDomIfstat, cmdSuspend, cmdUndefine, cmdStart)
(cmdSave, cmdSchedinfo, cmdDump, cmdResume, cmdShutdown)
(cmdReboot, cmdDestroy, cmdDominfo, cmdVcpuinfo, cmdVcpupin)
(cmdSetvcpus, cmdSetmem, cmdSetmaxmem, cmdDumpXML, cmdDomname)
(cmdDomid, cmdDomuuid, cmdMigrate, cmdNetworkAutostart)
(cmdNetworkDestroy, cmdNetworkDumpXML, cmdNetworkName)
(opts_network_start, cmdNetworkStart, cmdNetworkUndefine)
(cmdNetworkUuid, cmdVNCDisplay, cmdTTYConsole, cmdAttachDevice)
(cmdDetachDevice, cmdAttachInterface, cmdDetachInterface)
(cmdAttachDisk, cmdDetachDisk, cmdEdit)
* src/Makefile.am (virsh-pool-edit.c): This code is generated
from cmdEdit, and cmdEdit uses the vshCommandOptDomain macro which
now, with the changes above, has only 3 (was 4) arguments, yet the
macro use is mapped to vshCommandOptPool, which still requires 4
arguments.  So this change adjusts the sed code to reinsert the
just-removed argument -- we're not changing pool-related code right
now, because it's not as straight-forward.
2008-12-15 10:26:54 +00:00
Jim Meyering
9c5470d292 remove cvs $Id$ strings
* po/id.po: Likewise.
* qemud/remote_generate_stubs.pl: Likewise.
* src/virsh.c: Likewise.
* tests/testutils.c: Likewise.
* tests/testutils.h: Likewise.
* RENAMES: Likewise.
2008-12-12 12:45:34 +00:00
Jim Meyering
3693a02fff fix just-broken "virsh start" and "virsh pool-start" commands
* src/virsh.c (cmdPoolStart, cmdStart): Change hard-coded
vshCommandOptDomainBy string argument to match just-changed
option name.  Cole Robinson reported that "virsh start" was
broken and provided that part of the fix.
Bug introduced by yesterday's "virsh.c: tweak options to produce
more accurate help".
* tests/start: New file.  Test for the above fix.
* tests/Makefile.am (test_scripts): Add start.
2008-12-09 21:38:04 +00:00
Jim Meyering
1c9968a2b1 virsh.c: tweak options to produce more accurate help
* src/virsh.c: Adjust some vshCmdOptDef command option flags
to improve auto-generated help command syntax.
2008-12-08 13:22:44 +00:00
Jim Meyering
c9319f315c virsh.c: remove all "syntax" vshCmdInfo entries.
* src/virsh.c: ... now that info is generated.
2008-12-08 13:22:13 +00:00
Jim Meyering
34e5d2941c virsh.c: add missing (yet empty) "desc" strings
* src/virsh.c: Now, every command must have a "desc" string,
even if it has zero length.  Mark these, so they'll be filled in.
2008-12-08 13:21:30 +00:00
Jim Meyering
6f61232852 virsh.c: generate each "virsh help COMMAND"s synopsis
* src/virsh.c: Also, diagnose extra arguments after --help (-h).
2008-12-08 13:14:48 +00:00
Cole Robinson
76944e8137 Fix documentation cut and paste errors, and a virsh typo. 2008-12-04 14:51:57 +00:00
Jim Meyering
62bcd5d32b tests: new test: virsh-synopsis
* tests/virsh-synopsis: new file
* tests/Makefile.am (test_scripts): Add virsh-synopsis.
* src/virsh.c: Correct help SYNOPSIS for each of seven commands.

When I first ran this script, "make check" failed like this:
  ...
  invalid help SYNOPSIS for net-create:
      create a network from an XML <file>
  invalid help SYNOPSIS for net-define:
      define a network from an XML <file>
  invalid help SYNOPSIS for net-start:
      start <network>
  invalid help SYNOPSIS for pool-create:
      create a pool from an XML <file>
  invalid help SYNOPSIS for pool-define:
      define a pool from an XML <file>
  invalid help SYNOPSIS for pool-start:
      start <pool>
  invalid help SYNOPSIS for vol-create:
      create <file>
  FAIL: virsh-synopsis
2008-11-24 07:13:29 +00:00
Daniel P. Berrange
145bb1e821 Misc tweaks to node device impl 2008-11-21 12:46:39 +00:00
Daniel P. Berrange
1ee5367c19 Node device support in virsh (David Lively) 2008-11-21 12:39:48 +00:00
Daniel P. Berrange
25047e7cf8 Use a versioned linker script 2008-11-17 11:03:25 +00:00
Daniel Veillard
df285bdd8d KVM/QEmu migration support
* qemud/remote.c qemud/remote_dispatch_localvars.h
  qemud/remote_dispatch_proc_switch.h qemud/remote_dispatch_prototypes.h
  qemud/remote_protocol.c qemud/remote_protocol.h
  qemud/remote_protocol.x src/driver.h src/libvirt.c
  src/libvirt_internal.h src/libvirt_sym.version src/lxc_driver.c
  src/openvz_driver.c src/qemu_conf.h src/qemu_driver.c
  src/remote_internal.c src/test.c src/virsh.c: large patch to
  add migration support for KVM/QEmu, based on the work of Rich Jones
  and Chris Lalancette. This introduce a new version of the prepare
  and finish steps of the migration, so changes the driver API and
  a lot of code.
Daniel
2008-11-14 08:42:47 +00:00
Jim Meyering
fd52c6ff67 avoid many format string warnings
Building with --disable-nls exposed many new warnings like these:
virsh.c:4952: warning: format not a string literal and no format ...
util.c:163: warning: format not a string literal and no format arguments
All but one of the following changes add a "%s" argument before
the offending _(...) argument.

This was the only manual change:
* src/lxc_driver.c (lxcVersion): Use %s and strerror(errno)
rather than %m, to avoid a warning from gcc -Wformat-security.

Add "%s" before each warned about format-string-with-no-%-directive:
* src/domain_conf.c (virDomainHostdevSubsysUsbDefParseXML)
(virDomainDefParseString, virDomainDefParseFile):
* src/hash.c (virGetConnect, __virGetDomain, virReleaseDomain)
(__virGetNetwork, virReleaseNetwork, __virGetStoragePool)
(virReleaseStoragePool, __virGetStorageVol, virReleaseStorageVol):
* src/lxc_container.c (lxcContainerChild):
* src/lxc_driver.c (lxcDomainDefine, lxcDomainUndefine)
(lxcDomainGetInfo, lxcGetOSType, lxcDomainDumpXML)
(lxcSetupInterfaces, lxcDomainStart, lxcDomainCreateAndStart)
(lxcVersion, lxcGetSchedulerParameters):
* src/network_conf.c (virNetworkDefParseString)
(virNetworkDefParseFile):
* src/openvz_conf.c (openvzReadNetworkConf, openvzLoadDomains):
* src/openvz_driver.c (openvzDomainDefineCmd)
(openvzDomainGetInfo, openvzDomainDumpXML, openvzDomainShutdown)
(openvzDomainReboot, ADD_ARG_LIT, openvzDomainDefineXML)
(openvzDomainCreateXML, openvzDomainCreate, openvzDomainUndefine)
(openvzDomainSetAutostart, openvzDomainGetAutostart)
(openvzDomainSetVcpus):
* src/qemu_driver.c (qemudDomainBlockPeek, qemudDomainMemoryPeek):
* src/remote_internal.c (remoteDomainBlockPeek)
(remoteDomainMemoryPeek, remoteAuthPolkit):
* src/sexpr.c (sexpr_new, _string2sexpr):
* src/storage_backend_disk.c (virStorageBackendDiskMakeDataVol)
(virStorageBackendDiskCreateVol):
* src/storage_backend_fs.c
(virStorageBackendFileSystemNetFindPoolSources):
* src/storage_backend_logical.c (virStorageBackendLogicalFindLVs)
(virStorageBackendLogicalFindPoolSources):
* src/test.c (testOpenDefault, testOpenFromFile, testOpen)
(testGetDomainInfo, testDomainRestore)
(testNodeGetCellsFreeMemory):
* src/util.c (virExec):
* src/virsh.c (cmdAttachDevice, cmdDetachDevice)
(cmdAttachInterface, cmdDetachInterface, cmdAttachDisk)
(cmdDetachDisk, cmdEdit):
* src/xend_internal.c (do_connect, wr_sync, xend_op_ext)
(urlencode, xenDaemonDomainCreateXML)
(xenDaemonDomainLookupByName_ids, xenDaemonDomainLookupByID)
(xenDaemonParseSxprOS, xend_parse_sexp_desc_char)
(xenDaemonParseSxprChar, xenDaemonParseSxprDisks)
(xenDaemonParseSxpr, sexpr_to_xend_topology, sexpr_to_domain)
(xenDaemonDomainFetch, xenDaemonDomainGetAutostart)
(xenDaemonDomainSetAutostart, xenDaemonDomainMigratePerform)
(xenDaemonDomainDefineXML, xenDaemonGetSchedulerType)
(xenDaemonGetSchedulerParameters)
(xenDaemonSetSchedulerParameters, xenDaemonDomainBlockPeek)
(xenDaemonFormatSxprChr, virDomainXMLDevID):
* src/xm_internal.c (xenXMConfigCacheRefresh, xenXMDomainPinVcpu)
(xenXMDomainCreate, xenXMDomainDefineXML)
(xenXMDomainAttachDevice, xenXMDomainDetachDevice):
* src/xml.c (virXPathString, virXPathNumber, virXPathLong)
(virXPathULong, virXPathBoolean, virXPathNode, virXPathNodeSet):
* src/xs_internal.c (xenStoreOpen):
2008-10-13 16:46:28 +00:00
Daniel Veillard
f6803c960f virDomainDefineXML, and a few additional cleanups
* include/libvirt/libvirt.h[.in] include/libvirt/virterror.h
  qemud/remote* src/driver.h src/libvirt.c src/libvirt_sym.version
  src/lxc_driver.c src/openvz_driver.c src/proxy_internal.c
  src/qemu_driver.c src/remote_internal.c src/test.c src/virsh.c
  src/xen_internal.c src/xen_unified.c src/xen_unified.h
  src/xend_internal.c src/xend_internal.h src/xm_internal.c
  src/xs_internal.c docs/*: cleanup virDomainCreateLinux into
  virDomainDefineXML, and a few additional cleanups
Daniel
2008-10-10 09:32:27 +00:00
Daniel P. Berrange
218334d1b2 Fix two compile warnings 2008-10-09 14:50:25 +00:00
Dan Smith
6c504d6a7c Add LXC scheduling parameters and support in virsh schedinfo 2008-10-08 16:28:48 +00:00
Richard W.M. Jones
3b7c7d888a Change name of "blocked" state to "idle" (John Levon). 2008-09-17 14:18:15 +00:00
Daniel Veillard
54a4f8d44d add output on attach and detach success
* src/virsh.c: patch from Cole Robinson to add output on attach
  and detach success
daniel
2008-09-03 12:38:28 +00:00
Daniel Veillard
41ce15a586 Adds storage source element for pools
* src/storage_backend.h src/storage_backend_logical.c
src/storage_conf.c src/storage_conf.h src/virsh.c:
Applied patches from David Lively to add storage source
elements needed for storage pool
* docs/formatstorage.html docs/formatstorage.html.in: associated
documentation
Daniel
2008-09-02 14:15:42 +00:00
Daniel P. Berrange
39c9354c5c Add storage pool source discovery support (patch from David Lively) 2008-08-27 20:05:58 +00:00
Atsushi SAKAI
6fd4c30285 fix typos src/virsh.c from John Levon,
and 3 more files(src/domain_conf.c src/openvz_driver.c src/qemu_driver.c)
2008-08-15 01:41:49 +00:00
Atsushi SAKAI
43c7f972aa fix compilation for MinGW 2008-08-12 08:25:48 +00:00
Richard W.M. Jones
969fa847c1 'virsh edit' and related commands
* src/virsh.c: Implement 'virsh edit', 'virsh net-edit' and
	  'virsh pool-edit' commands.  These edit the XML for domains,
	  networks and storage pools respectively, and are the
	  equivalent of doing 'virsh dumpxml; vi foo.xml; virsh define'
	* src/Makefile.am, src/.cvsignore: Auto-generate the net-edit
	  and pool-edit commands.
	* docs/virsh.pod: Updated the documentation.
2008-08-01 14:30:41 +00:00
Jim Meyering
66f9bb5b95 virsh.c: more const-correctness fixes 2008-08-01 13:51:18 +00:00
Richard W.M. Jones
3f3345aa85 Const-correctness fixes in virsh.c
* src/virsh.c: Const-correctness.
2008-08-01 12:19:56 +00:00
Jim Meyering
2eb8ab2057 better diagnostic when failing to undefine a running domain via ID
* src/virsh.c (cmdUndefine): Tell user to shutdown and then use name or UUID.
* tests/undefine: New test.  Exercise virsh's undefine command.
* tests/Makefile.am (test_scripts): Add undefine.
2008-07-22 16:12:01 +00:00
Daniel Veillard
16b8942966 undefine command can't take an ID
* src/virsh.c: patch from Evgeniy Sokolov for the undefine command
  which can't take an id
Daniel
2008-07-17 11:49:15 +00:00
Daniel P. Berrange
a9d4944f8e Don't add trailing blanks in dominfo output 2008-05-29 14:56:12 +00:00
Richard W.M. Jones
5c9454aa6e Display autostart status in virsh dominfo command.
* src/virsh.c: Display autostart status in virsh dominfo
	command (Shigeki Sakamoto).
2008-05-27 09:41:25 +00:00
Richard W.M. Jones
1d8d4f86b6 Standardize use of header files, making internal.h primary.
* qemud/internal.h, qemud/qemud.h: Rename this file so it
	doesn't conflict with src/internal.h.
	* HACKING: Document how header files should be used.
	* qemud/Makefile.am: Add src/ directory to includes.
	* qemud/event.c, qemud/mdns.c, qemud/qemud.c, qemud/remote.c,
	qemud/remote_protocol.c, qemud/remote_protocol.h,
	qemud/remote_protocol.x, src/buf.c, src/libvirt.c,
	src/nodeinfo.c, src/qemu_conf.c, src/qemu_driver.c,
	src/stats_linux.c, src/storage_backend.c, src/storage_backend_fs.c,
	src/storage_backend_iscsi.c, src/storage_backend_logical.c,
	src/storage_conf.c, src/storage_driver.c, src/util.c,
	src/util.h, src/virsh.c, src/virterror.c, src/xend_internal.c,
	src/xml.c, tests/reconnect.c, tests/xmlrpctest.c,
	tests/qparamtest.c: Standardize	use of header files.
	* docs/*, po/*: Rebuild docs.
2008-05-23 08:24:41 +00:00
Daniel P. Berrange
e866e302f8 Fixed couple of memory leaks wrt to virXXXDestroy APIs, and clarify docs to match reality 2008-05-21 20:53:30 +00:00
Jim Meyering
c1ee35af3b start using c-ctype functions
Up to now, we've been avoiding ctype functions like isspace, isdigit,
etc.  because they are locale-dependent.  Now that we have the c-ctype
functions, we can start using *them*, to make the code more readable
with changes like these:

-        /* This may not work on EBCDIC. */
-        if ((*p >= 'a' && *p <= 'z') ||
-            (*p >= 'A' && *p <= 'Z') ||
-            (*p >= '0' && *p <= '9'))
+        if (c_isalnum(*p))

-    while ((*cur >= '0') && (*cur <= '9')) {
+    while (c_isdigit(*cur)) {

Also, some macros in conf.c used names that conflicted with
standard meaning of "BLANK" and "SPACE", so I've adjusted them
to be in line with the definition of e.g., isblank.
In addition, I've wrapped those statement macros with do {...} while (0),
so that we can't forget the ";" after a use.  There was one like that
already (fixed below).  The missing semicolon would mess up automatic
indenting.
* src/buf.c (virBufferURIEncodeString):
* src/conf.c (IS_EOL, SKIP_BLANKS_AND_EOL, SKIP_BLANKS)
(virConfParseLong, virConfParseValue, virConfParseName)
(virConfParseSeparator, virConfParseStatement, IS_BLANK, IS_CHAR)
(IS_DIGIT, IS_SPACE, SKIP_SPACES):
* src/nodeinfo.c:
* src/qemu_conf.c (qemudParseInterfaceXML):
* src/qemu_driver.c (qemudDomainBlockStats):
* src/sexpr.c:
* src/stats_linux.c:
* src/util.c (virParseNumber, virDiskNameToIndex):
* src/uuid.c (hextobin, virUUIDParse):
* src/virsh.c:
* src/xml.c (parseCpuNumber, virParseCpuSet):
2008-05-16 09:37:44 +00:00
Daniel P. Berrange
1d73398e8f Remove all use of strcmp, strncmp in favour of STREQ, STREQLEN, STRPREFIX 2008-05-14 19:51:24 +00:00
Jim Meyering
25534052bc Use gnulib's c-ctype.h, not <ctype.h>.
# Convert uses of isspace to c_isspace, isdigit to c_isdigit, etc.
re=$(man isspace|grep is.....,.is|sed 's/ -.*//' \
  |tr -s ', \n' \||sed 's/^|//;s/|$//')
git grep -l -E "$re"|grep -Ev 'Chan|gnulib' \
  |xargs perl -pi -e 's/\b('"$re"')\b/c_$1/g'
# Remove all uses of to_uchar
git grep -l to_uchar|xargs perl -pi -e 's/to_uchar\((.*?)\)/$1/g'
* src/util.h (to_uchar): Remove definition.
(TOLOWER): Remove definition.
(__virMacAddrCompare): Use c_tolower, not TOLOWER.
Globally:
  Where needed, change <ctype.h> to <c-ctype.h>.
  Remove unnecessary inclusion of <ctype.h>.
Ensure the global changes are never needed again:
* Makefile.maint (sc_avoid_ctype_macros): Prohibit use of ctype
macros.   Recommend c-ctype.h instead.
(sc_prohibit_c_ctype_without_use): New rule.
(sc_prohibit_ctype_h): New rule.  Disallow use of <ctype.h>.
2008-05-09 13:50:14 +00:00
Daniel P. Berrange
642b26fab2 Change virBuffer API to prevent common usage errors. Update all users of APIs 2008-04-28 15:14:59 +00:00
Jim Meyering
212472b813 avoid format-related warnings
* qemud/qemud.c (main): Fix a bogus format string reported as umarked.
* src/virsh.c (cmdVcpupin): Non-literal with no args.
2008-04-28 09:09:52 +00:00
Jim Meyering
225ba3f0af avoid problems with sign-extended "char" operand to is* functions
* src/util.h (to_uchar): Define function.
* src/nodeinfo.c (linuxNodeInfoCPUPopulate): Apply to_uchar to is* operand.
* src/qemu_driver.c (qemudExtractMonitorPath): Likewise.
* src/sexpr.c (_string2sexpr): Likewise.
* src/stats_linux.c (xenLinuxDomainDeviceID): Likewise.
* src/util.c (TOLOWER, __virMacAddrCompare, virParseMacAddr): Likewise.
* src/virsh.c (cmdVcpupin, vshCommandGetToken): Likewise.
2008-04-25 14:53:05 +00:00