Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 49 additions & 29 deletions CommonFunctions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ open Datamodel_types
module DT = Datamodel_types

let rec list_distinct list =
match list with
| [] -> []
match list with
| [] -> []
| [x] -> [x]
| hd1::(hd2::_ as tl) -> if hd1 = hd2 then list_distinct tl
else hd1::(list_distinct tl)
Expand All @@ -54,9 +54,9 @@ and list_index_of x list =
with Not_found -> -1

and list_is_empty list =
match list with
| [] -> true
| _ -> false
match list with
| [] -> true
| _ -> false

let rec gen_param_groups_for_releases releaseOrder params =
match releaseOrder with
Expand All @@ -74,6 +74,7 @@ and get_method_params_list message =
else List.tl message.msg_params

and gen_param_groups message params =
let expRelease = get_prototyped_release message.msg_lifecycle in
let msgRelease = get_first_release message.msg_release.internal in
let msgReleaseIndex = list_index_of msgRelease DT.release_order in
let paramGroups = gen_param_groups_for_releases DT.release_order params in
Expand All @@ -85,27 +86,30 @@ and gen_param_groups message params =
valid::(getValid tl)
in
let filteredGroups = List.filter (fun x -> match x with | [] -> false | _ -> true) (getValid paramGroups) in
list_distinct filteredGroups
if (not (expRelease = "")) then
[params]
else
list_distinct filteredGroups

and get_release_name release =
if release = rel_rio then "XenServer 4.0"
else if release = rel_miami then "XenServer 4.1"
else if release = rel_symc then "XenServer 4.1.1"
else if release = rel_orlando then "XenServer 5.0"
else if release = rel_orlando_update_1 then "XenServer 5.0 Update 1"
else if release = rel_george then "XenServer 5.5"
else if release = rel_midnight_ride then "XenServer 5.6"
else if release = rel_cowley then "XenServer 5.6 FP1"
else if release = rel_boston then "XenServer 6.0"
else if release = rel_tampa then "XenServer 6.1"
else if release = rel_clearwater then "XenServer 6.2"
else if release = rel_vgpu_tech_preview then "XenServer 6.2 SP1 Tech-Preview"
else if release = rel_vgpu_productisation then "XenServer 6.2 SP1"
else if release = rel_augusta then "Unreleased"
else ""
if release = rel_rio then "XenServer 4.0"
else if release = rel_miami then "XenServer 4.1"
else if release = rel_symc then "XenServer 4.1.1"
else if release = rel_orlando then "XenServer 5.0"
else if release = rel_orlando_update_1 then "XenServer 5.0 Update 1"
else if release = rel_george then "XenServer 5.5"
else if release = rel_midnight_ride then "XenServer 5.6"
else if release = rel_cowley then "XenServer 5.6 FP1"
else if release = rel_boston then "XenServer 6.0"
else if release = rel_tampa then "XenServer 6.1"
else if release = rel_clearwater then "XenServer 6.2"
else if release = rel_vgpu_tech_preview then "XenServer 6.2 SP1 Tech-Preview"
else if release = rel_vgpu_productisation then "XenServer 6.2 SP1"
else if release = rel_clearwater_felton then "XenServer 6.2 SP1 Hotfix XS62ESP1004"
else ""

and get_first_release releases =
let filtered = List.filter (fun x -> List.mem x releases) DT.release_order in
let filtered = List.filter (fun x -> List.mem x releases) DT.release_order in
match filtered with
| [] -> ""
| hd::tl -> hd
Expand All @@ -114,34 +118,50 @@ and get_first_release_string release =
if release = "" then ""
else sprintf "First published in %s." (get_release_name release)

and get_prototyped_release lifecycle =
match lifecycle with
| [Prototyped, release, doc] -> release
| _ -> ""

and get_prototyped_release_string lifecycle =
match lifecycle with
| [Prototyped, release, doc] -> "Experimental. "^(get_first_release_string release)
| _ -> ""

and get_published_info_message message cls =
let expRelease = get_prototyped_release_string message.msg_lifecycle in
let clsRelease = get_first_release cls.obj_release.internal in
let msgRelease = get_first_release message.msg_release.internal in
let clsReleaseIndex = list_index_of clsRelease DT.release_order in
let msgReleaseIndex = list_index_of msgRelease DT.release_order in
if (not (clsReleaseIndex = -1)) && (not (msgReleaseIndex = -1)) && (clsReleaseIndex < msgReleaseIndex) then
let msgReleaseIndex = list_index_of msgRelease DT.release_order in
if (not (expRelease = "")) then
expRelease
else if (not (clsReleaseIndex = -1)) && (not (msgReleaseIndex = -1)) && (clsReleaseIndex < msgReleaseIndex) then
get_first_release_string msgRelease
else
get_first_release_string clsRelease

and get_published_info_param message param =
let msgRelease = get_first_release message.msg_release.internal in
let paramRelease = get_first_release param.param_release.internal in
let msgRelease = get_first_release message.msg_release.internal in
let paramRelease = get_first_release param.param_release.internal in
let msgReleaseIndex = list_index_of msgRelease DT.release_order in
let paramReleaseIndex = list_index_of paramRelease DT.release_order in
if (not (msgReleaseIndex = -1)) && (not (paramReleaseIndex = -1)) && (msgReleaseIndex < paramReleaseIndex) then
get_first_release_string paramRelease
else ""
else ""

and get_published_info_class cls =
get_first_release_string (get_first_release cls.obj_release.internal)

and get_published_info_field field cls =
let expRelease = get_prototyped_release_string field.lifecycle in
let clsRelease = get_first_release cls.obj_release.internal in
let fieldRelease = get_first_release field.release.internal in
let clsReleaseIndex = list_index_of clsRelease DT.release_order in
let fieldReleaseIndex = list_index_of fieldRelease DT.release_order in
if (not (clsReleaseIndex = -1)) && (not (fieldReleaseIndex = -1)) && (clsReleaseIndex < fieldReleaseIndex) then
let fieldReleaseIndex = list_index_of fieldRelease DT.release_order in
if (not (expRelease = "")) then
expRelease
else if (not (clsReleaseIndex = -1)) && (not (fieldReleaseIndex = -1)) && (clsReleaseIndex < fieldReleaseIndex) then
get_first_release_string fieldRelease
else
""
Expand Down
27 changes: 27 additions & 0 deletions FriendlyErrorNames.resx
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,15 @@
<data name="FIELD_TYPE_ERROR" xml:space="preserve">
<value>One of the fields you supplied was of the wrong type.</value>
</data>
<data name="GPU_GROUP_CONTAINS_NO_PGPUS" xml:space="preserve">
<value>The GPU group does not contain any pGPUs.</value>
</data>
<data name="GPU_GROUP_CONTAINS_PGPU" xml:space="preserve">
<value>The GPU group contains active pGPUs and cannot be deleted.</value>
</data>
<data name="GPU_GROUP_CONTAINS_VGPU" xml:space="preserve">
<value>The GPU group contains active vGPUs and cannot be deleted.</value>
</data>
<data name="HANDLE_INVALID" xml:space="preserve">
<value>Object has been deleted.{0}:{1}</value>
</data>
Expand Down Expand Up @@ -474,6 +483,15 @@
<data name="PBD_EXISTS" xml:space="preserve">
<value>A PBD already exists connecting the SR to the server</value>
</data>
<data name="PGPU_INSUFFICIENT_CAPACITY_FOR_VGPU" xml:space="preserve">
<value>There is insufficient capacity on this pGPU to run the vGPU.</value>
</data>
<data name="PGPU_IN_USE_BY_VM" xml:space="preserve">
<value>This pGPU is currently in use by running VMs.</value>
</data>
<data name="PGPU_NOT_COMPATIBLE_WITH_GPU_GROUP" xml:space="preserve">
<value>pGPU type not compatible with destination group.</value>
</data>
<data name="PIF_ALREADY_BONDED" xml:space="preserve">
<value>You cannot create a bond of an interface which is a member of an existing bond.</value>
</data>
Expand Down Expand Up @@ -848,6 +866,15 @@ Authorized Roles: {1}</value>
<data name="VDI_READONLY" xml:space="preserve">
<value>The operation required write access but VDI {0} is read-only</value>
</data>
<data name="VGPU_TYPE_NOT_COMPATIBLE_WITH_RUNNING_TYPE" xml:space="preserve">
<value>vGPU type is not compatible with one or more of the vGPU types currently running on this pGPU</value>
</data>
<data name="VGPU_TYPE_NOT_ENABLED" xml:space="preserve">
<value>vGPU type is not one of the pGPU's enabled types.</value>
</data>
<data name="VGPU_TYPE_NOT_SUPPORTED" xml:space="preserve">
<value>vGPU type is not one of the pGPU's supported types.</value>
</data>
<data name="VIFS_MAX_ALLOWED" xml:space="preserve">
<value>You have reached the maximum number of virtual network interfaces allowed for this virtual machine.</value>
</data>
Expand Down
4 changes: 2 additions & 2 deletions OMakefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ CSHARP_GUI_TMP=$(BINDINGS_TMP)/XenCenterBindings/XenServer.NET
CSHARP_SAM_TMP=$(BINDINGS_TMP)/XenServer.NET-sam/XenServer.NET

OCAMLINCLUDES += .. $(DATAMODEL_DIR)
OCAMLFLAGS += -dtypes -I $(DATAMODEL_DIR) -thread
OCAMLPACKS += rpclib getopt xmlm xml-light2 uuid stdext xcp unix str
OCAMLFLAGS += -dtypes -I $(DATAMODEL_DIR)
OCAMLPACKS += getopt xmlm xml-light2 uuid stdext log unix str
OCAML_LIBS += $(DATAMODEL_DIR)/datamodel

.PHONY: clean dist
Expand Down
2 changes: 1 addition & 1 deletion c/OMakefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#

API_MAJOR=2
API_MINOR=0
API_MINOR=2
API_VER=$(API_MAJOR).$(API_MINOR)

C_GEN_FOLDER=$(BINDINGS_TMP)/c_gen
Expand Down
14 changes: 12 additions & 2 deletions c/xen_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ xen_api_version_to_string(xen_api_version version)
return "1.10";
case xen_api_version_2_0:
return "2.0";
case xen_api_version_2_1:
return "2.1";
case xen_api_version_2_2:
return "2.2";
default:
return "Unknown";
}
Expand Down Expand Up @@ -321,9 +325,15 @@ set_api_version(xen_session *session)

if (major_version == (int64_t)2)
{
if (minor_version == (int64_t)0)
if (minor_version == (int64_t)2)
session->api_version = xen_api_version_2_2;

else if (minor_version == (int64_t)1)
session->api_version = xen_api_version_2_1;

else if (minor_version == (int64_t)0)
session->api_version = xen_api_version_2_0;

else
session->api_version = xen_api_unknown_version;
}
Expand Down
4 changes: 3 additions & 1 deletion c/xen_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ typedef enum xen_api_version
xen_api_version_1_9 = 9,
xen_api_version_1_10 = 10,
xen_api_version_2_0 = 11,
xen_api_latest_version = 11,
xen_api_version_2_1 = 12,
xen_api_version_2_2 = 13,
xen_api_latest_version = 13,
xen_api_unknown_version = 99,
/* Also change xen_api_version_to_string() and set_api_version() in xen_common.c */
} xen_api_version;
Expand Down
8 changes: 7 additions & 1 deletion csharp/src/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ public enum API_Version
API_1_9 = 9, // XenServer 6.0 (Boston)
API_1_10 = 10, // XenServer 6.1 (Tampa)
API_2_0 = 11, // XenServer 6.2 (Clearwater)
LATEST = 11,
API_2_1 = 12, // XenServer 6.2 with vGPU (vGPU)
API_2_2 = 13, // XenServer 6.2 Hotfix XS62ESP1004 (Felton)
LATEST = 13,
// Don't forget to change LATEST above, and APIVersionString below.
UNKNOWN = 99
}
Expand Down Expand Up @@ -83,6 +85,10 @@ public static string APIVersionString(API_Version v)
return "1.10";
case API_Version.API_2_0:
return "2.0";
case API_Version.API_2_1:
return "2.1";
case API_Version.API_2_2:
return "2.2";
default:
return "Unknown";
}
Expand Down
23 changes: 0 additions & 23 deletions csharp/src/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,29 +278,6 @@ public void login_with_password(string username, string password, string version
}
}

public void login_with_password(string username, string password, string version, string originator)
{
try
{
_uuid = proxy.session_login_with_password(username, password, version, originator).parse();
SetAPIVersion();
if (APIVersion >= API_Version.API_1_6)
SetADDetails();
}
catch (Failure exn)
{
if (exn.ErrorDescription[0] == Failure.MESSAGE_PARAMETER_COUNT_MISMATCH)
{
// Call the pre-2.0 version instead.
login_with_password(username, password, version);
}
else
{
throw;
}
}
}

public void login_with_password(string username, string password, API_Version version)
{
login_with_password(username, password, Helper.APIVersionString(version));
Expand Down
2 changes: 1 addition & 1 deletion java/lib/Makefile.dist
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
# OF THE POSSIBILITY OF SUCH DAMAGE
# OF THE POSSIBILITY OF SUCH DAMAGE.
#

# Makefile to compile the Xen Java SDK bindings
Expand Down
Loading