Commit Graph

222 Commits

Author SHA1 Message Date
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
Richard W.M. Jones
ba5411995b Remove unused uid field in virsh control structure.
* src/virsh.c: Remove unused uid field in virsh control structure.
2008-04-10 17:37:23 +00:00
Jim Meyering
5bf824ea10 convert TAB-based indentation in C sources to use only spaces
Done using this command (also includes .c.in and .h.in files):
for i in $(g ls-files|grep -E '\.[ch](\.in)?$'|grep -v gnulib); do
  expand -i $i > j && mv j $i;done
2008-04-10 16:54:54 +00:00
Jim Meyering
dc42a9d2de remove Vim and Emacs variable settings from C source files
Done with these commands:
git grep -l Local.variab|xargs \
  perl -0x3b -pi -e 's,\n+/\*\n \* vim:(.|\n)*,\n,'

git grep -l Local.variab|xargs \
  perl -0x3b -pi -e 's,\n+/\*\n \* Local variables:\n(.|\n)*,\n,'
2008-04-10 16:53:29 +00:00
Daniel Veillard
62ee5d5711 error message on vcpupin
* src/virsh.c: patch from Shigeki Sakamoto adding message on vcpupin
Daniel
2008-04-04 11:20:45 +00:00
Daniel Veillard
a528e97383 typos fixes
* docs//* src/conf.c src/hash.c src/libvirt.c src/proxy_internal.c
 src/remote_internal.c src/virsh.c src/xen_internal.c
 src/xend_internal.c src/xml.c: applied patch from Atsushi SAKAI
 fixing a lot of typos
Daniel
2008-04-04 07:58:29 +00:00
Jim Meyering
513bd04ce1 Mark many more strings for translation.
* Makefile.maint (err_func_re): Add to the list and make it readable.
* po/POTFILES.in: Add src/util.c and src/xm_internal.c, and sort.
* src/storage_backend.c: Fix comment.
* src/util.c (virFileLinkPointsTo): Mark a string.
* qemud/remote.c (remoteDispatchClientRequest): Mark strings.
(remoteDispatchOpen, CHECK_CONN, remoteDispatchGetType): Likewise.
(remoteDispatchDomainGetSchedulerType): Likewise.
(remoteDispatchDomainGetSchedulerParameters): Likewise.
(remoteDispatchDomainSetSchedulerParameters): Likewise.
(remoteDispatchDomainBlockStats): Likewise.
(remoteDispatchDomainInterfaceStats): Likewise.
(remoteDispatchDomainAttachDevice, remoteDispatchDomainCreate):
(remoteDispatchDomainDestroy, remoteDispatchDomainDetachDevice):
(remoteDispatchDomainDumpXml, remoteDispatchDomainGetAutostart):
(remoteDispatchDomainGetInfo, remoteDispatchDomainGetMaxMemory):
(remoteDispatchDomainGetMaxVcpus, remoteDispatchDomainGetOsType):
(remoteDispatchDomainGetVcpus): Likewise.
(remoteDispatchDomainMigratePerform): Likewise.
(remoteDispatchListDefinedDomains, remoteDispatchDomainPinVcpu):
(remoteDispatchDomainReboot, remoteDispatchDomainResume):
(remoteDispatchDomainSave, remoteDispatchDomainCoreDump):
(remoteDispatchDomainSetAutostart): Likewise.
(remoteDispatchDomainSetMaxMemory, remoteDispatchDomainSetMemory):
(remoteDispatchDomainSetVcpus, remoteDispatchDomainShutdown):
(remoteDispatchDomainSuspend, remoteDispatchDomainUndefine):
(remoteDispatchListDefinedNetworks, remoteDispatchListDomains):
(remoteDispatchListNetworks, remoteDispatchNetworkCreate):
(remoteDispatchNetworkDestroy, remoteDispatchNetworkDumpXml):
(remoteDispatchNetworkGetAutostart, remoteDispatchNetworkGetBridgeName):
(remoteDispatchNetworkSetAutostart, remoteDispatchNetworkUndefine):
(addrToString, remoteDispatchAuthSaslInit, remoteDispatchAuthSaslStart):
(remoteDispatchAuthSaslStep, remoteDispatchListDefinedStoragePools):
(remoteDispatchListStoragePools, remoteDispatchStoragePoolCreate):
(remoteDispatchStoragePoolBuild, remoteDispatchStoragePoolDestroy):
(remoteDispatchStoragePoolDelete, remoteDispatchStoragePoolRefresh):
(remoteDispatchStoragePoolGetInfo, remoteDispatchStoragePoolDumpXml):
(remoteDispatchStoragePoolGetAutostart): Likewise.
(remoteDispatchStoragePoolSetAutostart):
(remoteDispatchStoragePoolListVolumes):
(remoteDispatchStoragePoolNumOfVolumes):
(remoteDispatchStoragePoolUndefine, remoteDispatchStorageVolCreateXml):
(remoteDispatchStorageVolDelete, remoteDispatchStorageVolGetInfo):
(remoteDispatchStorageVolDumpXml, remoteDispatchStorageVolGetPath):
(remoteDispatchStorageVolLookupByName): Likewise.
* src/qemu_driver.c (qemudOpenMonitor, qemudStartVMDaemon):
(dhcpStartDhcpDaemon, qemudStartNetworkDaemon):
(qemudDomainSuspend, qemudDomainResume, qemudDomainShutdown):
(qemudDomainGetOSType, qemudDomainSetMaxMemory):
(qemudDomainSetMemory, qemudDomainGetInfo, qemudDomainSave):
(qemudDomainRestore, qemudDomainDumpXML, qemudDomainStart):
(qemudDomainUndefine, qemudDomainChangeCDROM):
(qemudDomainAttachDevice, qemudDomainGetAutostart):
(qemudDomainSetAutostart, qemudDomainInterfaceStats):
(qemudNetworkLookupByUUID, qemudNetworkLookupByName):
(qemudNetworkUndefine, qemudNetworkStart, qemudNetworkDestroy):
(qemudNetworkDumpXML, qemudNetworkGetAutostart):
(qemudNetworkSetAutostart): Likewise.
* src/virsh.c (cmdVcpupin, cmdAttachDevice, cmdDetachDevice): Likewise.
* src/xm_internal.c (xenXMConfigCacheRefresh, xenXMDomainPinVcpu): Likewise.
2008-03-27 13:43:01 +00:00
Richard W.M. Jones
dc1824b780 Tue Mar 25 10:23:00 UTC 2008 Richard W.M. Jones <rjones@redhat.com>
* src/virsh.c: Additional error messages for missing
         parameters (Shigeki Sakamoto).
2008-03-25 10:26:32 +00:00
Daniel Veillard
a7892ee000 String fixes #436620
* qemud/qemud.c src/virsh.c: fixing some user facing strings
  problems pointed out by Francesco Tombolini should fix #436620
Daniel
2008-03-14 15:21:15 +00:00
Daniel Veillard
dc232cdf1b * src/bridge.c src/virsh.c: typo fixes from Atsushi SAKAI
daniel
2008-03-13 09:21:41 +00:00
Daniel P. Berrange
c3501d4792 Don't force Xen connections to readonly when non-root 2008-03-11 14:25:49 +00:00
Richard W.M. Jones
4d6a8a1c0a Report error when vcpupin is given bad vCPU number.
* src/virsh.c: Report error when vcpupin is given bad vCPU number
	  (Shigeki Sakamoto).
2008-03-04 19:59:56 +00:00
Richard W.M. Jones
92a1e14b0b virMacAddrCompare for comparing MAC addresses
* src/util.c, src/util.h, src/libvirt_sym.version: Added
	  virMacAddrCompare utility function for comparing MAC
	  addresses.
	* src/virsh.c, src/xm_internal.c: Use virMacAddrCompare
	  to compare addresses.  (Shigeki Sakamoto and Richard Jones).
2008-02-27 16:14:44 +00:00
Jim Meyering
b59d9c85f1 Use safewrite in place of write, in many cases.
Also add "make syntax-check" rules to ensure no new uses sneak in.

There are many uses of write like this:

    if (write (fd, xml, towrite) != towrite)
        return -1;

The problem is that the syscall can succeed, yet write less than
the requested number of bytes, so the caller should retry
rather than simply failing.

This patch changes most of them to use util.c's safewrite wrapper,
which encapsulates the process.  Also, there were a few cases in
which the retry loop was open-coded, and I replaced those, too.

* Makefile.maint (sc_avoid_write): New rule, to avoid recurrence.
* .x-sc_avoid_write: New file.  Record two legitimate exemptions.
* qemud/qemud.c (sig_handler, qemudClientWriteBuf): Use safewrite, not write.
* src/conf.c (__virConfWriteFile): Likewise.
* src/qemu_conf.c (qemudSaveConfig, qemudSaveNetworkConfig): Likewise.
* src/qemu_driver.c (qemudWaitForMonitor, qemudStartVMDaemon)
(qemudVMData, PROC_IP_FORWARD): Likewise.
* proxy/libvirt_proxy.c: Include "util.h".
(proxyWriteClientSocket): Use safewrite.
* src/test.c (testDomainSave, testDomainCoreDump): Likewise.
* src/proxy_internal.c (virProxyWriteClientSocket): Likewise.
* src/virsh.c: Include "util-lib.h".
(vshOutputLogFile): Use safewrite.
* src/console.c: Include "util-lib.h".
(vshRunConsole): Use safewrite.
2008-02-22 15:55:04 +00:00
Daniel P. Berrange
f43e709842 Added convenience virsh command for creating pools/volumes without XML 2008-02-20 15:29:13 +00:00
Daniel P. Berrange
816fd02876 Added virsh commands for storage management 2008-02-20 15:27:08 +00:00
Mark McLoughlin
3da5504e68 Fix gcc-4.3.0 "inlining failed" warning.
* src/internal.h: move xstrol() variants from here ...

* src/util.[ch]: ... to here and rename to virStrToLong()

* src/libvirt_sym.version: export __virStrToLong_i() for
virsh and qemud.

* src/nodeinfo.c, src/stats_linux.c, src/virsh.c,
  src/xend_internal.c, qemud/qemud.c: replace xstrtol()
calls with virStrToLong()

* src/nodeinfo.h: don't include internal.h, which was only
needed for xstrtol(), but instead include libvirt.h which
is suffificient for the declarations in the header.
2008-02-08 09:15:16 +00:00
Jim Meyering
e8ff93b4e6 Remove more useless if tests before "free"-like functions.
* build-aux/useless-if-before-free: Rename from ...
* build-aux/find-unnecessary-if-before-free: ... this.  Remove file.
Also changed it so that new names are no longer hard-coded in the
script.  Instead, they're supplied via options:
* Makefile.cfg (useless_free_options): Define.
Add xmlXPathFreeObject to the list of free-like functions it detects.
* Makefile.maint (sc_avoid_if_before_free): Reflect script renaming.
* .x-sc_avoid_if_before_free: Likewise.
* src/openvz_conf.c (openvzParseXML): Remove useless "if"-before-free.
* src/qemu_conf.c (qemudParseXML, qemudParseNetworkXML): Likewise.
* src/virsh.c (cmdVNCDisplay, cmdTTYConsole, cmdDetachInterface):
(cmdDetachDisk): Likewise.
* src/xm_internal.c (xenXMConfigSetIntFromXPath): Likewise.
(xenXMConfigSetStringFromXPath, xenXMParseXMLToConfig): Likewise.
(xenXMDomainAttachDevice, xenXMAttachDisk, xenXMAttachInterface):
(xenXMDomainDetachDevice): Likewise.
* src/xml.c (virXPathString): Likewise.
* tests/xmlrpctest.c (checkRequestValue): Likewise.
2008-02-07 16:49:29 +00:00
Jim Meyering
e04912a9f0 Remove all trailing blanks; turn on the rule to detect them.
* Makefile.cfg (local-checks-to-skip): Remove sc_trailing_blank.
* .x-sc_trailing_blank: New file, to exempt the few binary files.
2008-02-05 19:27:37 +00:00
Jim Meyering
e99570fc77 Mark a string for translation.
* src/virsh.c: Add a "%s" and wrap with _(...).
2008-02-04 14:58:47 +00:00
Jim Meyering
f5f530f33f Avoid virsh leaks due to missing virDomainFree(dom) calls
* src/virsh.c (cmdDomuuid): Add missing virDomainFree call.
(cmdAttachDevice): Likewise.
(cmdDetachDevice): Likewise.
2008-01-30 19:58:59 +00:00
Jim Meyering
a1d2d2b21c src/virsh.c (cmdCapabilities): Plug a small leak. 2008-01-30 19:57:54 +00:00
Jim Meyering
2367caa327 Also detect and remove unnecessary if-before-xmlXPathFreeContext.
* build-aux/find-unnecessary-if-before-free: Update regexp.
* src/openvz_conf.c: Remove unnecessary "if (P)"-before xmlXPathFreeContext.
* src/qemu_conf.c: Likewise.
* src/virsh.c: Likewise.
* src/xm_internal.c: Likewise.
* src/xml.c: Likewise.
* tests/xmlrpctest.c: Likewise.
2008-01-29 18:23:43 +00:00
Jim Meyering
a378188194 Enable the <config.h>-requiring test; fix violations
Use <config.h>, not "config.h", per autoconf documentation.
* Makefile.cfg (local-checks-to-skip) [sc_require_config_h]: Enable.
* .x-sc_require_config_h: New file, to list exempted files.
* Makefile.am (EXTRA_DIST): Add .x-sc_require_config_h.
2008-01-29 18:15:54 +00:00
Jim Meyering
acff2d11ac Given code like if (foo) free (foo); remove the useless "if (foo) " part.
Likewise, given if (foo != NULL) free (foo); remove the useless "if" test.

* proxy/libvirt_proxy.c: Remove unnecessary "if" test before free.
* python/generator.py: Likewise.
* qemud/qemud.c: Likewise.
* src/buf.c: Likewise.
* src/conf.c: Likewise.
* src/hash.c: Likewise.
* src/iptables.c: Likewise.
* src/libvirt.c: Likewise.
* src/openvz_conf.c: Likewise.
* src/qemu_conf.c: Likewise.
* src/qemu_driver.c: Likewise.
* src/remote_internal.c: Likewise.
* src/test.c: Likewise.
* src/virsh.c: Likewise.
* src/virterror.c: Likewise.
* src/xen_internal.c: Likewise.
* src/xen_unified.c: Likewise.
* src/xend_internal.c: Likewise.
* src/xm_internal.c: Likewise.
* src/xml.c: Likewise.
* src/xmlrpc.c: Likewise.
* src/xs_internal.c: Likewise.
* tests/testutils.c: Likewise.
* tests/xencapstest.c: Likewise.
* tests/xmconfigtest.c: Likewise.
2008-01-29 17:41:07 +00:00
Daniel P. Berrange
45738083a6 Use virFileReadAll in virsh.c 2008-01-21 15:27:14 +00:00
Jim Meyering
42e5d20ae9 Avoid format string warnings.
* src/virsh.c: Add "%s" where needed.
* src/proxy_internal.c: Likewise.
2008-01-16 17:13:23 +00:00
Richard W.M. Jones
0d14fc0cbb Fri Dec 7 14:49:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
* src/console.c, src/console.h, src/virsh.c: Disable
	  text console on Windows.
	* src/libvirt.c: Use replacement getpass from Gnulib.
	* src/libvirt.c: Initialize Winsock before use.
	* src/remote_internal.c: Header file fixes for Windows.
	  Don't fail if AI_ADDRCONFIG isn't defined.  Disable
	  unsupported stuff under Windows.
	* src/uuid.c: ENODATA unavailable on Windows, use EIO instead.
	* src/virsh.c: No uid_t / getuid on Windows.
	* src/virsh.c: No O_SYNC on Windows.
2007-12-07 14:56:37 +00:00
Richard W.M. Jones
efd495d667 Thu Dec 6 16:32:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
* src/virsh.c: The prompt should depend on readonly status,
	  not on the UID.
2007-12-06 16:36:21 +00:00
Daniel Veillard
7633453cfa * configure.in src/Makefile.am src/virsh.c: fix compilation problems
when readline headers were found but not the library
Daniel
2007-12-06 10:24:52 +00:00
Daniel P. Berrange
e332ccdf71 Wire up SASL interaction callbacks to libvirt callbacks. Provide default callback impl 2007-12-05 18:55:04 +00:00
Daniel P. Berrange
ca71b87cb0 Quit virsh immediately if connection open fails, rather than giving a non-functional interactive shell 2007-12-05 16:24:22 +00:00
Richard W.M. Jones
4338271f1a Tue Dec 4 17:47:01 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
* configure.in: curses is not actually required to build libvirt
	* configure.in, src/virsh.c: Make readline optional.  If not
	  available then virsh is built without support for command
	  line editing.
2007-12-04 18:27:52 +00:00
Daniel P. Berrange
2b3c49b6ab Fix numerous memory leaks 2007-12-01 15:45:25 +00:00
Richard W.M. Jones
ba75647b55 Thu Nov 29 09:15:00 GMT 2007 Richard W.M. Jones <rjones@redhat.com>
* src/virsh.c: Added #include <time.h> so it can compile
          on CentOS 4 (Carl Jones).
2007-11-29 09:18:04 +00:00
Richard W.M. Jones
df0525a911 Wed Nov 28 14:20:00 GMT 2007 Richard W.M. Jones <rjones@redhat.com>
* src/virsh.c: Missing comma.
2007-11-28 14:22:30 +00:00
Jim Meyering
55311d6c38 src/virsh.c (vshCloseLogFile): Diagnose close/write failure. 2007-11-28 13:22:33 +00:00
Daniel Veillard
a500a479b0 Begin fixing uses of strtol: parse integers more carefully.
Patch from Jim Meyering
* src/internal.h: Include <errno.h>.
  Define new static inline function, xstrtol_i.
* src/virsh.c: Detect integer overflow in domain ID number
  in vshCommandOptDomainBy. Detect overflow and invalid port
  number suffix in cmdVNCDisplay.
* src/xend_internal.c: Parse CPU number more carefully in
  xenDaemonDomainGetVcpus.
* tests/int-overflow: New script. Test for the above-fixed bug.
* tests/Makefile.am: Add int-overflow to TESTS. Define
  TESTS_ENVIRONMENT, to propagate $abs_top_* variables into the
  int-overflow script. Adapt the "valgrind" rule not to clobber
  new TESTS_ENVIRONMENT.
Daniel
2007-11-12 14:00:32 +00:00
Daniel Veillard
906c1f5055 * src/virsh.c: initialize a couple of variable to avoid warnings
when compiling with Fedora.
Daniel
2007-11-08 18:07:02 +00:00
Daniel Veillard
710547590b * src/virsh.c: patch from Jim Meyering to use gcc's printf attribute.
Daniel
2007-11-08 18:00:52 +00:00
Daniel Veillard
b31ed75bff * src/virsh.c: patch from Jim Meyering to correct vshCommandOptInt
indentation
Daniel
2007-11-08 16:14:12 +00:00
Daniel Veillard
31eade077e * src/virsh.c: patch from Masayuki Sunou to fix parameter
validation of virsh schedinfo parameters.
Daniel
2007-11-06 09:41:18 +00:00
Daniel Veillard
b5a3d4da61 * src/virsh.c: use virNodeGetFreeMemory() for freecell without
argument
* src/libvirt_sym.version: export virNodeGetFreeMemory()
Daniel
2007-09-30 13:22:16 +00:00
Daniel P. Berrange
fb741174ad Solaris portability fix from Mark Johnson. Remove use of anonymous union members 2007-09-29 18:16:26 +00:00
Daniel Veillard
4bf3bc9eda * include/libvirt/libvirt.h[.in] src/driver.h src/openvz_driver.c
src/qemu_driver.c src/remote_internal.c src/test.c
  src/xen_internal.[ch] src/xen_unified.c src/xend_internal.[ch]
  src/libvirt.c src/libvirt_sym.version: adding NUMA support patches
  from Beth Kon adding new virNodeGetCellsFreeMemory entry point
  and extending the virConnectGetCapabilities one. Fix a couple of
  issues in the patch and add to exported symbols from shared lib.
* docs/virsh.pod docs/virsh.1 src/virsh.c: added new command
  freecell to get the available memory on the node or in a NUMA cell.
* docs/*: updated and regenerated the documentation
Daniel
2007-09-28 14:28:12 +00:00
Daniel Veillard
b4d74032b0 * src/virsh.c: apply patch from Masayuki Sunou to fix the exit value
of vncdisplay command.
Daniel
2007-08-29 07:47:09 +00:00
Daniel Veillard
3a4c8d219c * src/xs_internal.c: cleanup of memory leaks from Masayuki Sunou
* src/virsh.c: another memory leaks of virsh schedinfo cleanup from
  Saori Fukuta
* po/*: string localization merge/update
Daniel
2007-08-21 11:53:52 +00:00
Richard W.M. Jones
442a15770c Tue Aug 21 10:58:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/libvirt.c (virDomainBlockStats, virDomainInterfaceStats):
	  Added block device and network interface statistics.
	* src/xen_internal.c: Support for stats from Xen domains.
	* qemud/remote.c, qemud/remote_protocol.x, qemud/remote_internal.c:
	  Support for fetching device and network interface stats
	  across remote connections.
	* src/virsh.c: Added 'virsh domblkstat' and 'virsh domifstat'
	  commands to display stats.
	* docs/libvir.html, docs/hvsupport.html: Updated hvsupport
	  documentation.
2007-08-21 10:08:12 +00:00
Richard W.M. Jones
81005437f4 Tue Aug 21 10:21:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/libvirt.c (virDomainMigrate): Added virDomainMigrate
	  API call.
	* src/xend_internal.c, src/xen_unified.c: Support for migration
	  of Xen domains.
	* src/xen_internal.c: Xen capabilities indicates level of
	  support for migration.
	* qemud/remote.c, qemud/remote_protocol.x, src/remote_internal.c:
	  Support for migration between remote hypervisors.
	* src/virsh.c: Added 'virsh migrate' command.
	* docs/libvir.html, docs/hvsupport.html: Updated hvsupport
	  documentation.
2007-08-21 09:31:12 +00:00
Daniel Veillard
0ee4415cc6 * src/virsh.c: vshCommandOptInt was broken as it would not
detect non-int inputs, problem raised by Masayuki Sunou
Daniel
2007-08-16 13:21:36 +00:00
Daniel Veillard
d7b5e2c2d8 * src/virsh.c: fixed 2 small bugs in setvcpus command, after
Atsushi SAKAI pointed out a value checking problem
Daniel
2007-08-15 10:18:33 +00:00
Daniel Veillard
f39e1b8860 * src/virsh.c: patch from Atsushi SAKAI fixing schedinfo synopsys
Daniel
2007-08-14 07:07:57 +00:00
Richard W.M. Jones
9d5e267e9a Tue Aug 7 16:24:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/virsh.c: Include <time.h> (bug reported by Jan Michael).
2007-08-07 15:26:51 +00:00
Daniel Veillard
1d7164058c * src/virsh.c docs/virsh.pod virsh.1: added a ttyconsole command,
this should fix bug #239687
Daniel
2007-07-26 08:41:16 +00:00
Daniel Veillard
ea6279cb91 * src/virsh.c: fix an error in the default help string, bug #247197
Daniel
2007-07-06 15:05:19 +00:00
Richard W.M. Jones
9cd405497f Wed Jul 4 10:14:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/conf.c, src/test.c, src/xen_internal.c: Readd checking
          of errors from virBuffer functions.
        * src/sexpr.c: Add comment about use of _GNU_SOURCE.
        * src/virsh.c: Remove use of _GNU_SOURCE / isblank.
        * src/xml.c, tests/Makefile.am: Minor cleanup.
2007-07-04 09:16:23 +00:00
Daniel Veillard
6bdad268f4 * src/virsh.c: applied patch from Masayuki Sunou to remove leaks
of domains references in some commands.
Daniel
2007-06-29 13:45:50 +00:00
Richard W.M. Jones
2be812bbc9 Tue Jun 26 12:40:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* include/libvirt/libvirt.h.in, src/libvirt.c: (and numerous
	  other files) Added support for virConnectGetHostname
	  and virConnectGetURI calls.
2007-06-26 11:42:46 +00:00
Richard W.M. Jones
17e1ee3cc7 Wed Jun 20 18:21:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/virsh.c: 'virsh help command' now works even if we could
	  not get a connection to the hypervisor.  Rearranged the list
	  of commands to be in alphabetical order.
2007-06-20 17:22:09 +00:00
Richard W.M. Jones
3b7046a743 Tue Jun 19 10:30:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/virsh.c: vcpupin command now documented properly and
          gives clearer error messages if the cpulist is wrong
          (Masayuki Sunou).
2007-06-19 09:32:04 +00:00
Daniel Veillard
a03844f8ca * src/xend_internal.c: drop the release information as this
is usually garbage ending up polluting minor and major numbers.
* src/virsh.c: applied patch from Masayuki Sunou providing a pair
  of alternate attach/detach commands
Daniel
2007-06-19 09:12:55 +00:00
Daniel Veillard
af933f6ff0 * src/virsh.c: applied SetMem cleanup patch from Mark Johnson
Daniel
2007-06-18 08:33:08 +00:00
Richard W.M. Jones
6668e64766 Fri Jun 15 16:21:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* configure.in: Solaris header file fixes (Mark Johnson).
2007-06-15 15:24:20 +00:00
Richard W.M. Jones
a770b4c357 Fri Jun 15 14:42:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/test.c, src/virsh.c, src/xend_internal.c, src/xm_internal.c:
	  Replace calls to deprecated {,r}index with str{,r}chr.
2007-06-15 13:44:19 +00:00
Richard W.M. Jones
b69fcc15b4 Fri Jun 15 08:53:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/internal.h, src/virsh.c: Replace _N with N_ so that
          Solaris builds work (Mark Johnson).
        * src/virsh.c: Add a couple of missing error messages (Mark
          Johnson).
        * python/types.c: Fix NULL pointer deref on DEBUG build
          (Mark Johnson).
        * src/virsh.c: Spelling fix (Mark Johnson).
2007-06-15 08:18:55 +00:00
Daniel Veillard
fce0ce6f85 tiny fix on last patch, Daniel 2007-06-13 13:13:59 +00:00
Daniel Veillard
7c85b83736 * src/virsh.c: patch from Saori Fukuta for messages
* *.po: updated with the patch from Saori Fukuta and merge from
  the i18n CVS base.
Daniel
2007-06-13 09:32:44 +00:00
Daniel Veillard
7eed474dd3 * src/virsh.c: added a logging option to a file based on
Nobuhiro Itou patch
* src/xen_internal.c: small TODO comment from Atsushi SAKAI
Daniel
2007-06-06 12:24:31 +00:00
Daniel Veillard
652f3bb13b * include/libvirt/libvirt.h include/libvirt/libvirt.h.in
src/driver.h src/libvirt.c src/libvirt_sym.version
  src/proxy_internal.c src/qemu_internal.c src/test.c
  src/virsh.c src/xen_internal.c src/xen_internal.h src/xen_unified.c
  src/xend_internal.c src/xm_internal.c src/xs_internal.c:
  Applied patches from Atsushi SAKAI to add the scheduler API,
  with patch from Rich Jones for error handing, and a number
  of cleanups and more error checking from me
Daniel
2007-06-05 12:06:08 +00:00
Daniel Veillard
7b88f59ce4 * src/virsh.c src/xen_internal.c src/xend_internal.c: memory leaks
fixed by a patch from Masayuki Sunou
Daniel
2007-05-29 13:55:19 +00:00
Richard W.M. Jones
bb5fcd02bc Wed May 23 16:07:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/virsh.c: Add attach-device and detach-device commands to
	virsh, and tidy up the way it reads whole files.  Patch from
	Masayuki Sunou, Mark McLoughlin, Richard Jones.
2007-05-23 15:09:19 +00:00
Daniel Veillard
3ac6e102da * src/virsh.c: fix help for dumpxml and net-dumpxml commands
based on Chris Wright feedback
Daniel
2007-05-03 16:03:02 +00:00
Daniel Veillard
b782d66763 * src/virsh.c: fix virshStrdup to not crash if NULL is passed.
Daniel
2007-04-26 10:20:57 +00:00
Daniel Veillard
c73708ea46 * src/virsh.c: fixed a bad messaging mechanism preventing localization
and raised by Thomas Canniot
Daniel
2007-04-13 08:04:08 +00:00