Example #1
0
        public Response <string> create(string session, Proxy_VBD vbd)
        {
            string opaque_ref = createObj("vbd", vbd).Value;

            plug(session, opaque_ref);
            return(new Response <string>(opaque_ref));
        }
Example #2
0
        public Proxy_VBD ToProxy()
        {
            Proxy_VBD result_ = new Proxy_VBD();

            result_.uuid = (uuid != null) ? uuid : "";
            result_.allowed_operations = (allowed_operations != null) ? Helper.ObjectListToStringArray(allowed_operations) : new string[] {};
            result_.current_operations = Maps.convert_to_proxy_string_vbd_operations(current_operations);
            result_.VM                       = (VM != null) ? VM : "";
            result_.VDI                      = (VDI != null) ? VDI : "";
            result_.device                   = (device != null) ? device : "";
            result_.userdevice               = (userdevice != null) ? userdevice : "";
            result_.bootable                 = bootable;
            result_.mode                     = vbd_mode_helper.ToString(mode);
            result_.type                     = vbd_type_helper.ToString(type);
            result_.unpluggable              = unpluggable;
            result_.storage_lock             = storage_lock;
            result_.empty                    = empty;
            result_.other_config             = Maps.convert_to_proxy_string_string(other_config);
            result_.currently_attached       = currently_attached;
            result_.status_code              = status_code.ToString();
            result_.status_detail            = (status_detail != null) ? status_detail : "";
            result_.runtime_properties       = Maps.convert_to_proxy_string_string(runtime_properties);
            result_.qos_algorithm_type       = (qos_algorithm_type != null) ? qos_algorithm_type : "";
            result_.qos_algorithm_params     = Maps.convert_to_proxy_string_string(qos_algorithm_params);
            result_.qos_supported_algorithms = qos_supported_algorithms;
            result_.metrics                  = (metrics != null) ? metrics : "";
            return(result_);
        }
Example #3
0
        internal void UpdateFromProxy(Proxy_VBD proxy)
        {
            uuid = proxy.uuid == null ? null : (string)proxy.uuid;
            allowed_operations = proxy.allowed_operations == null ? null : Helper.StringArrayToEnumList <vbd_operations>(proxy.allowed_operations);
            current_operations = proxy.current_operations == null ? null : Maps.convert_from_proxy_string_vbd_operations(proxy.current_operations);
            VM = proxy.VM == null ? null : XenRef <VM> .Create(proxy.VM);

            VDI = proxy.VDI == null ? null : XenRef <VDI> .Create(proxy.VDI);

            device                   = proxy.device == null ? null : (string)proxy.device;
            userdevice               = proxy.userdevice == null ? null : (string)proxy.userdevice;
            bootable                 = (bool)proxy.bootable;
            mode                     = proxy.mode == null ? (vbd_mode)0 : (vbd_mode)Helper.EnumParseDefault(typeof(vbd_mode), (string)proxy.mode);
            type                     = proxy.type == null ? (vbd_type)0 : (vbd_type)Helper.EnumParseDefault(typeof(vbd_type), (string)proxy.type);
            unpluggable              = (bool)proxy.unpluggable;
            storage_lock             = (bool)proxy.storage_lock;
            empty                    = (bool)proxy.empty;
            other_config             = proxy.other_config == null ? null : Maps.convert_from_proxy_string_string(proxy.other_config);
            currently_attached       = (bool)proxy.currently_attached;
            status_code              = proxy.status_code == null ? 0 : long.Parse((string)proxy.status_code);
            status_detail            = proxy.status_detail == null ? null : (string)proxy.status_detail;
            runtime_properties       = proxy.runtime_properties == null ? null : Maps.convert_from_proxy_string_string(proxy.runtime_properties);
            qos_algorithm_type       = proxy.qos_algorithm_type == null ? null : (string)proxy.qos_algorithm_type;
            qos_algorithm_params     = proxy.qos_algorithm_params == null ? null : Maps.convert_from_proxy_string_string(proxy.qos_algorithm_params);
            qos_supported_algorithms = proxy.qos_supported_algorithms == null ? new string[] {} : (string [])proxy.qos_supported_algorithms;
            metrics                  = proxy.metrics == null ? null : XenRef <VBD_metrics> .Create(proxy.metrics);
        }
Example #4
0
        public override string SaveChanges(Session session, string opaqueRef, VBD server)
        {
            if (opaqueRef == null)
            {
                Proxy_VBD p = this.ToProxy();
                return(session.proxy.vbd_create(session.uuid, p).parse());
            }
            else
            {
                if (!Helper.AreEqual2(_userdevice, server._userdevice))
                {
                    VBD.set_userdevice(session, opaqueRef, _userdevice);
                }
                if (!Helper.AreEqual2(_bootable, server._bootable))
                {
                    VBD.set_bootable(session, opaqueRef, _bootable);
                }
                if (!Helper.AreEqual2(_mode, server._mode))
                {
                    VBD.set_mode(session, opaqueRef, _mode);
                }
                if (!Helper.AreEqual2(_type, server._type))
                {
                    VBD.set_type(session, opaqueRef, _type);
                }
                if (!Helper.AreEqual2(_unpluggable, server._unpluggable))
                {
                    VBD.set_unpluggable(session, opaqueRef, _unpluggable);
                }
                if (!Helper.AreEqual2(_other_config, server._other_config))
                {
                    VBD.set_other_config(session, opaqueRef, _other_config);
                }
                if (!Helper.AreEqual2(_qos_algorithm_type, server._qos_algorithm_type))
                {
                    VBD.set_qos_algorithm_type(session, opaqueRef, _qos_algorithm_type);
                }
                if (!Helper.AreEqual2(_qos_algorithm_params, server._qos_algorithm_params))
                {
                    VBD.set_qos_algorithm_params(session, opaqueRef, _qos_algorithm_params);
                }

                return(null);
            }
        }
Example #5
0
 /// <summary>
 /// Creates a new VBD from a Proxy_VBD.
 /// </summary>
 /// <param name="proxy"></param>
 public VBD(Proxy_VBD proxy)
 {
     this.UpdateFromProxy(proxy);
 }