CI-44: Add an extra field "originator" to session object.

This is a key string used for distinguishing different API users sharing the same login name.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: Add the originator param to XAPI session creation

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: update internal uses of login_with_password with the originator param

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: update external components and tests with the new originator param

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: Add max_sessions_per_originator config

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: update session create/destory rbac audit functions

Based on some previous patches from Thomas Sanders.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: it seems making better sense to expire tasks before sessions

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: add max_sessions_per_user_name config variable

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: expire sessions based on username/originator specific quota

Based on some previous patches by Thomas Sanders.

The current algorithm is implemented as follows:

  * For sessions with their own auth_user_name (other than "root"/""), they will use their independent session quota (Xapi_globs.max_sessions_per_user_name) grouped by their auth_user_name. This can happen in following cases:
    - The session creator uses an external authentication method where the username is not the default
    - The session creator is logged in as local super user (hence no username/password authentication required) but still chooses to pass an independent username argument in purpose (e.g. vmpr, sm)

  * Sessions without independent auth_user_name (e.g. without RBAC, most external API users will have to share the same super user login) can still distiguish themselves using the new "originator" param during session creation. For sessions created with the optional "originator" argument, they will use their independent session quota (Xapi_globs.max_sessions_per_originator) grouped by their originator key.

  * All the rest sessions are in the common session pool, as before, sharing the default session quota (Xapi_globs.max_sessions). Among them, internal sessions will have higher prioirty than the external ones.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-4322: Remove license check from VM lifecycle operations

Signed-off-by: John Else <john.else@citrix.com>
CP-4273: Remove Hotfix_apply licensing feature

It will instead be added to the list of additional features defined in
v6d.

Signed-off-by: John Else <john.else@citrix.com>
CP-4318: Handle v6d not running when creating software_version

Signed-off-by: John Else <john.else@citrix.com>
CP-4318: Fall back to free edition if v6d is not running at startup

Signed-off-by: John Else <john.else@citrix.com>
CP-4319: Detect socket count in v6client.ml

Sending the socket count in the params list to V6client.apply_edition is
a bad idea, since this function also sends the current
Host.license_params, which may also contain the socket count, to v6d.

Instead, we update the license_params map with the socket count before
sending it to v6d.

This also means that the correct socket count is sent to v6d at xapi
startup.

Signed-off-by: John Else <john.else@citrix.com>
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-102927: network monitor: better represent duplex mode for NIC bonds

For bonds, "duplex" is now defined as the "minimum" duplex of all bond
members that are up, where "half duplex" < "full duplex". If all members
are down, duplex is "unknown".

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
CA-102927: xe: when a PIF's carrier is down, report duplex as "unknown"

The PIF_metrics.duplex field in the DB is a Boolean, where "true" means
"full duplex" and "false" can either mean "half duplex" or "duplex unknown".

For links that are down, duplex used to be reported as "half", which is silly.

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>