Commit Graph

3200 Commits

Author SHA1 Message Date
Klaus Ethgen
75d88455f5 The base used for conversion of USB values should be 16 not 10.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2010-04-27 19:47:54 +02:00
Chris Lalancette
b69bbebbba Fix up the locking in the snapshot code.
In particular I was forgetting to take the qemuMonitorPrivatePtr
lock (via qemuDomainObjBeginJob), which would cause problems
if two users tried to access the same domain at the same time.
This patch also fixes a problem where I was forgetting to remove
a transient domain from the list of domains.

Thanks to Stephen Shaw for pointing out the problem and testing
out the initial patch.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-27 10:40:36 -04:00
Stefan Berger
aea68ce906 nwfilter: add support for RAPR protocol
This patch adds support for the RARP protocol. This may be needed due to
qemu sending out a RARP packet (at least that's what it seems to want to
do even though the protocol id is wrong) when migration finishes and
we'd need a rule to let the packets pass.

Unfortunately my installation of ebtables does not understand -p RARP
and also seems to otherwise depend on strings in /etc/ethertype
translated to protocol identifiers. Therefore I need to pass -p 0x8035
for RARP. To generally get rid of the dependency of that file I switch
all so far supported protocols to use their protocol identifier in the
-p parameter rather than the string.

I am also extending the schema and added a test case.

changes from v1 to v2:
- added test case into patch
2010-04-27 07:26:12 -04:00
Jiri Denemark
35b6137696 Ignore qemu STOP event when stopping CPUs
With JSON qemu monitor, we get a STOP event from qemu whenever qemu
stops guests CPUs. The downside of it is that vm->state is changed to
PAUSED and a new generic paused event is send to applications. However,
when we ask qemu to stop the CPUs we are not really interested in qemu
event and we usually want to issue a more specific event.

By setting vm->status to PAUSED before actually sending the request to
qemu (and resetting it back if the request fails) we can ignore the
event since the event handler does nothing when the guest is already
paused. This solution is quite hacky but unfortunately it's the best
solution which I was able to come up with and it doesn't introduce a
race condition.
2010-04-27 12:14:47 +02:00
Jiri Denemark
29bca037aa Fix build with DEBUG_RAW_IO=1 2010-04-27 12:09:35 +02:00
David Allan
1b9347b5f1 Fix indentation for storage conf XML
* virStorageEncryptionFormat is called from both
  virDomainDiskDefFormat and virStorageVolTargetDefFormat.  The proper
  indentation in the generated XML depends on the caller.  My earlier
  patch to fix the incorrect indentation for the domain XML broke the
  indentation for the storage XML.  This patch adopts Laine's
  suggestion of requring the caller of virStorageEncryptionFormat to
  provide an unsigned int with the number of spaces the output should
  be indented.  The patch modifies both callers to provide the
  additional argument.

* Add a regression test for the domain XML

* src/conf/domain_conf.c src/conf/storage_conf.c
  src/conf/storage_encryption_conf.c src/conf/storage_encryption_conf.h:
  change the indentation code
* tests/qemuxml2xmltest.c
  tests/qemuxml2argvdata/qemuxml2argv-encrypted-disk.args
  tests/qemuxml2argvdata/qemuxml2argv-encrypted-disk.xml: add a regression test
2010-04-27 12:01:32 +02:00
Matthias Bolte
d707c86633 cygwin: Handle differences in the XDR implementation
Cygwin's XDR implementation defines xdr_u_int64_t instead of
xdr_uint64_t and lacks IXDR_PUT_INT32/IXDR_GET_INT32.

Alter the IXDR_GET_LONG regex in rpcgen_fix.pl so it doesn't destroy
the #define IXDR_GET_INT32 IXDR_GET_LONG in remote_protocol.x.

Also fix the remote_protocol.h regex in rpcgen_fix.pl.
2010-04-27 09:31:28 +02:00
Matthias Bolte
fe4ff24af8 linux/if.h header is not available on non-Linux platforms 2010-04-26 21:07:11 +02:00
Stefan Berger
5c7c755f50 nwfilter: enable hex number inputs in filter XML
With this patch I want to enable hex number inputs in the filter XML. A
number that was entered as hex is also printed as hex unless a string
representing the meaning can be found.

I am also extending the schema and adding a test case. A problem with
the DSCP value is fixed on the way as well.

Changes from V1 to V2:

- using asHex boolean in all printf type of functions to select the
output format in hex or decimal format
2010-04-26 13:50:40 -04:00
Satoru SATOH
8fa9c22142 Starts dnsmasq from libvirtd with --dhcp-hostsfile option
This patch makes libvirtd start the dnsmasq daemon with a
--dhcp-hostsfile option instead of --dhcp-host options for each
'//ip/dhcp/host' entries defined in network xml file.

the dnsmasq host file is stored into /var/lib/libvirt/network

* src/network/bridge_driver.c: define the directory for the hostfiles
  and save/delete them to be used by dnsmasq
2010-04-26 17:20:02 +02:00
Satoru SATOH
51d203c676 Add build support for dnsmasq module
* po/POTFILES.in: the new module contains translatable strings
* src/Makefile.am: include the files in the utils set
* src/libvirt_private.syms: exports the symbols internally
2010-04-26 17:20:02 +02:00
Satoru SATOH
4ad65ab86a Add dnsmasq module files
It implements an idea to save dhcp hosts' macaddr vs. ipaddr mappings to
static file and make dnsmasq loading it with "--dhcp-hostsfile" option,
originally suggested by Dan, and can address the problem that too
many "--dhcp-host" args hitting ARG_MAX limit

* src/util/dnsmasq.h src/util/dnsmasq.c: adds the 2 new files
2010-04-26 17:20:02 +02:00
Daniel Veillard
4ce54ef5c7 Fix make dist missing ESX generated files
new method generated files are missing from dist tarball.
2010-04-26 16:59:50 +02:00
Chris Lalancette
21c6cfc213 Fix printing of pathnames on error in qemuDomainSnapshotLoad.
While doing some testing of the snapshot code I noticed that
if qemuDomainSnapshotLoad failed, it would print a NULL as
part of the error.  That's not desirable, so leave the
full_path variable around until after we are done printing
errors.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-23 14:22:48 -04:00
Chris Lalancette
5993321dc5 Fix virDomainSnapshotObjFree memory leak.
We were freeing the virDomainSnapshotDefPtr, but not
the virDomainSnapshotObjPtr in virDomainSnapshotObjFree.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-23 14:21:34 -04:00
Chris Lalancette
e129a63775 Make virDomainSnapshotObjListDeinit static.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-23 14:20:56 -04:00
Matthias Bolte
40648b156b cygwin: Check explicitly for getmntent_r
Cygwin has mntent.h but lacks getmntent_r. Update preprocessor
checks to catch this combination.
2010-04-23 20:15:53 +02:00
Matthias Bolte
d1be0aefa9 Some NWFilter symbols are conditional and have to be exported conditional 2010-04-23 19:51:00 +02:00
Matthias Bolte
87506c2bcf xen: Fix inside_daemon beeing unused when libvirtd is disabled
The defined __sun is there, because inside_daemon is used in xenUnifiedOpen
if __sun is defined.
2010-04-23 19:51:00 +02:00
Luiz Capitulino
eb9b653243 QEmu JSON drop timestamp from command object
It's not needed and is currently ignored, but this is a bug.

It will get fixed soon and QMP will return an error for keys
it doesn't know about, this will break libvirt.

* src/qemu/qemu_monitor_json.c: remove qemuMonitorJSONCommandAddTimestamp()
  and the place where it's invoked in qemuMonitorJSONMakeCommand()
2010-04-23 18:06:18 +02:00
Daniel P. Berrange
98bd5e6c5a Fix crash in nwfilter driver check
The nwfilterDriverActive() could de-reference a NULL pointer
if it hadn't be started at the point it was called. It was
also not thread safe, since it lacked locking around data
accesses.

* src/nwfilter/nwfilter_driver.c: Fix locking & NULL checks
  in nwfilterDriverActive()
2010-04-23 11:06:30 +01:00
Eric Blake
3022375da3 addrToString: give better error message
The user probably doesn't care what the gai error numbers are, as
much as what the failed conversion IP address was.

* src/remote/remote_driver.c (addrToString): Mention which address
could not be converted.
* daemon/remote.c (addrToString): Likewise.
2010-04-22 14:46:55 -06:00
Spencer Shimko
c85c9b3a26 qemu: fix security context references in DAC code
* The error messages coming from qemu's DAC support contain strings
  from the original SELinux security driver code.  This just removes
  references to "security context" and other SELinux-isms from the DAC
  code.

Signed-off-by: Spencer Shimko <sshimko@tresys.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2010-04-22 13:54:41 -06:00
Stefan Berger
647c26c886 Changes from V1 to V2:
- using INT_BUFSIZE_BOUND() to determine the length of the buffersize
for printing and integer into

 - not explicitly initializing static var threadsTerminate to false
anymore, since that's done automatically

Changes after V2:
  - removed while looks in case of OOM error
  - removed on ifaceDown() call
  - preceding one ifaceDown() call with an ifaceCheck() call

Since the name of an interface can be the same between stops and starts
of different VMs I have to switch the IP address learning thread to use
the index of the interface to determine whether an interface is still
available or not - in the case of macvtap the thread needs to listen for
traffic on the physical interface, thus having to time out periodically
to check whether the VM's macvtap device is still there as an indication
that the VM is still alive. Previously the following sequence of 2 VMs
with macvtap device

virsh start testvm1; virsh destroy testvm1 ; virsh start testvm2

would not terminate the thread upon testvm1's destroy since the name of
the interface on the host could be the same (i.e, macvtap0) on testvm1
and testvm2, thus it was easily race-able. The thread would then
determine the IP address parameter for testvm2 but apply the rule set
for testvm1. :-(
I am also introducing a lock for the interface (by name) that the thread
must hold while it listens for the traffic and releases when it
terminates upon VM termination or 0.5 second thereafter. Thus, the new
thread for a newly started VM with the same interface name will not
start while the old one still holds the lock. The only other code that I
see that also needs to grab the lock to serialize operation is the one
that tears down the firewall that were established on behalf of an
interface.

I am moving the code applying the 'basic' firewall rules during the IP
address learning phase inside the thread but won't start the thread
unless it is ensured that the firewall driver has the ability to apply
the 'basic' firewall rules.
2010-04-22 14:58:57 -04:00
David Allan
68529bc596 Properly indent encryption tags
* Fix for the bug reported at:

https://bugzilla.redhat.com/show_bug.cgi?id=573908
2010-04-22 14:26:55 -04:00
Jiri Denemark
96ac18591a Fix locking in qemudDomainCoreDump
The hang fix in d376b7d63e was incomplete
since it left quite a few {Enter,Exit}Monitor calls which require driver
to be unlocked. Since the driver is locked throughout the whole
function, {Enter,Exit}MonitorWithDriver need to be used instead to
ensure driver is not locked when issuing monitor commands.
2010-04-22 19:41:24 +02:00
Jiri Denemark
e2c059485c Poll for migration end every 50ms instead of 50us
The comment in qemuDomainWaitForMigrationComplete says we are polling
every 50ms but the code sleeps only for 50us. This was already discussed
during review but apparently forgotten when the series was pushed.
2010-04-22 19:41:18 +02:00
Daniel P. Berrange
9772bebab7 Fix QEMU text monitor command error checking
The text monitor code was checking for a '\n' prefix on several
places. Previously this would work, but since the monitor code
re-write the '\n' is already stripped off, so mustn't be checked
for.

* src/qemu/qemu_monitor_text.c: Fix monitor error checking
2010-04-22 17:15:48 +01:00
Daniel P. Berrange
a980d123b5 Fix CPU hotplug command names
Probably as a result of a merge error, the CPU hotplug command
names were completely wrong.

* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Fix
  the CPU hotplug command names
2010-04-22 17:15:48 +01:00
Jiri Denemark
b9a2552d2a Use configured CPU model if possible
Adds ability to provide a preferred CPU model for CPUID data decoding.
Such model would be considered as the best possible model (if it's
supported by hypervisor) regardless on number of features which have to
be added or removed for describing required CPU.
2010-04-22 10:20:50 +02:00
Jiri Denemark
53c4f9fa1c Support removing features when converting data to CPU
So far, when CPUID data were converted into CPU model and features, the
features can only be added to the model. As a result, when a guest asked
for something like "qemu64,-svm" it would get a qemu32 plus a bunch of
additional features instead.

This patch adds support for removing feature from the base model.
Selection algorithm remains the same: the best CPU model is the model
which requires lowest number of features to be added/removed from it.
2010-04-22 10:20:41 +02:00
Jiri Denemark
60aef9e467 Move MIN macro to util.h so that others can use it 2010-04-22 10:20:32 +02:00
Jiri Denemark
e07314f4c1 Deal with CPU models in []
Qemu committed a patch which list some CPU names in [] when asked for
supported CPUs (qemu -cpu ?). Yet, it needs such CPUs to be passed
without those square braces. When probing for supported CPU models, we
can just strip the square braces and pretend we have never seen them.
2010-04-22 10:20:25 +02:00
Jiri Denemark
9fbb810cf4 Fix initial VCPU pinning in qemu driver
First, inital VCPU pinning is set correctly but then it is reset by
assigning qemu process to a new cgroup (which contains all CPUs). It's
easily fixed by swapping these two actions.
2010-04-22 09:30:34 +02:00
Guido Günther
ce380b8e6f Ignore empty type attribute in driver element of virtual disks
Fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=578347
2010-04-21 20:49:47 +02:00
Eric Blake
84bc7ac06b build: fix preprocessor indentation
* src/esx/esx_vi.h: Placate cppi.
2010-04-21 10:05:01 -06:00
Chris Wong
b1fab0c21c esx: Don't treat an empty root snapshot list as error
An empty root snapshot list was considered as error condition. Creating a
new snapshot would fail if the domain didn't have snapshots yet, because
the snapshot-create function tries to lookup the list of existing snapshots
in order to verify that the snapshot name is unique. This fails if the
domain doesn't have snapshots yet.

Removing the NULL check from esxVI_LookupRootSnapshotTreeList fixes this.
2010-04-21 11:47:15 +02:00
Matthias Bolte
3f52921d43 esx: Gather some XML generation macros in esx_vi.h 2010-04-21 00:44:24 +02:00
Matthias Bolte
7a056d0648 esx: Fix FindByIp response handling
FindByIp may return nothing if there is no host or virtual machine
with the given IP address. Handle that case properly.
2010-04-21 00:44:18 +02:00
Matthias Bolte
1d8099f4b6 esx: Fix virtualHW.version generation
The supported virtualHW.version doesn't depend on the API version,
but on the product version.
2010-04-21 00:37:46 +02:00
Stefan Berger
abce152a49 nwfilter: add support for connlimit match
This patch adds support for the connlimit match in iptables that is used
to limit the number of outgoing directions.
2010-04-20 17:14:38 -04:00
Stefan Berger
c8f4dcca6a Extend fwall-drv interface and call functions via interface
I am moving some of the eb/iptables related functions into the interface
of the firewall driver and am making them only accessible via the driver's
interface. Otherwise exsiting code is adapted where needed. I am adding one
new function to the interface that checks whether the 'basic' rules can be
applied,  which will then be used by a subsequent patch.
2010-04-20 17:07:15 -04:00
Eric Blake
8f342c6f9a build: avoid compiler warning
According to GCC, ATTRIBUTE_UNUSED means that an attribute _might_
be unused, not _must_ be unused.  Therefore, it is easier to
blindly mark a variable, than to try and do preprocessor limiting
of when we know it is unused.

* src/remote/remote_driver.c (remoteAuthenticate): Mark attribute
as potentially unused.
Reported by Gustovo Morozowski.
2010-04-20 13:44:31 -06:00
Matthias Bolte
8138ec8693 Explicitly set virStoragePoolTypeInfo FS and NETFS defaults
No semantic change, the now explicitly set default are all zero and
that's what GCC sets unspecified struct members to.
2010-04-20 21:22:51 +02:00
Matthias Bolte
c6375aa796 esx: Add support for the VMXNET 2 (Enhanced) NIC model
Add a test case and document it.
2010-04-20 20:58:24 +02:00
Matthias Bolte
cad913060c Mark in_open parameter of remoteAuthenticate as unused when it's unused
Otherwise compiling with -Werror will fail.
2010-04-20 20:35:23 +02:00
Daniel P. Berrange
f3e098f3d8 Fix network hotplug to use device_add in QEMU
The initial boot of VMs uses -device for NICs where available. The
corresponding monitor command is device_add, but the network hotplug
code was still using device_del by mistake.

* src/qemu/qemu_driver.c: Use device_add for NIC hotplug where
  available
2010-04-19 12:11:30 +01:00
Daniel P. Berrange
9417eb0337 Fix error reporting for getfd + host_net_add in QEMU
If either of the getfd or host_net_add monitor commands return
any text, this indicates an error condition. Don't ignore this!

* src/qemu/qemu_monitor_text.c: Report errors for getfd and
  host_net_add
2010-04-19 12:11:24 +01:00
Daniel P. Berrange
e699a82474 Fix device_del in JSON mode for QEMU
The 'device_del' command expects a parameter called 'id' but we
were passing 'config'.

* src/qemu/qemu_monitor_json.c: Fix device_del command parameter
2010-04-19 12:11:17 +01:00
Matthias Bolte
c35b5269af nwfilter: Free nwfilter hash of virConnectPtr
And close the driver on connection close.
2010-04-17 18:20:15 +02:00