once. This makes it possible to unit test this code. Remove the odd aliasing
of gopts to opts inside parseCommandLine.
Rename local variables globals and locals inside opts.load -- these are built-in
functions.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
using connectionMade, connectionLost, startedConnecting, clientConnectionLost,
and clientConnectionFailed was the test classes (TestClientFactory,
TestClientProtocol, TestServerFactory, TestServerProtocol), so they were
actually testing lots of code that no-one else was using. All these classes
have gone, freeing up lots of cruft around.
The useless classes Factory, ServerFactory, ClientFactory, RelocationFactory,
UnixServerConnection, and TCPServerConnection have gone, in favour of passing
the Protocol class directly to SocketListener, and using SocketServerConnection
directly.
connectTransport has gone, in favour of overriding connect directly.
Piles of closedown cruft has gone, as this was only supporting the correct
output of connectionLost events, none of which we need.
Unused SocketServerConnection.{getHost,getPeer} have gone.
Mark some parameters in relocate as unused.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
forking implied by the start method. This makes it easier to run valgrind
against Xend, or run it with a pydebug-compiled Python.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
deallocation to match those in the Python/C tutorial. This has been done to
make the interface here more conventional, in the hunt for bug #411. One
double deallocation has been fixed, but this would only occur if we failed to
create the connection to Xenstore, and so unfortunately is not the cause of
that bug.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
many places we were supporting keywords for calling the methods here, and never
using that feature (especially where all the arguments were compulsory anyway)
and in some places we were even accepting positional and keyword arguments, and
not actually taking any arguments to the method at all!
Fix the permission parsing string in xspy_set_permissions -- this would have
blown up horribly if anyone were actually calling this code.
Fix the documentation comments to include the transaction handle throughout.
Have the self parameter to all the methods be an XsHandle, not a PyObject, to
avoid casting.
Remove unused pyvalue_int and pyvalue_str.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
uses of goto that reduce down to return NULL in any case, breaking the common
code out for returning values based upon the success or failure of an
operation, and the common code that parses transaction and path parameters,
used by xspy_read, xspy_ls, and xspy_mkdir. Break out also the common code
that removes a watch token from the XsHandle watches list.
Use bool rather than int for result values, where this matches the same use
by tools/xenstore/xs.c.
Added missing free in xspy_get_permissions.
Use PySequence_SetItem inside xs_watch, rather than Py_INCREF followed by
PyList_SetItem. If there is no None entry in the watches list, the code goes
on to append to the list using PyList_Append, and that call takes its own
reference rather than stealing one like PyList_SetItem. This means that we
were previously leaking a reference if the list was full and so PyList_Append
was necessary.
Use PySequence_SetItem rather than Py_INCREF/PyList_SetItem also where we are
using assigning Py_None into the list, for neatness.
Remove meaningless pipe from xspy_release_domain's arg_spec.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
internal state if the store is configured by an external tool.
We react properly to changes in name and on_{reboot,poweroff,crash}. Reacting
correctly to vcpus, vcpu_avail, memory, and maxmem will come soon (those code
aspects are already under review). cpu_weight and bootloader to be considered.
Removed unused and semantically invalid method XendDomainInfo.setDomid.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
Upon further investigation it sets Device parameters that don't exist any
longer, thus causing exceptions. As it looks like this is completely
obsolete, and no one is actively working on it, we should just rip it out to
end the confusion.
Signed-off-by: Sean Dague <sean@dague.net>
continue to receive watches. This means that it is not necessary to probe
around in the xswatch internals to unregister a watch.
Tidy up the hotplug watch handling, moving the nested function out to a
separate place (I don't think that this was a problem in the end, but it was
making me nervous as I was debugging the recent race condition, and I find it
clearer out of the class in any case. Pass an integer code representing
hotplug status, once it has been parsed from the store, as there are now a few
different places we can detect failure, and it's cleaner to pass a code from
those places.
Small tidy up to XendDomain, removing the unused releaseDomain field.
when given a non-convertible value, as claimed by the comment, as the exception
ValueError is thrown in that situation. TypeError is only thrown on int(None),
which cannot actually take place in this code, because of the explicit check
for None.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
config files (e.g. dom0) don't set info['vcpus'] correctly resulting in
incorrect cpu availablity values in the store. This prevents hotplug
from functioning.
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
1. xm vcpu-list now shows info for all vcpus by using
info['max_vcpu_id']+1 as end of the range to query
vcpu_info.
2. Add new vcpu fields, online_vcpus, max_vcpu_id to
XendDomainInfo.sxpr()
3. Remove filter_cpump() which isn't needed now that
the per vcpu cpumap field is correct.
4. Update xm/main.py to use online_vcpus as the number
vcpus to display in list.
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
sxpr everywhere broke the use of a boot loader for booting with. The
attached fixes things up so that
a) use of a bootloader ==> kernel not specified in the config file
b) don't cleanup bootloader files until after the domain has booted
c) rerun bootloader on reboot
Signed-off-by: Jeremy Katz <katzj@redhat.com>
This will make the drivers more robust to failure of the other end, and makes
current driver state more visible. It also allows us to bring very similar
pieces of code from the drivers together into the xenbus driver. This should
be the start of a fix to the problem with block and net device hotplugging,
because the code was previously confused about the difference between the
connection state of the kernel device layer, and the state of the xenbus
communication. This confusion is addressed here.
Much of this work is influenced by Rusty Russell's skeleton driver, recently
posted to xen-devel, as that piece made suggestions as to structure and
arrangement that have been taken on board, albeit pushed down into the xenbus
layer.
A new file xenbus_client.c has been added. This file implements the interface
between the xenbus layer and the layer specific to the driver. Access to
lower layers is still allowed for those who do not need all the facilities of
the new driver.
xenbus_dev_error has moved from xenbus_xs.c into xenbus_client.c, and
xenbus_dev_ok has been removed, in favour of xenbus_switch_state.
DevController.py now closes down a device by writing a change to the Closing
state on the backend, to allow the frontend time to close down properly. Its
also writes the frontend and backend details within the same transaction.
The timeout on the hotplug scripts has been cranked down from 2 minutes to 5
seconds.
The diagnose script has been updated to parse the new states.
The blktab and tpm drivers have yet to be ported to this structure.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
just like block device.
e.g. vif=['type=ioemu, mac=01:00:00:00:00:33, bridge=xenbr0']
type=ioemu to specify for vmx NIC device.
nics=4 can specify 4 vmx NIC now.
bridge is passed to device model now.
With this patch, the error
"Error: Device 0 (vif) could not be connected."
will not happen for creating vmx guest
currently, it happens on some linux distribution.
Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
change to parsing memory configuration against a store with entries written
by an older Xend.
Added maxmem field to list of things to be read from the store on recreate.