Update the API bindings

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2018-11-22 12:23:37 +00:00 committed by Konstantina Chremmou
parent 243f3a209d
commit 3ddf69cd26
5 changed files with 146 additions and 4 deletions

View File

@ -59,7 +59,8 @@ namespace XenAPI
API_2_9 = 20, //XenServer 7.4 (jura)
API_2_10 = 21, //XenServer 7.5 (kolkata)
API_2_11 = 22, //XenServer 7.6 (lima)
LATEST = 22,
API_2_12 = 23, //Unreleased (naples)
LATEST = 23,
UNKNOWN = 99
}
@ -113,6 +114,8 @@ namespace XenAPI
return "2.10";
case API_Version.API_2_11:
return "2.11";
case API_Version.API_2_12:
return "2.12";
default:
return "Unknown";
}

View File

@ -2910,6 +2910,13 @@ namespace XenAPI
return Rpc<domain_type>("VM.get_domain_type", new JArray(session, _vm ?? ""), serializer);
}
public Dictionary<string, string> vm_get_nvram(string session, string _vm)
{
var converters = new List<JsonConverter> {new StringStringMapConverter()};
var serializer = CreateSerializer(converters);
return Rpc<Dictionary<string, string>>("VM.get_NVRAM", new JArray(session, _vm ?? ""), serializer);
}
public void vm_set_name_label(string session, string _vm, string _label)
{
var converters = new List<JsonConverter> {};
@ -3498,6 +3505,27 @@ namespace XenAPI
return Rpc<XenRef<Task>>("Async.VM.add_to_VCPUs_params_live", new JArray(session, _vm ?? "", _key ?? "", _value ?? ""), serializer);
}
public void vm_set_nvram(string session, string _vm, Dictionary<string, string> _value)
{
var converters = new List<JsonConverter> {new StringStringMapConverter()};
var serializer = CreateSerializer(converters);
Rpc("VM.set_NVRAM", new JArray(session, _vm ?? "", _value == null ? new JObject() : JObject.FromObject(_value, serializer)), serializer);
}
public void vm_add_to_nvram(string session, string _vm, string _key, string _value)
{
var converters = new List<JsonConverter> {};
var serializer = CreateSerializer(converters);
Rpc("VM.add_to_NVRAM", new JArray(session, _vm ?? "", _key ?? "", _value ?? ""), serializer);
}
public void vm_remove_from_nvram(string session, string _vm, string _key)
{
var converters = new List<JsonConverter> {};
var serializer = CreateSerializer(converters);
Rpc("VM.remove_from_NVRAM", new JArray(session, _vm ?? "", _key ?? ""), serializer);
}
public void vm_set_ha_restart_priority(string session, string _vm, string _value)
{
var converters = new List<JsonConverter> {};

View File

@ -1684,6 +1684,10 @@ namespace XenAPI
Response<string>
vm_get_domain_type(string session, string _vm);
[XmlRpcMethod("VM.get_NVRAM")]
Response<Object>
vm_get_nvram(string session, string _vm);
[XmlRpcMethod("VM.set_name_label")]
Response<string>
vm_set_name_label(string session, string _vm, string _label);
@ -2020,6 +2024,18 @@ namespace XenAPI
Response<string>
async_vm_add_to_vcpus_params_live(string session, string _vm, string _key, string _value);
[XmlRpcMethod("VM.set_NVRAM")]
Response<string>
vm_set_nvram(string session, string _vm, Object _value);
[XmlRpcMethod("VM.add_to_NVRAM")]
Response<string>
vm_add_to_nvram(string session, string _vm, string _key, string _value);
[XmlRpcMethod("VM.remove_from_NVRAM")]
Response<string>
vm_remove_from_nvram(string session, string _vm, string _key);
[XmlRpcMethod("VM.set_ha_restart_priority")]
Response<string>
vm_set_ha_restart_priority(string session, string _vm, string _value);
@ -8453,6 +8469,7 @@ namespace XenAPI
public bool requires_reboot;
public string reference_label;
public string domain_type;
public Object NVRAM;
}
[XmlRpcMissingMapping(MappingAction.Ignore)]

View File

@ -132,7 +132,8 @@ namespace XenAPI
bool has_vendor_device,
bool requires_reboot,
string reference_label,
domain_type domain_type)
domain_type domain_type,
Dictionary<string, string> NVRAM)
{
this.uuid = uuid;
this.allowed_operations = allowed_operations;
@ -218,6 +219,7 @@ namespace XenAPI
this.requires_reboot = requires_reboot;
this.reference_label = reference_label;
this.domain_type = domain_type;
this.NVRAM = NVRAM;
}
/// <summary>
@ -319,6 +321,7 @@ namespace XenAPI
requires_reboot = update.requires_reboot;
reference_label = update.reference_label;
domain_type = update.domain_type;
NVRAM = update.NVRAM;
}
internal void UpdateFromProxy(Proxy_VM proxy)
@ -407,6 +410,7 @@ namespace XenAPI
requires_reboot = (bool)proxy.requires_reboot;
reference_label = proxy.reference_label == null ? null : proxy.reference_label;
domain_type = proxy.domain_type == null ? (domain_type) 0 : (domain_type)Helper.EnumParseDefault(typeof(domain_type), (string)proxy.domain_type);
NVRAM = proxy.NVRAM == null ? null : Maps.convert_from_proxy_string_string(proxy.NVRAM);
}
public Proxy_VM ToProxy()
@ -496,6 +500,7 @@ namespace XenAPI
result_.requires_reboot = requires_reboot;
result_.reference_label = reference_label ?? "";
result_.domain_type = domain_type_helper.ToString(domain_type);
result_.NVRAM = Maps.convert_to_proxy_string_string(NVRAM);
return result_;
}
@ -686,6 +691,8 @@ namespace XenAPI
reference_label = Marshalling.ParseString(table, "reference_label");
if (table.ContainsKey("domain_type"))
domain_type = (domain_type)Helper.EnumParseDefault(typeof(domain_type), Marshalling.ParseString(table, "domain_type"));
if (table.ContainsKey("NVRAM"))
NVRAM = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "NVRAM"));
}
public bool DeepEquals(VM other, bool ignoreCurrentOperations)
@ -780,7 +787,8 @@ namespace XenAPI
Helper.AreEqual2(this._has_vendor_device, other._has_vendor_device) &&
Helper.AreEqual2(this._requires_reboot, other._requires_reboot) &&
Helper.AreEqual2(this._reference_label, other._reference_label) &&
Helper.AreEqual2(this._domain_type, other._domain_type);
Helper.AreEqual2(this._domain_type, other._domain_type) &&
Helper.AreEqual2(this._NVRAM, other._NVRAM);
}
internal static List<VM> ProxyArrayToObjectList(Proxy_VM[] input)
@ -973,6 +981,10 @@ namespace XenAPI
{
VM.set_domain_type(session, opaqueRef, _domain_type);
}
if (!Helper.AreEqual2(_NVRAM, server._NVRAM))
{
VM.set_NVRAM(session, opaqueRef, _NVRAM);
}
return null;
}
@ -2263,6 +2275,20 @@ namespace XenAPI
return (domain_type)Helper.EnumParseDefault(typeof(domain_type), (string)session.proxy.vm_get_domain_type(session.opaque_ref, _vm ?? "").parse());
}
/// <summary>
/// Get the NVRAM field of the given VM.
/// Experimental. First published in Unreleased.
/// </summary>
/// <param name="session">The session</param>
/// <param name="_vm">The opaque_ref of the given vm</param>
public static Dictionary<string, string> get_NVRAM(Session session, string _vm)
{
if (session.JsonRpcClient != null)
return session.JsonRpcClient.vm_get_nvram(session.opaque_ref, _vm);
else
return Maps.convert_from_proxy_string_string(session.proxy.vm_get_nvram(session.opaque_ref, _vm ?? "").parse());
}
/// <summary>
/// Set the name/label field of the given VM.
/// First published in XenServer 4.0.
@ -3527,6 +3553,52 @@ namespace XenAPI
return XenRef<Task>.Create(session.proxy.async_vm_add_to_vcpus_params_live(session.opaque_ref, _vm ?? "", _key ?? "", _value ?? "").parse());
}
/// <summary>
///
/// Experimental. First published in Unreleased.
/// </summary>
/// <param name="session">The session</param>
/// <param name="_vm">The opaque_ref of the given vm</param>
/// <param name="_value">The value</param>
public static void set_NVRAM(Session session, string _vm, Dictionary<string, string> _value)
{
if (session.JsonRpcClient != null)
session.JsonRpcClient.vm_set_nvram(session.opaque_ref, _vm, _value);
else
session.proxy.vm_set_nvram(session.opaque_ref, _vm ?? "", Maps.convert_to_proxy_string_string(_value)).parse();
}
/// <summary>
///
/// Experimental. First published in Unreleased.
/// </summary>
/// <param name="session">The session</param>
/// <param name="_vm">The opaque_ref of the given vm</param>
/// <param name="_key">The key</param>
/// <param name="_value">The value</param>
public static void add_to_NVRAM(Session session, string _vm, string _key, string _value)
{
if (session.JsonRpcClient != null)
session.JsonRpcClient.vm_add_to_nvram(session.opaque_ref, _vm, _key, _value);
else
session.proxy.vm_add_to_nvram(session.opaque_ref, _vm ?? "", _key ?? "", _value ?? "").parse();
}
/// <summary>
///
/// Experimental. First published in Unreleased.
/// </summary>
/// <param name="session">The session</param>
/// <param name="_vm">The opaque_ref of the given vm</param>
/// <param name="_key">The key</param>
public static void remove_from_NVRAM(Session session, string _vm, string _key)
{
if (session.JsonRpcClient != null)
session.JsonRpcClient.vm_remove_from_nvram(session.opaque_ref, _vm, _key);
else
session.proxy.vm_remove_from_nvram(session.opaque_ref, _vm ?? "", _key ?? "").parse();
}
/// <summary>
/// Set the value of the ha_restart_priority field
/// First published in XenServer 5.0.
@ -6704,5 +6776,25 @@ namespace XenAPI
}
}
private domain_type _domain_type = domain_type.unspecified;
/// <summary>
/// initial value for guest NVRAM (containing UEFI variables, etc). Cannot be changed while the VM is running
/// Experimental. First published in Unreleased.
/// </summary>
[JsonConverter(typeof(StringStringMapConverter))]
public virtual Dictionary<string, string> NVRAM
{
get { return _NVRAM; }
set
{
if (!Helper.AreEqual(value, _NVRAM))
{
_NVRAM = value;
Changed = true;
NotifyPropertyChanged("NVRAM");
}
}
}
private Dictionary<string, string> _NVRAM = new Dictionary<string, string>() {};
}
}

View File

@ -37,7 +37,7 @@ namespace XenAPI
[JsonConverter(typeof(vm_operationsConverter))]
public enum vm_operations
{
snapshot, clone, copy, create_template, revert, checkpoint, snapshot_with_quiesce, provision, start, start_on, pause, unpause, clean_shutdown, clean_reboot, hard_shutdown, power_state_reset, hard_reboot, suspend, csvm, resume, resume_on, pool_migrate, migrate_send, get_boot_record, send_sysrq, send_trigger, query_services, shutdown, call_plugin, changing_memory_live, awaiting_memory_live, changing_dynamic_range, changing_static_range, changing_memory_limits, changing_shadow_memory, changing_shadow_memory_live, changing_VCPUs, changing_VCPUs_live, assert_operation_valid, data_source_op, update_allowed_operations, make_into_template, import, export, metadata_export, reverting, destroy, unknown
snapshot, clone, copy, create_template, revert, checkpoint, snapshot_with_quiesce, provision, start, start_on, pause, unpause, clean_shutdown, clean_reboot, hard_shutdown, power_state_reset, hard_reboot, suspend, csvm, resume, resume_on, pool_migrate, migrate_send, get_boot_record, send_sysrq, send_trigger, query_services, shutdown, call_plugin, changing_memory_live, awaiting_memory_live, changing_dynamic_range, changing_static_range, changing_memory_limits, changing_shadow_memory, changing_shadow_memory_live, changing_VCPUs, changing_VCPUs_live, changing_NVRAM, assert_operation_valid, data_source_op, update_allowed_operations, make_into_template, import, export, metadata_export, reverting, destroy, unknown
}
public static class vm_operations_helper
@ -130,6 +130,8 @@ namespace XenAPI
return "changing_VCPUs";
case vm_operations.changing_VCPUs_live:
return "changing_VCPUs_live";
case vm_operations.changing_NVRAM:
return "changing_NVRAM";
case vm_operations.assert_operation_valid:
return "assert_operation_valid";
case vm_operations.data_source_op: