diff --git a/XenModel/XenAPI/LVHD.cs b/XenModel/XenAPI/LVHD.cs new file mode 100644 index 000000000..455589bc0 --- /dev/null +++ b/XenModel/XenAPI/LVHD.cs @@ -0,0 +1,200 @@ +/* + * Copyright (c) Citrix Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1) Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2) Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * 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. + */ + + +using System; +using System.Collections; +using System.Collections.Generic; + +using CookComputing.XmlRpc; + + +namespace XenAPI +{ + /// + /// LVHD SR specific operations + /// First published in XenServer Dundee. + /// + public partial class LVHD : XenObject + { + public LVHD() + { + } + + public LVHD(string uuid) + { + this.uuid = uuid; + } + + /// + /// Creates a new LVHD from a Proxy_LVHD. + /// + /// + public LVHD(Proxy_LVHD proxy) + { + this.UpdateFromProxy(proxy); + } + + public override void UpdateFrom(LVHD update) + { + uuid = update.uuid; + } + + internal void UpdateFromProxy(Proxy_LVHD proxy) + { + uuid = proxy.uuid == null ? null : (string)proxy.uuid; + } + + public Proxy_LVHD ToProxy() + { + Proxy_LVHD result_ = new Proxy_LVHD(); + result_.uuid = (uuid != null) ? uuid : ""; + return result_; + } + + /// + /// Creates a new LVHD from a Hashtable. + /// + /// + public LVHD(Hashtable table) + { + uuid = Marshalling.ParseString(table, "uuid"); + } + + public bool DeepEquals(LVHD other) + { + if (ReferenceEquals(null, other)) + return false; + if (ReferenceEquals(this, other)) + return true; + + return Helper.AreEqual2(this._uuid, other._uuid); + } + + public override string SaveChanges(Session session, string opaqueRef, LVHD server) + { + if (opaqueRef == null) + { + System.Diagnostics.Debug.Assert(false, "Cannot create instances of this type on the server"); + return ""; + } + else + { + throw new InvalidOperationException("This type has no read/write properties"); + } + } + /// + /// Get a record containing the current state of the given LVHD. + /// First published in XenServer Dundee. + /// + /// The session + /// The opaque_ref of the given lvhd + public static LVHD get_record(Session session, string _lvhd) + { + return new LVHD((Proxy_LVHD)session.proxy.lvhd_get_record(session.uuid, (_lvhd != null) ? _lvhd : "").parse()); + } + + /// + /// Get a reference to the LVHD instance with the specified UUID. + /// First published in XenServer Dundee. + /// + /// The session + /// UUID of object to return + public static XenRef get_by_uuid(Session session, string _uuid) + { + return XenRef.Create(session.proxy.lvhd_get_by_uuid(session.uuid, (_uuid != null) ? _uuid : "").parse()); + } + + /// + /// Get the uuid field of the given LVHD. + /// First published in XenServer Dundee. + /// + /// The session + /// The opaque_ref of the given lvhd + public static string get_uuid(Session session, string _lvhd) + { + return (string)session.proxy.lvhd_get_uuid(session.uuid, (_lvhd != null) ? _lvhd : "").parse(); + } + + /// + /// Upgrades an LVHD SR to enable thin-provisioning. Future VDIs created in this SR will be thinly-provisioned, although existing VDIs will be left alone. Note that the SR must be attached to the SRmaster for upgrade to work. + /// First published in XenServer Dundee. + /// + /// The session + /// The LVHD SR to upgrade to being thin-provisioned. + /// The initial amount of space to allocate to a newly-created VDI in bytes + /// The amount of space to allocate to a VDI when it needs to be enlarged in bytes + public static void enable_thin_provisioning(Session session, string _sr, long _initial_allocation, long _allocation_quantum) + { + session.proxy.lvhd_enable_thin_provisioning(session.uuid, (_sr != null) ? _sr : "", _initial_allocation.ToString(), _allocation_quantum.ToString()).parse(); + } + + /// + /// Upgrades an LVHD SR to enable thin-provisioning. Future VDIs created in this SR will be thinly-provisioned, although existing VDIs will be left alone. Note that the SR must be attached to the SRmaster for upgrade to work. + /// First published in XenServer Dundee. + /// + /// The session + /// The LVHD SR to upgrade to being thin-provisioned. + /// The initial amount of space to allocate to a newly-created VDI in bytes + /// The amount of space to allocate to a VDI when it needs to be enlarged in bytes + public static XenRef async_enable_thin_provisioning(Session session, string _sr, long _initial_allocation, long _allocation_quantum) + { + return XenRef.Create(session.proxy.async_lvhd_enable_thin_provisioning(session.uuid, (_sr != null) ? _sr : "", _initial_allocation.ToString(), _allocation_quantum.ToString()).parse()); + } + + /// + /// Get all the LVHD Records at once, in a single XML RPC call + /// First published in XenServer Dundee. + /// + /// The session + public static Dictionary, LVHD> get_all_records(Session session) + { + return XenRef.Create(session.proxy.lvhd_get_all_records(session.uuid).parse()); + } + + /// + /// Unique identifier/object reference + /// + public virtual string uuid + { + get { return _uuid; } + set + { + if (!Helper.AreEqual(value, _uuid)) + { + _uuid = value; + Changed = true; + NotifyPropertyChanged("uuid"); + } + } + } + private string _uuid; + } +} diff --git a/XenModel/XenAPI/Proxy.cs b/XenModel/XenAPI/Proxy.cs index 910237b64..a15552842 100644 --- a/XenModel/XenAPI/Proxy.cs +++ b/XenModel/XenAPI/Proxy.cs @@ -5024,6 +5024,30 @@ namespace XenAPI Response sr_get_all_records(string session); + [XmlRpcMethod("LVHD.get_record")] + Response + lvhd_get_record(string session, string _lvhd); + + [XmlRpcMethod("LVHD.get_by_uuid")] + Response + lvhd_get_by_uuid(string session, string _uuid); + + [XmlRpcMethod("LVHD.get_uuid")] + Response + lvhd_get_uuid(string session, string _lvhd); + + [XmlRpcMethod("LVHD.enable_thin_provisioning")] + Response + lvhd_enable_thin_provisioning(string session, string _sr, string _initial_allocation, string _allocation_quantum); + + [XmlRpcMethod("Async.LVHD.enable_thin_provisioning")] + Response + async_lvhd_enable_thin_provisioning(string session, string _sr, string _initial_allocation, string _allocation_quantum); + + [XmlRpcMethod("LVHD.get_all_records")] + Response + lvhd_get_all_records(string session); + [XmlRpcMethod("VDI.get_record")] Response vdi_get_record(string session, string _vdi); @@ -7272,6 +7296,12 @@ namespace XenAPI public string introduced_by; } + [XmlRpcMissingMapping(MappingAction.Ignore)] + public class Proxy_LVHD + { + public string uuid; + } + [XmlRpcMissingMapping(MappingAction.Ignore)] public class Proxy_VDI {