]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
13 years agobuild: Fix protocol-structs check in VPATH build
Jiri Denemark [Mon, 18 Jul 2011 08:25:02 +0000 (10:25 +0200)]
build: Fix protocol-structs check in VPATH build

$@ already included $(srcdir)

13 years agoFix now dead cleanup of VMs on libvirtd restart
Daniel P. Berrange [Fri, 15 Jul 2011 14:33:15 +0000 (15:33 +0100)]
Fix now dead cleanup of VMs on libvirtd restart

When libvirtd restarts it will attempt to reconnect to existing
LXC containers. If it loads a XML state file for the container
the container will appear running. If we fail to read the PID
file, or fail to connect to the LXC monitor, we should be killing
off the guest, but if the VMs cgroup does not exist any more,
cleanup will get skipped. Reading the PID file is also pointless
since the PID is in the XML statefile

In lxcReconnectVM we do not need to read the PID file. If part
of the reconnect process fails we need to run the VM terminate
code as a safety net.

In lxcVMTerminate, if we can't obtain the VM cgroup, we know
the process has died, but we must still run lxcVMCleanup to
clear out the virDomainObjPtr live state

* src/lxc/lxc_driver.c: Fix cleanup of dead VMs on restart

13 years agodocs: Fix spice documentation typo
Michal Privoznik [Mon, 18 Jul 2011 09:28:54 +0000 (11:28 +0200)]
docs: Fix spice documentation typo

We missed ending tag for paragraph element

13 years agorpc: Fix typos in rpc generator scripts
Osier Yang [Sun, 17 Jul 2011 04:41:39 +0000 (12:41 +0800)]
rpc: Fix typos in rpc generator scripts

These typos are introduced by file renaming in commit b17b4afaf.

src/remote/qemu_protocol.x \
src/remote/remote_protocol.x \
src/rpc/gendispatch.pl:
    s/remote_generator/gendispatch/

src/rpc/genprotocol.pl:
    s/remote\/remote_protocol/remote_protocol/

13 years agoqemu: Fix a regression of attaching device
Osier Yang [Sat, 16 Jul 2011 03:24:49 +0000 (11:24 +0800)]
qemu: Fix a regression of attaching device

The regression is introduced by Commit da1eba6b, the new
codes with this commit doesn't reset "ret" to "-1" when
it fails on parsing the device XML (live device attachment)

This patch changes the codes to reset the "ret" and "-1",
and also changes the codes so that it don't modify "ret"
for condition checking.

How to reproduce:

% cat test.xml
<disk type='oops' device='disk'>
  <driver name='qemu' type='raw'/>
  <source file='/var/lib/libvirt/images/test.img'/>
  <target dev='vda' bus='virtio'/>
</disk>

% virsh attach-device $domain test.xml
Device attached successfully

The device attachment failed actually with error "unknown disk type 'oops'",
however, it reports success.

13 years agobuild: also track RPC on-wire enum values
Eric Blake [Thu, 14 Jul 2011 16:18:40 +0000 (10:18 -0600)]
build: also track RPC on-wire enum values

As long as we guarantee RPC struct layout stability, we might as
well also guarantee RPC enum value constancy.

* src/Makefile.am (r1, r2, PDWTAGS): Adjust rule to pick up named
and anonymous enums.
* src/remote_protocol-structs: Add enum values.
* src/qemu_protocol-structs: Likewise.
* src/virnetprotocol-structs: Likewise.

13 years agodocs: document dxml argument to migrate2
Eric Blake [Thu, 14 Jul 2011 17:09:03 +0000 (11:09 -0600)]
docs: document dxml argument to migrate2

Commit 135554166 introduced a nice feature without documenting it.

* src/libvirt.c (virDomainMigrate2): Add paragraph.

13 years agobuild: add syntax check for proper flags use
Eric Blake [Thu, 7 Jul 2011 17:57:43 +0000 (11:57 -0600)]
build: add syntax check for proper flags use

Enforce the recent flags cleanups - we want to use 'unsigned int flags'
in any of our APIs (except where backwards compatibility is important,
in the public migration APIs), and that all flags are checked for
validity (except when there are stub functions that completely
ignore the flags argument).

There are a few minor tweaks done here to avoid false positives:
signed arguments passed to open() are renamed oflags, and flags
arguments that are legitimately ignored are renamed flags_unused.

* cfg.mk (sc_flags_usage): New rule.
(exclude_file_name_regexp--sc_flags_usage): And a few exemptions.
(sc_flags_debug): Tweak wording.
* src/util/iohelper.c (runIO, main): Rename variable.
* src/util/util.c (virSetInherit): Likewise.
* src/fdstream.h (virFDStreamOpenFile, virFDStreamCreateFile):
Likewise.
* src/fdstream.c (virFDStreamOpenFileInternal)
(virFDStreamOpenFile, virFDStreamCreateFile): Likewise.
* src/util/command.c (virExecWithHook) [WIN32]: Likewise.
* src/util/util.c (virFileOpenAs, virDirCreate) [WIN32]: Likewise.
* src/locking/lock_manager.c (virLockManagerPluginNew)
[!HAVE_DLFCN_H]: Likewise.
* src/locking/lock_driver_nop.c (virLockManagerNopNew)
(virLockManagerNopAddResource, virLockManagerNopAcquire)
(virLockManagerNopRelease, virLockManagerNopInquire): Likewise.

13 years agoxen: reject unknown flags
Eric Blake [Wed, 6 Jul 2011 23:15:33 +0000 (17:15 -0600)]
xen: reject unknown flags

Also fix a logic bug in xenXMDomain{Attach,Detach}DeviceFlags,
where (flags & VIR_DOMAIN_DEVICE_MODIFY_CURRENT) is always false.

* src/xen/xen_driver.c (xenUnifiedDomainXMLFromNative)
(xenUnifiedDomainXMLToNative, xenUnifiedDomainBlockPeek): Reject
unknown flags.
* src/xen/xen_hypervisor.c (xenHypervisorOpen)
(xenHypervisorGetDomainState): Likewise.
* src/xen/xen_inotify.c (xenInotifyOpen): Likewise.
* src/xen/xs_internal.c (xenStoreOpen, xenStoreDomainGetState)
(xenStoreDomainReboot): Likewise.
* src/xen/xend_internal.c (xenDaemonOpen, xenDaemonDomainReboot)
(xenDaemonDomainCoreDump, xenDaemonDomainGetState)
(xenDaemonDomainMigratePrepare, xenDaemonDomainSetVcpusFlags,
xenDaemonDomainGetVcpusFlags, xenDaemonAttachDeviceFlags,
xenDaemonDetachDeviceFlags): Likewise.
(xenDaemonDomainGetXMLDesc): Prefer unsigned flags.
* src/xen/xend_internal.h (xenDaemonDomainGetXMLDesc): Likewise.
* src/xen/xm_internal.h (xenXMDomainGetXMLDesc): Likewise.
* src/xen/xm_internal.c (xenXMDomainGetXMLDesc): Likewise.
(xenXMOpen, xenXMDomainGetState, xenXMDomainSetVcpusFlags)
(xenXMDomainGetVcpusFlags): Reject unknown flags.
(xenXMDomainAttachDeviceFlags, xenXMDomainDetachDeviceFlags):
Likewise, and avoid always-false conditional.
* src/xen/xen_driver.h (XEN_MIGRATION_FLAGS): New define.

13 years agoesx: reject unknown flags
Eric Blake [Wed, 6 Jul 2011 22:14:33 +0000 (16:14 -0600)]
esx: reject unknown flags

Silently ignored flags get in the way of new features that
use those flags.

Regarding ESX migration flags - right now, ESX silently enforces
VIR_MIGRATE_PERSIST_DEST, VIR_MIGRATE_UNDEFINE_SOURCE, and
VIR_MIGRATE_LIVE, even if those flags were not supplied; it ignored
other flags.  This patch does not change the implied bits (it permits
but does not require them), but enforces only the supported bits.
If further cleanup is needed to be more particular about migration
flags, that should be a separate patch.

* src/esx/esx_device_monitor.c (esxDeviceOpen): Reject unknown
flags.
* src/esx/esx_driver.c (esxOpen, esxDomainReboot)
(esxDomainXMLFromNative, esxDomainXMLToNative)
(esxDomainMigratePrepare, esxDomainMigratePerform)
(esxDomainMigrateFinish): Likewise.
* src/esx/esx_interface_driver.c (esxInterfaceOpen): Likewise.
* src/esx/esx_network_driver.c (esxNetworkOpen): Likewise.
* src/esx/esx_nwfilter_driver.c (esxNWFilterOpen): Likewise.
* src/esx/esx_secret_driver.c (esxSecretOpen): Likewise.
* src/esx/esx_storage_driver.c (esxStorageOpen): Likewise.

13 years agovirsh: improve option handling
Eric Blake [Fri, 15 Jul 2011 17:23:17 +0000 (11:23 -0600)]
virsh: improve option handling

The documentation for vshCommandOptString claims that it returns
-1 on a missing required argument, but in reality, that error
message was unreachable (it was buried inside an if clause that
is true only if the argument was present).  The code was so hairy
that I decided a rewrite would make it easier to understand,
and actually return the error values we want.

Meanwhile, our construction guarantees that all vshCmdOpt have
a non-null def member, so there are some redundant checks that
can be trimmed.

* tools/virsh.c (vshCommandOpt): Alter signature.
(vshCommandOptInt, vshCommandOptUInt, vshCommandOptUL)
(vshCommandOptString, vshCommandOptLongLong)
(vshCommandOptULongLong, vshCommandOptBool): Adjust all callers.
(vshCommandOptArgv): Remove dead condition.

13 years agoflags: fix domain_conf migration regression
Eric Blake [Fri, 15 Jul 2011 19:03:20 +0000 (13:03 -0600)]
flags: fix domain_conf migration regression

Commit 461e0f1a broke migration, because there was a code path
that tried to enable an internal flag while still going through
the public function.  Split the internal flag into a separate
callback, and validate that flags do not overlap.

* src/conf/domain_conf.c (virDomainDefFormat): Split...
(virDomainDefFormatInternal): ...to separate the flag check.
(virDomainObjFormat): Adjust caller.

13 years agowebsite: Point main page links to libvirt driver pages
Dave Allan [Fri, 15 Jul 2011 18:33:17 +0000 (14:33 -0400)]
website: Point main page links to libvirt driver pages

The "libvirt supports:" section on the main page of libvirt.org
contains a list of hypervisors with links that point to the sites of
the underlying virt technologies.  The entry for KVM points to
http://www.linux-kvm.org/, for example.  People coming to libvirt.org
for the first time are likely to know about those sites, and they're
probably interested in how libvirt manages those technologies.  This
patch points those links to the libvirt driver pages instead.  It also
consolidates KVM and QEMU as there is only one libvirt driver page for
them.  Finally, it adds a line about networking support.

v2: incorporate Eric's feedback adding project links to driver pages.

website: Add project links to KVM/QEMU driver page
website: Add project links to Xen driver page
website: Add project links to LXC driver page
website: Add project links to OpenVZ driver page
website: Add project links to UML driver page
website: Add project links to Virtualbox driver page
website: Add project links to ESX driver page
website: Add project links to VMware driver page

13 years agoflags: fix qemu migration regression
Eric Blake [Thu, 14 Jul 2011 21:46:49 +0000 (15:46 -0600)]
flags: fix qemu migration regression

Commit f548480b broke migration v3 on qemu, because the driver
passed flags on through to qemu_migration even though
qemu_migration wasn't using those flags.

* src/qemu/qemu_migration.h (QEMU_MIGRATION_FLAGS): New define.
* src/qemu/qemu_driver.c: Simplify all migration callbacks.
* src/qemu/qemu_migration.c (qemuMigrationConfirm): Fix regression.

13 years agoflags: use common dumpxml flags check
Eric Blake [Wed, 13 Jul 2011 22:24:38 +0000 (16:24 -0600)]
flags: use common dumpxml flags check

The previous patches only cleaned up ATTRIBUTE_UNUSED flags cases;
auditing the drivers found other places where flags was being used
but not validated.  In particular, domainGetXMLDesc had issues with
clients accepting a different set of flags than the common
virDomainDefFormat helper function.

* src/conf/domain_conf.c (virDomainDefFormat): Add common flag check.
* src/uml/uml_driver.c (umlDomainAttachDeviceFlags)
(umlDomainDetachDeviceFlags): Reject unknown
flags.
* src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc)
(vboxDomainAttachDeviceFlags)
(vboxDomainDetachDeviceFlags): Likewise.
* src/qemu/qemu_driver.c (qemudDomainMemoryPeek): Likewise.
(qemuDomainGetXMLDesc): Document common flag handling.
* src/libxl/libxl_driver.c (libxlDomainGetXMLDesc): Likewise.
* src/lxc/lxc_driver.c (lxcDomainGetXMLDesc): Likewise.
* src/openvz/openvz_driver.c (openvzDomainGetXMLDesc): Likewise.
* src/phyp/phyp_driver.c (phypDomainGetXMLDesc): Likewise.
* src/test/test_driver.c (testDomainGetXMLDesc): Likewise.
* src/vmware/vmware_driver.c (vmwareDomainGetXMLDesc): Likewise.
* src/xenapi/xenapi_driver.c (xenapiDomainGetXMLDesc): Likewise.

13 years agomaint: fix typos
Eric Blake [Fri, 15 Jul 2011 18:08:59 +0000 (12:08 -0600)]
maint: fix typos

Our XML prefers "shareable" over "sharable".

* docs/internals/locking.html.in: s/sharable/shareable/
* src/locking/lock_driver_sanlock.c
(virLockManagerSanlockAddResource): Likewise.

13 years agoadd --cache, --serial, --shareable and --address to attach-disk
Hu Tao [Fri, 15 Jul 2011 07:06:53 +0000 (15:06 +0800)]
add --cache, --serial, --shareable and --address to attach-disk

This adds four options for virsh command attach-disk.

--cache option allows user to specify cache mode of disk device
from virsh command line when attaching a disk device.

--serial option allows user to specify serial string of disk device
from virsh command line when attaching a disk device.

--shareable option allows user to specify whether the disk device is
shareable between domains when attaching a disk device from virsh
command line.

--address option allows user to specify address of disk device when
attaching a disk device.

13 years agoFix error message for missing TLS write function
Daniel P. Berrange [Fri, 15 Jul 2011 10:42:51 +0000 (11:42 +0100)]
Fix error message for missing TLS write function

* src/rpc/virnettlscontext.c: s/read/write/

13 years agoFix reporting of cert validation failures
Daniel P. Berrange [Fri, 15 Jul 2011 10:40:35 +0000 (11:40 +0100)]
Fix reporting of cert validation failures

If the server succesfully validates the client cert, it will send
back a single byte, under TLS. If it fails, it will close the
connection. In this case, we were just reporting the standard
I/O error. The original RPC code had a special case hack for the
GNUTLS_E_UNEXPECTED_PACKET_LENGTH error code to make us report
a more useful error message

* src/rpc/virnetclient.c: Return ENOMSG if we get
  GNUTLS_E_UNEXPECTED_PACKET_LENGTH
* src/rpc/virnettlscontext.c: Report cert failure if we
  see ENOMSG

13 years agoFix error code for storage operations
Dave Allan [Fri, 15 Jul 2011 13:47:12 +0000 (09:47 -0400)]
Fix error code for storage operations

Many volume operations will fail if the volume in question is being
allocated.  These operations were returning VIR_ERR_INTERNAL_ERROR
when they should be returning VIR_ERR_OPERATION_INVALID.

13 years agosetvcpus: add "--current" option to "virsh setvcpus"
Taku Izumi [Fri, 15 Jul 2011 07:02:00 +0000 (16:02 +0900)]
setvcpus: add "--current" option to "virsh setvcpus"

This patch adds the --current option to "virsh setvcpus"
command. Currently "virsh setvcpus" command supports
"--live" and "--config" , but "--current" option.
From view of consistency, it's reasonable to support
"--current" option too.

When --current is specified, it affects a "current"
domain.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
13 years agosetvcpus: extend qemuDomainSetVcpusFlags() to support current flag
Taku Izumi [Fri, 15 Jul 2011 07:01:19 +0000 (16:01 +0900)]
setvcpus: extend qemuDomainSetVcpusFlags() to support current flag

This patch extends qemudDomainSetVcpusFlags() function to support
VIR_DOMAIN_AFFECT_CURRENT flag.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
13 years agosetvcpus: extend virDomainSetVcpusFlags API to support current flag
Taku Izumi [Fri, 15 Jul 2011 07:00:37 +0000 (16:00 +0900)]
setvcpus: extend virDomainSetVcpusFlags API to support current flag

This patch extends virDomainSetVcpusFlags API to support
VIR_DOMAIN_AFFECT_CURRENT flag.

Now because most APIs accept VIR_DOMAIN_AFFECT_CURRENT flags,
virDomainSetVcpusFlags API should also do.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
13 years agoAdd domain events support to UML driver
Daniel P. Berrange [Mon, 6 Jul 2009 15:06:11 +0000 (16:06 +0100)]
Add domain events support to UML driver

* src/uml_conf.h: Add queue for dispatch of domain events
* src/uml_driver.c: Trigger domain events upon important lifecycle transitions

13 years agodocs: mention EMOTIVE as a libvirt-using app
Eric Blake [Thu, 14 Jul 2011 20:23:13 +0000 (14:23 -0600)]
docs: mention EMOTIVE as a libvirt-using app

* docs/apps.html.in: Add EMOTIVE.
Reported by Alex VaquĆ© Brull <memfis@gmail.com>.

Signed-off-by: Eric Blake <eblake@redhat.com>
13 years agovirnetsocket: use new API for uniform child cleanup
Eric Blake [Tue, 12 Jul 2011 18:09:43 +0000 (12:09 -0600)]
virnetsocket: use new API for uniform child cleanup

Rather than trying to clean up the ssh child ourselves, and risk
subtle differences from the socket creation error path, we can
just use the new APIs.

* src/rpc/virnetsocket.c (virNetSocketFree): Use new function.

13 years agofdstream: avoid child process leak on error
Eric Blake [Tue, 12 Jul 2011 18:07:01 +0000 (12:07 -0600)]
fdstream: avoid child process leak on error

By requesting the pid in virCommandRunAsync, fdstream was claiming
that it would manually wait for the process.  But on the failure
path, the child process was being leaked.

* src/fdstream.c (virFDStreamOpenFileInternal): Auto-reap child.

13 years agocommand: introduce virPidWait, virPidAbort
Eric Blake [Tue, 12 Jul 2011 16:42:41 +0000 (10:42 -0600)]
command: introduce virPidWait, virPidAbort

When using virCommandRunAsync and saving the pid for later, it
is useful to be able to reap that pid in the same way that it
would have been auto-reaped by virCommand if we had passed
NULL for the pid argument in the first place.

* src/util/command.c (virPidWait, virPidAbort): New functions,
created from...
(virCommandWait, virCommandAbort): ...bodies of these.
(includes): Drop duplicate <stdlib.h>.  Ensure that our pid_t
assumptions hold.
(virCommandRunAsync): Improve documentation.
* src/util/command.h (virPidWait, virPidAbort): New prototypes.
* src/libvirt_private.syms: Export them.
* docs/internals/command.html.in: Document them.

13 years agoupdate apparmor security driver for new udev paths
Jamie Strandboge [Thu, 14 Jul 2011 17:06:20 +0000 (12:06 -0500)]
update apparmor security driver for new udev paths

In the Ubuntu development release we recently got a new udev that
moves /var/run to /run, /var/lock to /run/lock and /dev/shm to /run/shm.
This change in udev requires updating the apparmor security driver in
libvirt[1].

Attached is a patch that:
 * adjusts src/security/virt-aa-helper.c to allow both
LOCALSTATEDIR/run/libvirt/**/%s.pid and /run/libvirt/**/%s.pid. While
the profile is not as precise, LOCALSTATEDIR/run/ is typically a symlink
to /run/ anyway, so there is no additional access (remember that
apparmor resolves symlinks, which is why this is still required even
if /var/run points to /run).
 * adjusts example/apparmor/libvirt-qemu paths for /dev/shm

[1]https://launchpad.net/bugs/810270

--
Jamie Strandboge             | http://www.canonical.com

13 years agoxenapi: Improve error reporting in xenapiOpen
Matthias Bolte [Thu, 14 Jul 2011 14:58:43 +0000 (16:58 +0200)]
xenapi: Improve error reporting in xenapiOpen

Use better suited error code and avoid NULL in error messsage
as *privP->session->error_description can be NULL.

13 years agobuild: fix VPATH build of todo
Eric Blake [Thu, 14 Jul 2011 15:41:38 +0000 (09:41 -0600)]
build: fix VPATH build of todo

Without this patch, the make rule in a VPATH build was trying to
invoke ../../docs/../../docs/todo.pl, which didn't exist.

* docs/Makefile.am (todo.html.in): Using $< already implies
$(srcdir) in GNU make VPATH situations.

13 years agobuild: check for virnetprotocol on-the-wire stability
Eric Blake [Wed, 13 Jul 2011 15:35:03 +0000 (09:35 -0600)]
build: check for virnetprotocol on-the-wire stability

Similar to the recent qemu_protocol-structs addition.

* src/virnetprotocol-structs: New file.
* src/Makefile.am (%_protocol-structs): Factor body...
(PDWTAGS): ...into new helper macro.
(virnetprotocol-structs): New rule.
(PROTOCOL_STRUCTS): Add virnetprotocol-structs.

13 years agobuild: disable some drivers when building without libvirt daemon
Wen Congyang [Thu, 14 Jul 2011 05:20:19 +0000 (13:20 +0800)]
build: disable some drivers when building without libvirt daemon

We disable some drivers when building without libvirtd in configure,
but we do not do the same thing in libvirt.spec. It may break rpm
building without libvirtd.

13 years agostorage: Avoid memory leak on metadata fetching
Michal Privoznik [Thu, 14 Jul 2011 10:53:45 +0000 (12:53 +0200)]
storage: Avoid memory leak on metadata fetching

Getting metadata on storage allocates a memory (path) which need to
be freed after use otherwise it gets leaked. This means after use of
virStorageFileGetMetadataFromFD or virStorageFileGetMetadata one
must call virStorageFileFreeMetadata to free it. This function frees
structure internals and structure itself.

13 years agoqemu: Don't overwrite errors by closefd in error paths
Jiri Denemark [Wed, 13 Jul 2011 09:16:20 +0000 (11:16 +0200)]
qemu: Don't overwrite errors by closefd in error paths

When qemuMonitorCloseFileHandle is called in error path, we need to
preserve the original error since a possible further error when running
closefd monitor command is not very useful to users.

13 years agoqemu: Save domain status ASAP after creating qemu process
Jiri Denemark [Tue, 12 Jul 2011 09:45:16 +0000 (11:45 +0200)]
qemu: Save domain status ASAP after creating qemu process

When creating new qemu process we saved domain status XML only after the
process was fully setup and running. In case libvirtd was killed before
the whole process finished, once libvirtd started again it didn't know
anything about the new process and we end up with an orphaned qemu
process. Let's save the domain status XML as soon as we know the PID so
that libvirtd can kill the process on restart.

13 years agobuild: avoid ATTRIBUTE_UNUSED in headers
Eric Blake [Fri, 8 Jul 2011 21:58:28 +0000 (15:58 -0600)]
build: avoid ATTRIBUTE_UNUSED in headers

The compiler might optimize based on our declaration that something
is unused.  Putting that declaration in the header risks getting
out of sync with the actual implementation, so it belongs better
only in the .c files.  We were mostly compliant, and a new syntax
check will help us in the future.

* cfg.mk (sc_avoid_attribute_unused_in_header): New syntax check.
* src/nodeinfo.h (nodeGetCPUStats, nodeGetMemoryStats): Delete
attribute already present in .c file.
* src/qemu/qemu_domain.h (qemuDomainEventFlush): Likewise.
* src/util/virterror_internal.h (virReportErrorHelper): Parameters
are actually used by .c file.
* src/xenxs/xen_sxpr.h (xenFormatSxprDisk): Adjust prototype.
* src/xenxs/xen_sxpr.c (xenFormatSxprDisk): Delete unused argument.
(xenFormatSxpr): Adjust caller.
* src/xen/xend_internal.c (xenDaemonAttachDeviceFlags)
(xenDaemonUpdateDeviceFlags): Likewise.
Suggested by Daniel Veillard.

13 years agoremote: prefer unsigned flags
Eric Blake [Fri, 8 Jul 2011 18:57:08 +0000 (12:57 -0600)]
remote: prefer unsigned flags

* src/remote/remote_driver.c (call, remoteOpenSecondaryDriver):
Prefer unsigned flags.

13 years agoconf: delete unused flags arguments
Eric Blake [Fri, 8 Jul 2011 14:30:25 +0000 (08:30 -0600)]
conf: delete unused flags arguments

For static functions not used as callbacks, there's no need to
keep an unused parameter.

* src/conf/domain_conf.c (virDomainChrDefParseTargetXML)
(virDomainTimerDefParseXML, virDomainHostdevSubsysUsbDefParseXML)
(virDomainVcpuPinDefParseXML): Drop unused parameter.
(virDomainChrDefParseXML, virDomainDefParseXML)
(virDomainHostdevDefParseXML): Update callers.
(virDomainNetDefParseXML): Mark flags used.

13 years agovirsh: Update virsh man page
Supriya Kannery [Thu, 30 Jun 2011 08:22:45 +0000 (13:52 +0530)]
virsh: Update virsh man page

Valid loglevel range for virsh  is 0-4. Update virsh man page
accordingly. Also explain virsh ENV variables and values.

Signed-off-by: Supriya Kannery <supriyak@in.ibm.com>
13 years agovirsh: fix previous patch
Jiri Denemark [Thu, 14 Jul 2011 11:58:02 +0000 (13:58 +0200)]
virsh: fix previous patch

The last patch breaks make check for two reasons. First, it reverses the
condition but leaves default level unchanged, so instead of not printing
anything but errors before the patch it now prints all debug messages by
default. Second, you forgot to change -d5 option passed to virsh in
tests/virsh-optparse to -d0; the script wants to see all debug messages.

13 years agovirsh: Make "DEBUG" loglevel the superset
Supriya Kannery [Thu, 30 Jun 2011 08:22:32 +0000 (13:52 +0530)]
virsh: Make "DEBUG" loglevel the superset

Aligning loglevel values of virsh to that of libvirt.
"DEBUG"=0 loglevel, when specified through commandline or
env variable, should log all the messages. "ERROR=4"
should log only error messages.

Signed-off-by: Supriya Kannery <supriyak@in.ibm.com>
13 years agovirsh: Avoid using magic numbers for logging
Supriya Kannery [Thu, 30 Jun 2011 08:22:20 +0000 (13:52 +0530)]
virsh: Avoid using magic numbers for logging

Replace magic numbers with loglevel variables.

Signed-off-by: Supriya Kannery <supriyak@in.ibm.com>
13 years agoutil: Avoid duplicating virFileOpenAsNoFork in virFileOpenAs
Jiri Denemark [Thu, 14 Jul 2011 03:04:16 +0000 (11:04 +0800)]
util: Avoid duplicating virFileOpenAsNoFork in virFileOpenAs

In 2f4d2496a88055a8343b3efca618522da8715d92 I didn't notice that one
part of virFileOpenAs doesn't actually call to virFileOpenAsNoFork but
rather includes a copy of the code from there.

13 years agobuild: don't hand-roll cloexec code
Eric Blake [Thu, 7 Jul 2011 23:42:05 +0000 (17:42 -0600)]
build: don't hand-roll cloexec code

No need to repeat common code.

* bootstrap.conf (gnulib_modules): Import calloc-posix.
* src/util/bridge.c (brInit): Use virSetCloseExec.
(brSetInterfaceUp): Adjust flags name.
* src/uml/uml_driver.c (umlSetCloseExec): Delete.
(umlStartVMDaemon): Use util version instead.

13 years agoconf: prefer unsigned flags
Eric Blake [Thu, 7 Jul 2011 23:29:42 +0000 (17:29 -0600)]
conf: prefer unsigned flags

* src/conf/cpu_conf.h (virCPUDefFormat, virCPUDefFormatBuf):
Change flags type.
* src/conf/cpu_conf.c (virCPUDefFormat, virCPUDefFormatBuf):
Likewise.
* src/conf/storage_conf.c (_virStoragePoolOptions): Likewise.
* src/datatypes.h (_virConnect, _virStream): Likewise.

13 years agopython: prefer unsigned flags
Eric Blake [Thu, 7 Jul 2011 18:13:45 +0000 (12:13 -0600)]
python: prefer unsigned flags

* python/libvirt-override.c (libvirt_virConnectOpenAuth)
(libvirt_virDomainSnapshotListNames)
(libvirt_virDomainRevertToSnapshot): Change flags type.

13 years agonode_device: avoid implicit int
Eric Blake [Thu, 7 Jul 2011 18:04:41 +0000 (12:04 -0600)]
node_device: avoid implicit int

'unsigned a' and 'unsigned int a' are synonyms, but we generally
always spell out the 'int' in that case.  Fixing this will avoid
a false positive in the next syntax-check commit.

* src/conf/node_device_conf.h (pci_config_address)
(_virNodeDevCapsDef): Prefer 'unsigned int' over 'unsigned'.

13 years agovirsh, daemon: prefer unsigned flags
Eric Blake [Thu, 7 Jul 2011 17:53:04 +0000 (11:53 -0600)]
virsh, daemon: prefer unsigned flags

* tools/virsh.c (vshCmdDef): Change flags type.
* daemon/remote.c (remoteDispatchOpen): Likewise.

13 years agoxenapi: reject unknown flags
Eric Blake [Wed, 6 Jul 2011 23:09:40 +0000 (17:09 -0600)]
xenapi: reject unknown flags

* src/xenapi/xenapi_driver.c (xenapiOpen, xenapiDomainReboot):
Reject unknown flags.
(xenapiDomainGetXMLDesc): Likewise, and pass known flags through
to XML generation.

13 years agovmware: reject unknown flags
Eric Blake [Wed, 6 Jul 2011 23:08:28 +0000 (17:08 -0600)]
vmware: reject unknown flags

* src/vmware/vmware_driver.c (vmwareOpen, vmwareDomainReboot)
(vmwareDomainCreateXML, vmwareDomainCreateWithFlags): Reject
unknown flags.

13 years agovbox: reject unknown flags
Eric Blake [Wed, 6 Jul 2011 23:06:11 +0000 (17:06 -0600)]
vbox: reject unknown flags

* src/vbox/vbox_driver.c (vboxOpenDummy): Reject unknown flags.
* src/vbox/vbox_tmpl.c (vboxOpen, vboxDomainReboot)
(vboxNetworkOpen, vboxNetworkGetXMLDesc, vboxStorageOpen)
(vboxStorageVolCreateXML, vboxStorageVolDelete)
(vboxStorageVolGetXMLDesc, vboxDomainScreenshot): Likewise.

13 years agouml: reject unknown flags
Eric Blake [Wed, 6 Jul 2011 23:02:14 +0000 (17:02 -0600)]
uml: reject unknown flags

* src/uml/uml_driver.c (umlOpen, umlDomainGetXMLDesc)
(umlDomainBlockPeek): Reject unknown flags.

13 years agotest: reject unknown flags
Eric Blake [Wed, 6 Jul 2011 23:00:08 +0000 (17:00 -0600)]
test: reject unknown flags

* src/test/test_driver.c (testOpen, testDomainCoreDump)
(testOpenNetwork, testNetworkGetXMLDesc, testOpenInterface)
(testInterfaceChangeBegin, testInterfaceChangeCommit)
(testInterfaceChangeRollback, testInterfaceGetXMLDesc)
(testInterfaceDefineXML, testInterfaceCreate)
(testInterfaceDestroy, testStorageOpen, testStoragePoolStart)
(testStorageFindPoolSources, testStoragePoolCreate)
(testStoragePoolDefine, testStoragePoolBuild)
(testStoragePoolDelete, testStoragePoolRefresh)
(testStoragePoolGetXMLDesc, testStorageVolumeCreateXML)
(testStorageVolumeCreateXMLFrom, testStorageVolumeDelete)
(testStorageVolumeGetXMLDesc, testDevMonOpen)
(testNodeNumOfDevices, testNodeListDevices)
(testNodeDeviceGetXMLDesc, testNodeDeviceCreateXML)
(testSecretOpen, testNWFilterOpen): Reject unknown flags.

13 years agoqemu: reject unknown flags
Eric Blake [Wed, 6 Jul 2011 22:42:06 +0000 (16:42 -0600)]
qemu: reject unknown flags

* src/qemu/qemu_driver.c (qemudOpen, qemuDomainScreenshot)
(qemuDomainXMLFromNative, qemuDomainXMLToNative)
(qemudDomainBlockPeek, qemuCPUCompare, qemuCPUBaseline): Reject
unknown flags.
* src/qemu/qemu_migration.c (qemuMigrationConfirm): Likewise.
(_qemuMigrationCookie, qemuMigrationCookieXMLParse)
(qemuMigrationCookieXMLParseStr, qemuMigrationBakeCookie)
(qemuMigrationEatCookie): Make flags unsigned.
* src/qemu/qemu_domain.h: (qemuDomainDefFormatXML)
(qemuDomainFormatXML): Prefer unsigned flags.
* src/qemu/qemu_domain.c (qemuDomainDefFormatXML)
(qemuDomainFormatXML): Likewise.
(qemuDomainOpenLogHelper, qemuDomainCreateLog): Rename variable.

13 years agophyp: reject unknown flags
Eric Blake [Wed, 6 Jul 2011 22:36:33 +0000 (16:36 -0600)]
phyp: reject unknown flags

* src/phyp/phyp_driver.c (phypOpen, phypDomainReboot)
(phypVIOSDriverOpen): Reject unknown flags.

13 years agoopenvz: reject unknown flags
Eric Blake [Wed, 6 Jul 2011 22:34:58 +0000 (16:34 -0600)]
openvz: reject unknown flags

* src/openvz/openvz_driver.c (openvzDomainReboot, openvzOpen):
Reject unknown flags.

13 years agolxc: reject unknown flags
Eric Blake [Wed, 6 Jul 2011 22:33:53 +0000 (16:33 -0600)]
lxc: reject unknown flags

* src/lxc/lxc_driver.c (lxcOpen, lxcDomainSetMemoryParameters)
(lxcDomainGetMemoryParameters): Reject unknown flags.
* src/lxc/lxc_container.c (lxcContainerStart): Rename flags to
cflags to reflect that it is not tied to libvirt.

13 years agolibxl: reject unknown flags
Eric Blake [Wed, 6 Jul 2011 22:17:10 +0000 (16:17 -0600)]
libxl: reject unknown flags

* src/libxl/libxl_driver.c (libxlOpen, libxlDomainReboot)
(libxlDomainXMLFromNative, libxlDomainXMLToNative)
(libxlDomainCreateWithFlags): Reject unknown flags.

13 years agovirsh: fix missing prompt message for 'snapshot-delete' command
Nan Zhang [Wed, 13 Jul 2011 08:36:32 +0000 (16:36 +0800)]
virsh: fix missing prompt message for 'snapshot-delete' command

Make the command 'virsh snapshot-delete' has the appropriate prompt
message when executing sucessful or failed.

13 years agoqemu: build failed due to unused variables
Peter Krempa [Wed, 13 Jul 2011 10:11:43 +0000 (12:11 +0200)]
qemu: build failed due to unused variables

While compiling on F15 build crashed (probably because of new GCC).

13 years agostorage: reject unknown flags
Eric Blake [Wed, 6 Jul 2011 22:51:23 +0000 (16:51 -0600)]
storage: reject unknown flags

* src/storage/storage_backend.c (virStorageBackendCreateBlockFrom)
(virStorageBackendCreateQemuImg)
(virStorageBackendCreateQcowCreate): Reject unknown flags.
* src/storage/storage_backend_disk.c (virStorageBackendDiskBuildPool)
(virStorageBackendDiskDeleteVol): Likewise.
* src/storage/storage_backend_fs.c
(virStorageBackendFileSystemNetFindPoolSources)
(virStorageBackendFileSystemBuild)
(virStorageBackendFileSystemDelete, createFileDir)
(virStorageBackendFileSystemVolBuildFrom)
(virStorageBackendFileSystemVolDelete): Likewise.
* src/storage/storage_backend_iscsi.c
(virStorageBackendISCSIFindPoolSources): Likewise.
* src/storage/storage_backend_logical.c
(virStorageBackendLogicalFindPoolSources)
(virStorageBackendLogicalBuildPool)
(virStorageBackendLogicalDeletePool)
(virStorageBackendLogicalDeleteVol): Likewise.
* src/storage/storage_driver.c (storageOpen, storagePoolCreate)
(storagePoolDefine, storagePoolRefresh, storagePoolGetXMLDesc)
(storageVolumeCreateXML, storageVolumeCreateXMLFrom)
(storageVolumeGetXMLDesc): Likewise.

13 years agonode_device: reject unknown flags
Eric Blake [Wed, 6 Jul 2011 22:21:23 +0000 (16:21 -0600)]
node_device: reject unknown flags

* src/node_device/node_device_driver.c (nodeNumOfDevices)
(nodeListDevices, nodeDeviceGetXMLDesc, nodeDeviceCreateXML):
Reject unknown flags.
* src/node_device/node_device_hal.c (halNodeDrvOpen): Likewise.
* src/node_device/node_device_udev.c (udevNodeDrvOpen): Likewise.

13 years agoutil: reject unknown flags, and prefer unsigned flags
Eric Blake [Wed, 6 Jul 2011 22:29:02 +0000 (16:29 -0600)]
util: reject unknown flags, and prefer unsigned flags

Silently ignored flags get in the way of new features that
use those flags.  Also, an upcoming syntax check will favor
unsigned flags.

* src/nodeinfo.h (nodeGetCPUStats, nodeGetMemoryStats): Drop
unused attribute.
* src/interface/netcf_driver.c (interfaceOpenInterface)
(interfaceDefineXML, interfaceCreate, interfaceDestroy): Reject
unknown flags.
* src/network/bridge_driver.c (networkOpenNetwork)
(networkGetXMLDesc): Likewise.
* src/nwfilter/nwfilter_driver.c (nwfilterOpen): Likewise.
* src/secret/secret_driver.c (secretOpen, secretDefineXML)
(secretGetXMLDesc, secretSetValue): Likewise.
* src/util/logging.c (virLogDefineFilter, virLogDefineOutput)
(virLogMessage): Likewise; also use unsigned flags.
* src/util/logging.h (virLogDefineFilter, virLogDefineOutput)
(virLogMessage): Change signature.
* src/util/command.c (virExecWithHook): Likewise.

13 years agolibvirt-qemu: use unsigned flags
Eric Blake [Fri, 8 Jul 2011 16:56:15 +0000 (10:56 -0600)]
libvirt-qemu: use unsigned flags

Like commit 1740c381, but for libvirt-qemu.

* src/remote/qemu_protocol.x (qemu_monitor_command_args): Adjust
type to match API.
* src/qemu_protocol-structs: Update accordingly.

13 years agomaint: print flags in hex during debug
Eric Blake [Fri, 8 Jul 2011 15:18:48 +0000 (09:18 -0600)]
maint: print flags in hex during debug

Continuation of commit 313ac7fd, and enforce things with a syntax
check.

Technically, virNetServerClientCalculateHandleMode is not printing
a mode_t, but rather a collection of VIR_EVENT_HANDLE_* bits;
however, these bits are < 8, so there is no different in the
output, and that was the easiest way to silence the new syntax check.

* cfg.mk (sc_flags_debug): New syntax check.
(exclude_file_name_regexp--sc_flags_debug): Add exemptions.
* src/fdstream.c (virFDStreamOpenFileInternal): Print flags in
hex, mode_t in octal.
* src/libvirt-qemu.c (virDomainQemuMonitorCommand)
(virDomainQemuAttach): Likewise.
* src/locking/lock_driver_nop.c (virLockManagerNopInit): Likewise.
* src/locking/lock_driver_sanlock.c (virLockManagerSanlockInit):
Likewise.
* src/locking/lock_manager.c: Likewise.
* src/qemu/qemu_migration.c: Likewise.
* src/qemu/qemu_monitor.c: Likewise.
* src/rpc/virnetserverclient.c
(virNetServerClientCalculateHandleMode): Print mode with %o.

13 years agomaint: exclude more files from syntax check
Eric Blake [Fri, 8 Jul 2011 15:13:53 +0000 (09:13 -0600)]
maint: exclude more files from syntax check

* cfg.mk (VC_LIST_ALWAYS_EXCLUDE_REGEX): Exempt
docs/api_extension/*.patch.
(exclude_file_name_regexp--sc_prohibit_always_true_header_tests)
(exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF)
(exclude_file_name_regexp--sc_prohibit_fork_wrappers)
(exclude_file_name_regexp--sc_trailing_blank): Simplify.
(exclude_file_name_regexp--sc_prohibit_gettext_noop): Delete.
(exclude_file_name_regexp--sc_prohibit_close)
(exclude_file_name_regexp--sc_prohibit_nonreentrant)
(exclude_file_name_regexp--sc_prohibit_sprintf): Tighten.

13 years agoutil: honor anchored names when searching for executables
Eric Blake [Tue, 12 Jul 2011 22:47:01 +0000 (16:47 -0600)]
util: honor anchored names when searching for executables

I got bit in a debugging session on an uninstalled libvirtd; the
code tried to call out to the installed $LIBEXECDIR/libvirt_iohelper
instead of my just-built version.  So I set a breakpoint and altered
the binary name to be "./src/libvirt_iohelper", and it still failed
because I don't have "." on my PATH.

According to POSIX, execvp only searches PATH if the name does
not contain a slash.  Since we are trying to mimic that behavior,
an anchored name should be relative to the current working dir.

This tightens existing behavior, but most callers already pass
an absolute name or a name with no slashes, so it probably won't
be noticeable.

* src/util/util.c (virFindFileInPath): Anchored relative names do
not invoke a PATH search.

13 years agoEnsure signal handler propagates fatal signals to default handler
Daniel P. Berrange [Wed, 6 Jul 2011 16:11:03 +0000 (17:11 +0100)]
Ensure signal handler propagates fatal signals to default handler

When replacing the default SEGV/ABORT/BUS signal handlers you
can't rely on the process being terminated after your custom
handler runs. It is neccessary to manually restore the default
handler and then re-raise the signal

* src/rpc/virnetserver.c: Restore default handler and raise
  signal

13 years agoRemove unused virNetServerProgramErrorHander typedef
Daniel P. Berrange [Wed, 6 Jul 2011 16:05:40 +0000 (17:05 +0100)]
Remove unused virNetServerProgramErrorHander typedef

* src/rpc/virnetserverprogram.h: Remove unused typedef for
  virNetServerProgramErrorHander function callback
* daemon/remote.h: Remove decl for non-existant variables

13 years agoqemu: Fix monitor unlocking in some error paths
Jiri Denemark [Mon, 4 Jul 2011 14:35:03 +0000 (16:35 +0200)]
qemu: Fix monitor unlocking in some error paths

When monitor is entered with qemuDomainObjEnterMonitorWithDriver, the
correct method for leaving and unlocking the monitor is
qemuDomainObjExitMonitorWithDriver.

13 years agoqemu: Consolidate qemuMigrationPrepare{Direct,Tunnel}
Jiri Denemark [Mon, 13 Jun 2011 08:48:34 +0000 (10:48 +0200)]
qemu: Consolidate qemuMigrationPrepare{Direct,Tunnel}

Most of the code in these two functions is supposed to be identical but
currently it isn't (which is natural since the code is duplicated).
Let's move common parts of these functions into qemuMigrationPrepareAny.

This also fixes qemuMigrationPrepareTunnel which didn't store received
lockState in the domain object.

13 years agoqemu: Add support for job phase
Jiri Denemark [Mon, 6 Jun 2011 08:30:54 +0000 (10:30 +0200)]
qemu: Add support for job phase

Asynchronous jobs may take long time to finish and may consist of
several phases which we need to now about to help with recovery/rollback
after libvirtd restarts.

13 years agoqemu: Recover from interrupted jobs
Jiri Denemark [Mon, 4 Jul 2011 21:33:39 +0000 (23:33 +0200)]
qemu: Recover from interrupted jobs

Detect and react on situations when libvirtd was restarted or killed
when a job was active.

13 years agoqemu: Save job type in domain status XML
Jiri Denemark [Mon, 6 Jun 2011 08:28:38 +0000 (10:28 +0200)]
qemu: Save job type in domain status XML

If libvirtd is restarted when a job is running, the new libvirtd process
needs to know about that to be able to recover and rollback the
operation.

13 years agoqemu: Allow all query commands to be run during long jobs
Jiri Denemark [Thu, 30 Jun 2011 09:23:50 +0000 (11:23 +0200)]
qemu: Allow all query commands to be run during long jobs

Query commands are safe to be called during long running jobs (such as
migration). This patch makes them all work without the need to
special-case every single one of them.

The patch introduces new job.asyncCond condition and associated
job.asyncJob which are dedicated to asynchronous (from qemu monitor
point of view) jobs that can take arbitrarily long time to finish while
qemu monitor is still usable for other commands.

The existing job.active (and job.cond condition) is used all other
synchronous jobs (including the commands run during async job).

Locking schema is changed to use these two conditions. While asyncJob is
active, only allowed set of synchronous jobs is allowed (the set can be
different according to a particular asyncJob) so any method that
communicates to qemu monitor needs to check if it is allowed to be
executed during current asyncJob (if any). Once the check passes, the
method needs to normally acquire job.cond to ensure no other command is
running. Since domain object lock is released during that time, asyncJob
could have been started in the meantime so the method needs to recheck
the first condition. Then, normal jobs set job.active and asynchronous
jobs set job.asyncJob and optionally change the list of allowed job
groups.

Since asynchronous jobs only set job.asyncJob, other allowed commands
can still be run when domain object is unlocked (when communicating to
remote libvirtd or sleeping). To protect its own internal synchronous
commands, the asynchronous job needs to start a special nested job
before entering qemu monitor. The nested job doesn't check asyncJob, it
only acquires job.cond and sets job.active to block other jobs.

13 years agoqemu: Consolidate {Enter,Exit}Monitor{,WithDriver}
Jiri Denemark [Sun, 3 Jul 2011 21:55:47 +0000 (23:55 +0200)]
qemu: Consolidate {Enter,Exit}Monitor{,WithDriver}

EnterMonitor and ExitMonitor methods are very similar to their
*WithDriver variants; consolidate them into EnterMonitorInternal and
ExitMonitorInternal to avoid (mainly future) code duplication.

13 years agoqemu: Consolidate BeginJob{,WithDriver} into a single method
Jiri Denemark [Thu, 30 Jun 2011 09:21:34 +0000 (11:21 +0200)]
qemu: Consolidate BeginJob{,WithDriver} into a single method

This avoids code duplication and also avoids relying on good luck that
ignore_value(virDomainObjUnref(obj)) doesn't set errno.

13 years agoqemu: Separate job related data into a new object
Jiri Denemark [Mon, 6 Jun 2011 08:34:33 +0000 (10:34 +0200)]
qemu: Separate job related data into a new object

13 years agomaint: avoid incremental 'make syntax-check' failure
Eric Blake [Tue, 12 Jul 2011 16:52:56 +0000 (10:52 -0600)]
maint: avoid incremental 'make syntax-check' failure

Incrementally running 'make syntax-check' on a tree previously
built after commit 62dee6f but before 44036460 fails sc_po_check
(because the generated qemu_dispatch.h gained translatable strings).
This is a followup to commit addaa537 for that scenario.

* cfg.mk (sc_po_check): Add another prereq.
($(srcdir)/daemon/qemu_dispatch.h): Add rule.

13 years agoSkip bugs which are CLOSED in todo list
Daniel P. Berrange [Thu, 7 Jul 2011 15:03:22 +0000 (16:03 +0100)]
Skip bugs which are CLOSED in todo list

* docs/todo.pl: Skip closed bugs

13 years agoAdd missing cleanup for transient guests in UML driver
Daniel P. Berrange [Mon, 4 Jul 2011 11:11:56 +0000 (12:11 +0100)]
Add missing cleanup for transient guests in UML driver

The UML inotify handler would kill off guests when certain
conditions arise, but it forgot to remove transient guests
from the list of domains

* src/uml/uml_driver.c: Cleanup transient guests

13 years agoAdd auditing to the UML driver
Daniel P. Berrange [Mon, 4 Jul 2011 11:10:30 +0000 (12:10 +0100)]
Add auditing to the UML driver

* src/uml/uml_driver.c: Add audit hooks

13 years agoAdd auditing to the LXC driver
Daniel P. Berrange [Mon, 4 Jul 2011 11:06:14 +0000 (12:06 +0100)]
Add auditing to the LXC driver

* src/lxc/lxc_driver.c: Add auditing hooks

13 years agoAdd virtualization type in audit messages
Daniel P. Berrange [Mon, 4 Jul 2011 11:21:21 +0000 (12:21 +0100)]
Add virtualization type in audit messages

Since a host can run several different virtualization types at
the same time, audit messages should allow domains to be identified.
Add a 'virt={qemu,kvm,uml,lxc,...}' key to domain audit messages

* src/conf/domain_audit.c: Identify virt type of guest

13 years agoAdd auditing of filesystems
Daniel P. Berrange [Mon, 4 Jul 2011 11:00:33 +0000 (12:00 +0100)]
Add auditing of filesystems

When passing through filesystems from the host to a guest, the
host filesystem passed must be audited

* src/conf/domain_audit.{c,h}: Add virDomainAuditFS

13 years agoMove qemu_audit.h helpers into shared code
Daniel P. Berrange [Mon, 4 Jul 2011 10:56:13 +0000 (11:56 +0100)]
Move qemu_audit.h helpers into shared code

The LXC and UML drivers can both make use of auditing. Move
the qemu_audit.{c,h} files to src/conf/domain_audit.{c,h}

* src/conf/domain_audit.c: Rename from src/qemu/qemu_audit.c
* src/conf/domain_audit.h: Rename from src/qemu/qemu_audit.h
* src/Makefile.am: Remove qemu_audit.{c,h}, add domain_audit.{c,h}
* src/qemu/qemu_audit.h, src/qemu/qemu_cgroup.c,
  src/qemu/qemu_command.c, src/qemu/qemu_driver.c,
  src/qemu/qemu_hotplug.c, src/qemu/qemu_migration.c,
  src/qemu/qemu_process.c: Update for changed audit API names

13 years agoesx: Initialize all instances of esxVMX_Data to zero
Matthias Bolte [Tue, 12 Jul 2011 09:34:55 +0000 (11:34 +0200)]
esx: Initialize all instances of esxVMX_Data to zero

To avoid using or freeing uninitialized memory or pointers.

13 years agorpc: Fix compile error due to potentially unused parameter
Matthias Bolte [Tue, 12 Jul 2011 15:06:16 +0000 (17:06 +0200)]
rpc: Fix compile error due to potentially unused parameter

connectDBus is only used if HAVE_DBUS is set. Therefore mark
it as potentially unused.

13 years agoFix build when using polkit0
Jim Fehlig [Thu, 7 Jul 2011 21:12:26 +0000 (15:12 -0600)]
Fix build when using polkit0

V2: Remove policy kit references from virNetServer and use DBus APIs
    directly, if available.

13 years agoImplement code to attach to external QEMU instances.
Daniel P. Berrange [Thu, 5 May 2011 16:32:21 +0000 (17:32 +0100)]
Implement code to attach to external QEMU instances.

Given a PID, the QEMU driver reads /proc/$PID/cmdline and
/proc/$PID/environ to get the configuration. This is fed
into the ARGV->XML convertor to build an XML configuration
for the process.

/proc/$PID/exe is resolved to identify the full command
binary path

After checking for name/uuid uniqueness, an attempt is
made to connect to the monitor socket. If successful
then 'info status' and 'info kvm' are issued to determine
whether the CPUs are running and if KVM is enabled.

* src/qemu/qemu_driver.c: Implement virDomainQemuAttach
* src/qemu/qemu_process.h, src/qemu/qemu_process.c: Add
  qemuProcessAttach to connect to the monitor of an
  existing QEMU process

13 years agoAdd monitor API for checking whether KVM is enabled
Daniel P. Berrange [Fri, 17 Jun 2011 14:31:45 +0000 (15:31 +0100)]
Add monitor API for checking whether KVM is enabled

When attaching to an external QEMU process, it is neccessary
to check if the process is using KVM or not. This can be done
using a monitor command

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
  API for checking if KVM is enabled

13 years agoAdd a method for extracting QEMU argv from /proc
Daniel P. Berrange [Fri, 17 Jun 2011 14:34:00 +0000 (15:34 +0100)]
Add a method for extracting QEMU argv from /proc

To enable attaching to externally launched QEMU, we need
to be able to reverse engineer a guest XML config based
on the argv for a PID in /proc

* src/qemu/qemu_command.c, src/qemu/qemu_command.h: Add
  qemuParseCommandLinePid which extracts QEMU config from
  argv in /proc, given a PID number

13 years agoChange extract pidfile & monitor config from QEMU command line
Daniel P. Berrange [Fri, 17 Jun 2011 14:31:02 +0000 (15:31 +0100)]
Change extract pidfile & monitor config from QEMU command line

When converting QEMU argv into a virDomainDefPtr, also extract
the pidfile, monitor character device config and the monitor
mode.

* src/qemu/qemu_command.c, src/qemu/qemu_command.h: Extract
  pidfile & monitor config from QEMU argv
* src/qemu/qemu_driver.c, tests/qemuargv2xmltest.c: Add extra
  params when calling qemuParseCommandLineString

13 years agoKeep pidfile path in qemuDomainObjPrivate struct
Daniel P. Berrange [Fri, 17 Jun 2011 13:43:54 +0000 (14:43 +0100)]
Keep pidfile path in qemuDomainObjPrivate struct

Avoid re-formatting the pidfile path everytime we need it. Create
it once when starting the guest, and preserve it until the guest
is shutdown.

* src/libvirt_private.syms, src/util/util.c,
  src/util/util.h: Add virFileReadPidPath
* src/qemu/qemu_domain.h: Add pidfile field
* src/qemu/qemu_process.c: Store pidfile path in qemuDomainObjPrivate

13 years agoAdd a new 'virsh qemu-attach' command.
Daniel P. Berrange [Thu, 5 May 2011 16:32:07 +0000 (17:32 +0100)]
Add a new 'virsh qemu-attach' command.

This command allows libvirt to attach to an existing QEMU
instance.

 $ qemu-kvm -cdrom ~/demo.iso \
     -monitor unix:/tmp/demo,server,nowait \
     -name foo \
     -uuid cece4f9f-dff0-575d-0e8e-01fe380f12ea  &
 $ QEMUPID=$!
 $ virsh qemu-attach $QEMUPID

13 years agoDefine remote wire protocol & impls for virDomainQemuAttach
Daniel P. Berrange [Thu, 5 May 2011 16:31:58 +0000 (17:31 +0100)]
Define remote wire protocol & impls for virDomainQemuAttach

This tweaks the RPC generator to cope with some naming
conventions used for the QEMU specific APIs

* daemon/remote.c: Server side dispatcher
* src/remote/remote_driver.c: Client side dispatcher
* src/remote/qemu_protocol.x: Wire protocol definition
* src/rpc/gendispatch.pl: Use '$structprefix' in method
  names, fix QEMU flags and fix dispatcher method names

13 years agoDefine a QEMU specific API to attach to a running QEMU process
Daniel P. Berrange [Thu, 5 May 2011 14:05:40 +0000 (15:05 +0100)]
Define a QEMU specific API to attach to a running QEMU process

Introduce a new API in libvirt-qemu.so

 virDomainPtr virDomainQemuAttach(virConnectPtr domain,
                                  unsigned long long pid,
                                  unsigned int flags);

This allows libvirtd to attach to an existing, externally
launched QEMU process. This is useful for QEMU developers who
prefer to launch QEMU themselves for debugging/devel reasons,
but still want the benefit of libvirt based tools like
virt-top, virt-viewer, etc

* include/libvirt/libvirt-qemu.h: Define virDomainQemuAttach
* src/driver.h, src/libvirt-qemu.c, src/libvirt_qemu.syms:
  Driver glue for virDomainQemuAttach

13 years agoqemu: update configuration file
Alex Jia [Tue, 12 Jul 2011 10:42:41 +0000 (18:42 +0800)]
qemu: update configuration file

* src/qemu/qemu.conf: Add blkio controller into qemu.conf.

13 years agoqemu: avoid fd leak on core dump failure
Eric Blake [Mon, 11 Jul 2011 18:07:11 +0000 (12:07 -0600)]
qemu: avoid fd leak on core dump failure

* src/qemu/qemu_driver.c (doCoreDump): Guarantee fd is closed.