Don't default to master host-uuid if sr-create shared=false

sr-create had been defaulting the host-uuid to master if it wasn't
specified. This would cause problems when creating a local SR without
specifying the host-uuid. We now raise a CLI exception if we create
non-shared SR without specifying the host-uuid.

CA-98185

Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
CA-129192: restore metadata for all SR

CA-129192/SCTX-1728: revise restore-sr-metadata.py so that it could restore
metadata for all SR with command line:
   ./restore-sr-metadata.py -f <input file> -u all
or just omit the sr-uuid:
   ./restore-sr-metadata.py -f <input file>

xe-restore-metadata is modified accordingly.

Signed-off-by: Kaifeng Zhu <kaifeng.zhu@citrix.com>
CA-134405 Use xenopsd = true (!)

Signed-off-by: Jon Ludlam <jonathan.ludlam@citrix.com>
Merge pull request #1716 from jonludlam/CA-134405

CA-134405 Use xenopsd = true (!)
CA-133718: Fix HIMN login_with_password

HIMN had been relying on login_with_password working on the slave
as it was erroneously not being forwarded. When xapi was changed
to disallow logins on slaves, this broke. This changeset causes
login_with_password to be forwarded to the master, which should
fix the issue.

Signed-off-by: Jon Ludlam <jonathan.ludlam@citrix.com>
Merge pull request #1717 from jonludlam/CA-133718

CA-133718: Fix HIMN login_with_password
Merge pull request #1718 from djs55/configure

Add xenserver-core's configure script
CA-134593: The recent introduction of the configure script missed INVENTORY

Signed-off-by: Jon Ludlam <jonathan.ludlam@citrix.com>
Merge pull request #1720 from jonludlam/CA-134593

CA-134593: The recent introduction of the configure script missed INVENT...
The Makefile shouldn't call 'configure'

The build 'standard' is that the caller should run
  ./configure
  make

Signed-off-by: David Scott <dave.scott@citrix.com>
configure: add '--disable-tests' option

Unfortunately the unit tests don't work when run as unpriviledged
users inside unprepared chroots. This allows them to be skipped.

By default "./configure && make" will run the unit tests as before.

Signed-off-by: David Scott <dave.scott@citrix.com>
xapi.spec: run "configure"

Signed-off-by: David Scott <dave.scott@citrix.com>
xenserver build: run configure from mk/Makefile

Signed-off-by: David Scott <dave.scott@citrix.com>
event.from: prevent interference between parallel calls

Since the new event.from API implementation was based on top
of the existing event.next implementation it was possible
for one thread to interfere with another because each event.from
*shared* the 'subscription' record. In particular CloudStack
suffered from the following interleaving:

thread 1: event.from ["vm/"]
thread 2: event.from ["task/"]
 <- event on vm
thread 1: return successfully
thread 2: fails with SESSION_INVALID because the subscription
  is marked as invalid in the on_session_deleted cleanup function

In this patch we cleanly separate the event.next implementation
(in the submodule Next) from the event.from implementation
(in the submodule From). It's now clear that all calls to
event.from use *separate* state, sharing only the session_id
which is used to allow session.logout to be used to unblock
blocked threads.

This patch strengthens the event.from postcondition: the only time
when an empty event set is returned is when the timeout has fired.
Previously empty sets could be triggered by the race:

1.     object is modified
2. event.from sees the modification
3.     object is destroyed
4. event.from cannot find the snapshot, omits the modify event

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
quicktest: add a test case for parallel calls to event.from

Sophisticated clients like CloudStack will issue parallel calls to
event.from, looking for different conditions. These calls should
not interfere.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Add nice Xapi_event .mli

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Merge pull request #1722 from djs55/fix-events.from-trunk

Fix races in events.from and add a test case (master edition)
Fix event.next after EVENTS_LOST

When recording the id of the latest dropped event, we need to sort the list of
ids as integers. Unfortunately in the forward port of the events.from patch from
clearwater-lcm-sp1 I accidentally sorted the list of ids as strings.

- : bool = false

- : bool = true

This corrupts the stored id, resulting in multiple EVENTS_LOST where only one
is expected.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Merge pull request #1724 from djs55/fix-event.next

Fix event.next after EVENTS_LOST
Merge pull request #1721 from djs55/experiment

Increase mock-friendliness