[Libvir] [PATCH] Fix callers to virGetDomain and virGetNetwork
by Richard W.M. Jones
(1) Removes virGetDomainByID. This function was neither used nor exported.
(2) virGetDomain sets a virterror connection error whenever anything bad
happens (realistically malloc failure is the only thing that can go
wrong). Therefore callers do not need to set virterror if the function
returns NULL. The patch fixes these callers.
(3) Same as (2), for virGetNetwork.
Rich.
--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903
17 years, 5 months
[Libvir] Proposal: Python bindings should turn NO_DOMAIN/NO_NETWORK errors in KeyError exceptions
by Richard W.M. Jones
I propose that we should change the Python bindings so that when the
virterror errors VIR_ERR_NO_DOMAIN and VIR_ERR_NO_NETWORK occur in the
lookup* functions only, should cause KeyError to be raised.
According to:
http://docs.python.org/lib/module-exceptions.html
"[KeyError is] raised when a mapping (dictionary) key is not found in
the set of existing keys."
I've already changed the OCaml bindings so that these errors get
converted into Not_found exception, which is the "natural" exception for
when something is looked up and not found.
Rich.
--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903
17 years, 5 months
[Libvir] [PATCH] virNetworkLookup* functions should raise VIR_ERR_NO_NETWORK
by Richard W.M. Jones
This small patch changes the virNetworkLookup* functions so that they
raise VIR_ERR_NO_NETWORK in the case where the network cannot be found
(as opposed to some other error).
It requires the VIR_ERR_NO_DOMAIN patches (see previous thread) to be
applied first, or at least patch #1 from that series.
Rich.
--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903
17 years, 5 months
[Libvir] [PATCH] Readd buffer errors & some cleanups
by Richard W.M. Jones
This readds some error checking of the returns from virBuffer*
functions, removes need for is_blank (a _GNU_SOURCE extension), and a
couple of other very minor cleanups.
Rich.
--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903
17 years, 5 months
[Libvir] PATCH: Fix remote driver to handle network API for local non-QEMU
by Daniel P. Berrange
The remote_internal.c code is basically a no-op in its remoteNetworkOpen
method. This means the remote driver will only handle the networking
APIs, if it is also handling the main domain APIs. This works fine if
connecting to a remote URI, or if using QEMU URIs, but it does not work
if using the test or Xen drivers.
To make this work the remoteNetworkOpen method needs to open a connection
to the remote daemon IIF the remoteOpen method did not already open one.
So the attached patch adds the neccessary logic in remoteNetworkOpen. It
also adds code to remoteNetworkClose to make it shutdown& free the connection
IIF it was opened by the remoteNetworkOpen method. This is what the extra
'networkOnly' field in the 'struct private_data' is used to check.
Second, all of the implementations of virNetwork* APIs in the remote_internal.c
driver must use the 'struct private_data *' from networkPrivateData field
in virConnectPtr, not the 'privateData' field. This is because the 'privateData'
field is probably storing data related to the Xen or Test drivers.
Third, this also fixes the qemu_driver.c which incorrectly used the
privateData field insteadof the networkPrivateData field for 2 of the
networking APIs, and finally makes sure the qemu_driver.c also acccepts
the use of qemu:///session APIs for root user.
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
17 years, 5 months
[Libvir] Proposal: libvirt should remove or rename a save file after a successful restore
by Richard W.M. Jones
Chris Lalancette found this problem:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=246105
<quote>
Once an "xm restore" has successfully completed, the -save file that it
came from should really be deleted. Restoring a domain a second time
from the same save file will result in disk corruption; the kernel VM
state (in the saved file) will be in an inconsistent state with respect
to what is actually on disk (in the domain disk file). The only valid
use I can see for the -save file after a restore is possibly for some
crash analysis, but even that could be worked around by renaming the
save file after a success. In particular, I just ran into this
situation (and I'm worried customers might do the same):
[and then he goes on to describe a scenario in which you can commonly
hit this situation]
</quote>
So the obvious and simple solution, it seems to me, is just to change
libvirt.c:virDomainRestore so that if the driver underneath it returns
from the restore without error, then we either remove or rename the
restore file.
It's a trivial patch -- what do people think?
My thoughts:
* Removing the file might seem quite abrupt/unexpected, and there is the
possibility of data loss.
* You have to rename the file as a hidden file (dotfile) in order for
xendomains to ignore it. However these files are big and having large,
hidden files which build up in number over time sounds like it could be
a bad thing.
* This might be considered a significant behaviour change.
* It's easier to handle this for the remote case if we make the change
inside libvirt, rather than in virsh etc.
Rich.
--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903
17 years, 5 months