CA-86883: Detach SR if SR.destroy fails

The storage backend can destroy an SR only if it is attached.
Therefore when xapi wants to destroy an SR, first it attaches it.
When the backend destroys the SR it is no longer attached.

This change adds exception handling so that if the backend fails
to destroy the SR, xapi will detach it.
CA-46110 Tab completion on xe-switch-network-backend
CA-102855: Gateway PIF was not set properly when creating bond while management disabled

This is fixed by ensuring that, during a bond create or destroy, when the IP config is
move from bond slave to master or vice versa, only one of the PIFs has IP config.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
CA-102753: Fix import handler to respect HTTP content-length

This fix stops gzip waiting for more input by closing the connection to it.
This also fixes the import_metadata handler by closing the connection when
done.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CA-102753: Loosen requirement for content-length HTTP header on import.

There are times when we cannot know this ahead of time and so this should be an
optional argument.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CA-99179: Patches XAPI to allow clients to stop XAPI from generating
a udhcpd config file that includes advertising dom0's IP as
the default gateway for the network.

When using the host internal management network with Windows VMs
the network adapter will be allocated a high metric based on its speed,
and so traffic to unkown destinations may be routed via Dom0.

Signed-off-by: Rob Dobson <rob@rdobson.co.uk>
CA-99179: Adding an API for configuring the udhcp server in Dom0.

Signed-off-by: Rob Dobson <rob@rdobson.co.uk>
Ensure (by mutex) that only one "stunnel restart" runs at a time

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Xapi_http: don't retry binding if kernel does not support protocol

In other words: do not waste time retrying binding to an IPv6 address
if the kernel does not support IPv6.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
CP-4460: Auto generate code for API messages marked as removed.

... there are also small tweaks to the formatter to make the generated code look nicer.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-4460: mark WLB related API fields/messages as deprecated/removed.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-4460: hide WLB's CLI cmdlet

According to the PR-1632 requirement, all WLB's API and CLI should remain and return a feature no longer available error message.

As such, we won't remove the CLI cmdlets implementation. Instead, we hide them from bash completion, to reduce their chances of being used. If a WLB related cmdlet is still called, the feature unavailable error will be eventually generated by API layer and pop through.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-4460: remove WLB report/diagnose retrieve web services

and the corresponding cmdlets don't use API, so they need to return the feature removal error themselves.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-4460: Remove the internal implementation of WLB interfacing components

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-4460: getter/setter/ctor/dtor etc. should inherit the lifecyle values from their corresponding fields/objects

so that when a field/object type is marked as removed, these implicit methods will reject clients with clear error message.

Note that, object/field/method types maked as removed will remain exist/effective in the DB layer, as they are also necceary in the case of upgrade (from previous releases).

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-4460: clear WLB metadata from DB during upgrade

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-4460: Cleanup some debug code

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-4146: Allow individual disabling of serial port emulation on toolstack
We can disable serial port emulation by:
- xe vm-param-set uuid=<vm_uuid> platform:hvm_serial=none
- xe vm-param-set uuid=<vm_uuid> other-config:hvm_serial=none

The platform flag gets precedence over the other_config flag.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>
CP-4460: Add some nonconvential WLB "API" back to datamodel

There are not standard API messages, but web services and errors. They don't have a concept of API "lifecycle" like the standard ones, so we can't simply mark them as "deprecated" or "removed" and take advantage of the logic in our code autogeneration engine.

Instead of removing them, we have to keep the stubs around for the following reasons:

  * SDK auto generates some binding parts out of them (as well)
  * And, XenCenter will compile with a single version of API bindings and use it talk with different versions of XenServer (hence those binding stubs have to be a superset of all the historic versions we currently support).

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-4460: substitute trunk-specific elements with the clearwater equivalents

Unfortunately the original pull request duplicated from trunk contains some trunk specific elements which are non-exist in clearwater. This changeset should fix it.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>