- 10 11月, 2011 6 次提交
-
-
由 Daniel P. Berrange 提交于
* src/util/bridge.c, src/util/bridge.h: Add virNetDevGetMAC
-
由 Daniel P. Berrange 提交于
The MTU management APIs are useful to other code inside libvirt, so should be exposed as non-static APIs. * src/util/bridge.c, src/util/bridge.h: Expose virNetDevSetMTU, virNetDevSetMTUFromDevice & virNetDevGetMTU
-
由 Daniel P. Berrange 提交于
* src/util/bridge.c, src/util/bridge.h: s/int/bool/ in virNetDevSetOnline and virNetDevBridgeSetSTP
-
由 Daniel P. Berrange 提交于
The existing brXXX APIs in src/util/bridge.h are renamed to follow one of three different conventions - virNetDevXXX - operations for any type of interface - virNetDevBridgeXXX - operations for bridge interfaces - virNetDevTapXXX - operations for tap interfaces * src/util/bridge.h, src/util/bridge.c: Rename all APIs * src/lxc/lxc_driver.c, src/network/bridge_driver.c, src/qemu/qemu_command.c, src/uml/uml_conf.c, src/uml/uml_driver.c: Update for API renaming
-
由 Daniel P. Berrange 提交于
Currently every caller of the brXXX APIs has to store the returned errno value and then raise an error message. This results in inconsistent error messages across drivers, additional burden on the callers and makes the error reporting inaccurate since it is hard to distinguish different scenarios from 1 errno value. * src/util/bridge.c: Raise errors instead of returning errnos * src/lxc/lxc_driver.c, src/network/bridge_driver.c, src/qemu/qemu_command.c, src/uml/uml_conf.c, src/uml/uml_driver.c: Remove error reporting code
-
由 Daniel P. Berrange 提交于
The bridge management APIs in src/util/bridge.c require a brControl object to be passed around. This holds the file descriptor for the control socket. This extra object complicates use of the API for only a minor efficiency gain, which is in turn entirely offset by the need to fork/exec the brctl command for STP configuration. This patch removes the 'brControl' object entirely, instead opening the control socket & closing it again within the scope of each method. The parameter names for the APIs are also made to consistently use 'brname' for bridge device name, and 'ifname' for an interface device name. Finally annotations are added for non-NULL parameters and return check validation * src/util/bridge.c, src/util/bridge.h: Remove brControl object and update API parameter names & annotations. * src/lxc/lxc_driver.c, src/network/bridge_driver.c, src/uml/uml_conf.h, src/uml/uml_conf.c, src/uml/uml_driver.c, src/qemu/qemu_command.c, src/qemu/qemu_conf.h, src/qemu/qemu_driver.c: Remove reference to 'brControl' object
-
- 08 11月, 2011 1 次提交
-
-
由 Eric Blake 提交于
MacOS lacks ptsname_r, and gnulib doesn't (yet) provide it. But we can avoid it altogether, by using gnulib openpty() instead. Note that we do _not_ want the pt_chown module; gnulib uses it only to implement a replacement openpty() if the system lacks both openpty() and granpt(), but all systems that we currently port to either have at least one of openpty() and/or grantpt(), or lack ptys altogether. That is, we aren't porting to any system that requires us to deal with the hassle of installing a setuid pt_chown helper just to use gnulib's ability to provide openpty() on obscure platforms. * .gnulib: Update to latest, for openpty fixes * bootstrap.conf (gnulib_modules): Add openpty, ttyname_r. (gnulib_tool_option_extras): Exclude pt_chown module. * src/util/util.c (virFileOpenTty): Rewrite in terms of openpty and ttyname_r. * src/util/util.h (virFileOpenTtyAt): Delete dead prototype.
-
- 05 11月, 2011 1 次提交
-
-
由 Eric Blake 提交于
Building on 64-bit FreeBSD 8.2 complained about a cast between a pointer and a smaller integer. Going through an intermediate cast shuts up the compiler. * src/util/threads-pthread.c (virThreadSelfID): Silence a warning.
-
- 02 11月, 2011 2 次提交
-
-
由 Daniel P. Berrange 提交于
The field 'mon' in 'struct tm' gives months 0-11, where as humans tend to expect months 1-12. Thus the month number needing adjusting by 1 * src/util/logging.c: Use human friendly month number
-
由 Wen Congyang 提交于
commit 27908453 introduces a regression, and it will cause libvirt crashed when starting network. The reason is that tapfd may be NULL, but we dereference it without checking whether it is NULL.
-
- 30 10月, 2011 1 次提交
-
-
由 Osier Yang 提交于
To support "managed" mode of host PCI device, we record the original states (unbind_from_stub, remove_slot, and reprobe) so that could reattach the device to host with original driver. But there is no XML for theses attrs, and thus after daemon is restarted, we lose the original states. It's easy to reproduce: 1) virsh start domain 2) virsh attach-device dom hostpci.xml (in 'managed' mode) 3) service libvirtd restart 4) virsh destroy domain You will see the device won't be bound to the original driver if there was one. This patch is to solve the problem by introducing internal XML (won't be dumped to user, only dumped to status XML). The XML is: <origstates> <unbind/> <remove_slot/> <reprobe/> </origstates> Which will be child node of <hostdev><source>...</souce></hostdev>. (only for PCI device). A new struct "virDomainHostdevOrigStates" is introduced for the XML, and the according members are updated when preparing the PCI device. And function "qemuUpdateActivePciHostdevs" is modified to honor the original states. Use of qemuGetPciHostDeviceList is removed in function "qemuUpdateActivePciHostdevs", and the "managed" value of the device config is honored by the change. This fixes another problem alongside: qemuGetPciHostDeviceList set the device as "managed" force regardless of whether the device is configured as "managed='yes'" or not in XML, which is not right.
-
- 29 10月, 2011 1 次提交
-
-
由 Roopa Prabhu 提交于
- changed some return 1's to return -1 - changed if (rc) error checks to if (rc < 0) - fixed some other minor convention violations I might have missed some. Can fix in another patch or can respin Signed-off-by: NRoopa Prabhu <roprabhu@cisco.com> Reported-by: NEric Blake <eblake@redhat.com> Reported-by: NLaine Stump <laine@laine.org> Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 28 10月, 2011 4 次提交
-
-
由 Ryota Ozaki 提交于
It forgets to move a pointer to a buffer for UUID and as a result fills only the first byte of the buffer.
-
由 Tyler Coumbes 提交于
This refactors the TAP creation code out of brAddTap into a new function brCreateTap to allow it to be used on its own. I have also changed ifSetInterfaceMac to brSetInterfaceMac and exported it since it is will be needed by code outside of util/bridge.c in the next patch. AUTHORS | 1 + src/libvirt_bridge.syms | 2 + src/util/bridge.c | 116 +++++++++++++++++++++++++++++++---------------- src/util/bridge.h | 9 ++++ 4 files changed, 89 insertions(+), 39 deletions(-)
-
由 Jiri Denemark 提交于
Every time we write XML into a file we call virEmitXMLWarning to write a warning that the file is automatically generated. virXMLSaveFile simplifies this into a single step and makes rewriting existing XML file safe by using virFileRewrite internally.
-
由 Jiri Denemark 提交于
When saving config files we just overwrite old content of the file. In case something fails during that process (e.g. disk gets full) we lose both old and new content. This patch makes the process more robust by writing the new content into a separate file and only if that succeeds the original file is atomically replaced with the new one.
-
- 27 10月, 2011 1 次提交
-
-
由 Daniel P. Berrange 提交于
* src/util/util.c: s/git_t/gid_t/ in parameter list of virFileAccessibleAs
-
- 25 10月, 2011 1 次提交
-
-
由 Michal Privoznik 提交于
This function checks if a given path is accessible under given uid and gid.
-
- 21 10月, 2011 5 次提交
-
-
由 Eric Blake 提交于
More simplifications possible due to auto-indent. Also, <bandwidth> within <actual> was only using 6 instead of 8 spaces. * src/util/network.h (virVirtualPortProfileFormat) (virBandwidthDefFormat): Alter signature. * src/util/network.c (virVirtualPortProfileFormat) (virBandwidthDefFormat): Alter indentation. (virBandwidthChildDefFormat): Tweak to make use easier. * src/conf/network_conf.c (virPortGroupDefFormat) (virNetworkDefFormat): Adjust callers. * src/conf/domain_conf.c (virDomainNetDefFormat): Likewise. (virDomainActualNetDefFormat): Likewise, and fix bandwidth indentation.
-
由 Eric Blake 提交于
The improvements to virBuffer, along with a paradigm shift to pass the original buffer through rather than creating a second buffer, allow us to shave off quite a few lines of code. * src/util/sysinfo.h (virSysinfoFormat): Alter signature. * src/util/sysinfo.c (virSysinfoFormat, virSysinfoBIOSFormat) (virSysinfoSystemFormat, virSysinfoProcessorFormat) (virSysinfoMemoryFormat): Change indentation parameter. * src/conf/domain_conf.c (virDomainSysinfoDefFormat): Adjust caller. * src/qemu/qemu_driver.c (qemuGetSysinfo): Likewise.
-
由 Eric Blake 提交于
Rather than having to adjust all callers in a chain to deal with indentation, it is nicer to have virBuffer do auto-indentation. * src/util/buf.h (_virBuffer): Increase size. (virBufferAdjustIndent, virBufferGetIndent): New prototypes. * src/libvirt_private.syms (buf.h): Export new functions. * src/util/buf.c (virBufferAdjustIndent, virBufferGetIndent): New functions. (virBufferSetError, virBufferAdd, virBufferAddChar) (virBufferVasprintf, virBufferStrcat, virBufferURIEncodeString): Implement auto-indentation. * tests/virbuftest.c (testBufAutoIndent): Test it. (testBufInfiniteLoop): Don't rely on internals. Idea by Daniel P. Berrange.
-
由 Eric Blake 提交于
The next patch wants to add some sanity checking, which would be a different error than ENOMEM. Many existing callers blindly report OOM failure if virBuf reports an error, and this will be wrong in the (unlikely) case that they actually had a usage error instead; but since the most common error really is ENOMEM, I'm not going to fix all callers. Meanwhile, new discriminating callers can react differently depending on what failure happened. * src/util/buf.c (virBufferSetError): Add parameter. (virBufferGrow, virBufferVasprintf, virBufferEscapeString) (virBufferEscapeSexpr, virBufferEscapeShell): Adjust callers.
-
由 Eric Blake 提交于
Although the compiler wasn't complaining (since it was the pointer, rather than what was being pointed to, that was actually const), it looks quite suspicious to call a function with an argument labeled const when the nature of the pointer (virBufferPtr) is hidden behind a typedef. Dropping const makes the function declarations easier to read. * src/util/buf.h: Drop const from all functions that modify buffer argument. * src/util/buf.c (virBufferSetError, virBufferAdd) (virBufferContentAndReset, virBufferFreeAndReset) (virBufferAsprintf, virBufferVasprintf, virBufferEscapeString) (virBufferEscapeSexpr, virBufferEscape): Fix fallout.
-
- 20 10月, 2011 2 次提交
-
-
由 Daniel P. Berrange 提交于
Stub out a complete impl of virFileOpenTty to avoid unused parameter warnings * src/util/util.c: Fix virFileOpenTty on Win32
-
由 Serge E. Hallyn 提交于
The glibc ones (intentionally) cannot handle ptys opened in a devpts not mounted at /dev/pts. Drop the (un-exported, unused) virFileOpenTtyAt. Signed-off-by: NSerge Hallyn <serge.hallyn@canonical.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 19 10月, 2011 3 次提交
-
-
由 Daniel P. Berrange 提交于
The statement virBufferAdd(buf, "''", 2); triggers a syntax-check warning * src/util/buf.c: Replace virBufferAdd with virBufferAddLit
-
由 Daniel P. Berrange 提交于
This adds support for a libvirt client configuration file either /etc/libvirt/libvirt.conf for privileged clients, or $HOME/.libvirt/libvirt.conf for unprivileged clients. It allows one parameter uri_aliases = [ "hail=qemu+ssh://root@hail.cloud.example.com/system", "sleet=qemu+ssh://root@sleet.cloud.example.com/system", ] Any call to virConnectOpen with a non-NULL URI will first attempt to match against the uri_aliases list. An application can disable this by using VIR_CONNECT_NO_ALIASES * docs/uri.html.in: Document URI aliases * include/libvirt/libvirt.h.in: Add VIR_CONNECT_NO_ALIASES * libvirt.spec.in, mingw32-libvirt.spec.in: Add /etc/libvirt/libvirt.conf * src/Makefile.am: Install default config file * src/libvirt.c: Add support for URI aliases * src/remote/remote_driver.c: Don't try to handle URIs with no scheme and which clearly are not paths * src/util/conf.c: Don't raise error on virConfFree(NULL) * src/xen/xen_driver.c: Don't raise error on URIs with no scheme
-
由 Guido Günther 提交于
Make the empty string return '' to match cmdEcho's behavior.
-
- 18 10月, 2011 1 次提交
-
-
由 Guido Günther 提交于
When checking if we need to escape a single quote we were looking at the character after the quote instead of at the quote itself.
-
- 15 10月, 2011 3 次提交
-
-
由 Roopa Prabhu 提交于
Check strdup return value and fail if error Signed-off-by: NRoopa Prabhu <roprabhu@cisco.com>
-
由 Roopa Prabhu 提交于
Commit 0472f39f plugged a leak, but introduced another bug: Actually looks like physfndev is conditionally allocated in getPhysfnDev Its better to modify getPhysfnDev to allocate physfndev every time.
-
由 Osier Yang 提交于
When failing on starting a domain, it tries to reattach all the PCI devices defined in the domain conf, regardless of whether the devices are still used by other domain. This will cause the devices to be deleted from the list qemu_driver->activePciHostdevs, thus the devices will be thought as usable even if it's not true. And following commands nodedev-{reattach,reset} will be successful. How to reproduce: 1) Define two domains with same PCI device defined in the confs. 2) # virsh start domain1 3) # virsh start domain2 4) # virsh nodedev-reattach $pci_device You will see the device will be reattached to host successfully. As pciDeviceReattach just check if the device is still used by other domain via checking if the device is in list driver->activePciHostdevs, however, the device is deleted from the list by step 2). This patch is to prohibit the bug by: 1) Prohibit a domain starting or device attachment right at preparation period (qemuPrepareHostdevPCIDevices) if the device is in list driver->activePciHostdevs, which means it's used by other domain. 2) Introduces a new field for struct _pciDevice, (const char *used_by), it will be set as the domain name at preparation period, (qemuPrepareHostdevPCIDevices). Thus we can prohibit deleting the device from driver->activePciHostdevs if it's still used by other domain when stopping the domain process. * src/pci.h (define two internal functions, pciDeviceSetUsedBy and pciDevceGetUsedBy) * src/pci.c (new field "const char *used_by" for struct _pciDevice, implementations for the two new functions) * src/libvirt_private.syms (Add the two new internal functions) * src/qemu_hostdev.h (Modify the definition of functions qemuPrepareHostdevPCIDevices, and qemuDomainReAttachHostdevDevices) * src/qemu_hostdev.c (Prohibit preparation and don't delete the device from activePciHostdevs list if it's still used by other domain) * src/qemu_hotplug.c (Update function usage, as the definitions are changed) Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 14 10月, 2011 6 次提交
-
-
由 Jiri Denemark 提交于
-
由 Eric Blake 提交于
Detected by Coverity. Leak present since commit ca3b22bb. * src/util/macvtap.c (doPortProfileOp8021Qbh): Release device name.
-
由 Guido Günther 提交于
Escape strings so they're safe to pass to the shell. It's based on virsh's cmdEcho.
-
由 Jiri Denemark 提交于
Setting a hostname that cannot be resolved is not the best configuration but since virGetHostname only calls getaddrinfo to get host's canonical name and we do not fail if the returned canonical name is NULL or "localhost", there is no reason why we should fail if getaddrinfo itself fails.
-
由 Eric Blake 提交于
Coverity complained that most, but not all, clients of virUUIDParse were checking for errors. Silence those coverity warnings by explicitly marking the cases where we trust the input, and fixing one instance that really should have been checking. In particular, this silences a rather large percentage of the warnings I saw on my most recent Coverity analysis run. * src/util/uuid.h (virUUIDParse): Enforce rules. * src/util/uuid.c (virUUIDParse): Drop impossible check; at least Coverity will detect if we break rules and pass NULL. * src/xenapi/xenapi_driver.c (xenapiDomainCreateXML) (xenapiDomainLookupByID, xenapiDomainLookupByName) (xenapiDomainDefineXML): Ignore return when we trust data source. * src/vbox/vbox_tmpl.c (nsIDtoChar, vboxIIDToUUID_v3_x) (vboxCallbackOnMachineStateChange) (vboxCallbackOnMachineRegistered, vboxStoragePoolLookupByName): Likewise. * src/node_device/node_device_hal.c (gather_system_cap): Likewise. * src/xenxs/xen_sxpr.c (xenParseSxpr): Check for errors.
-
由 Eric Blake 提交于
virCommandTransferFD promises that the fd is no longer owned by the caller. Normally, we want the fd to remain open until the child runs, but in error situations, we must close it earlier. * src/util/command.c (virCommandTransferFD): Close fd now if we can't track it to close later. (virCommandKeepFD): Adjust helper to make this easier.
-
- 13 10月, 2011 1 次提交
-
-
由 Sage Weil 提交于
Implement a generic helper to escape a given set of characters with a leading '\'. Generalizes virBufferEscapeSexpr(). Signed-off-by: NSage Weil <sage@newdream.net>
-
- 11 10月, 2011 1 次提交
-
-
由 Daniel P. Berrange 提交于
The libvirtd daemon had a few crude system tap probes. Some of these were broken during the RPC rewrite. The new modular RPC code is structured in a way that allows much more effective tracing. Instead of trying to hook up the original probes, define a new set of probes for the RPC and event code. The master probes file is now src/probes.d. This contains probes for virNetServerClientPtr, virNetClientPtr, virSocketPtr virNetTLSContextPtr and virNetTLSSessionPtr modules. Also add probes for the poll event loop. The src/dtrace2systemtap.pl script can convert the probes.d file into a libvirt_probes.stp file to make use from systemtap much simpler. The src/rpc/gensystemtap.pl script can generate a set of systemtap functions for translating RPC enum values into printable strings. This works for all RPC header enums (program, type, status, procedure) and also the authentication enum The PROBE macro will automatically generate a VIR_DEBUG statement, so any place with a PROBE can remove any existing manual DEBUG statements. * daemon/libvirtd.stp, daemon/probes.d: Remove obsolete probing * daemon/libvirtd.h: Remove probe macros * daemon/Makefile.am: Remove all probe buildings/install * daemon/remote.c: Update authentication probes * src/dtrace2systemtap.pl, src/rpc/gensystemtap.pl: Scripts to generate STP files * src/internal.h: Add probe macros * src/probes.d: Master list of probes * src/rpc/virnetclient.c, src/rpc/virnetserverclient.c, src/rpc/virnetsocket.c, src/rpc/virnettlscontext.c, src/util/event_poll.c: Insert probe points, removing any DEBUG statements that duplicate the info
-