Пример #1
0
 /// <summary>
 /// Creates a new Network from a Hashtable.
 /// </summary>
 /// <param name="table"></param>
 public Network(Hashtable table)
 {
     uuid               = Marshalling.ParseString(table, "uuid");
     name_label         = Marshalling.ParseString(table, "name_label");
     name_description   = Marshalling.ParseString(table, "name_description");
     allowed_operations = Helper.StringArrayToEnumList <network_operations>(Marshalling.ParseStringArray(table, "allowed_operations"));
     current_operations = Maps.convert_from_proxy_string_network_operations(Marshalling.ParseHashTable(table, "current_operations"));
     VIFs               = Marshalling.ParseSetRef <VIF>(table, "VIFs");
     PIFs               = Marshalling.ParseSetRef <PIF>(table, "PIFs");
     MTU                  = Marshalling.ParseLong(table, "MTU");
     other_config         = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "other_config"));
     bridge               = Marshalling.ParseString(table, "bridge");
     blobs                = Maps.convert_from_proxy_string_XenRefBlob(Marshalling.ParseHashTable(table, "blobs"));
     tags                 = Marshalling.ParseStringArray(table, "tags");
     default_locking_mode = (network_default_locking_mode)Helper.EnumParseDefault(typeof(network_default_locking_mode), Marshalling.ParseString(table, "default_locking_mode"));
 }
Пример #2
0
        internal void UpdateFromProxy(Proxy_Network proxy)
        {
            uuid               = proxy.uuid == null ? null : (string)proxy.uuid;
            name_label         = proxy.name_label == null ? null : (string)proxy.name_label;
            name_description   = proxy.name_description == null ? null : (string)proxy.name_description;
            allowed_operations = proxy.allowed_operations == null ? null : Helper.StringArrayToEnumList <network_operations>(proxy.allowed_operations);
            current_operations = proxy.current_operations == null ? null : Maps.convert_from_proxy_string_network_operations(proxy.current_operations);
            VIFs               = proxy.VIFs == null ? null : XenRef <VIF> .Create(proxy.VIFs);

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

            MTU                  = proxy.MTU == null ? 0 : long.Parse((string)proxy.MTU);
            other_config         = proxy.other_config == null ? null : Maps.convert_from_proxy_string_string(proxy.other_config);
            bridge               = proxy.bridge == null ? null : (string)proxy.bridge;
            blobs                = proxy.blobs == null ? null : Maps.convert_from_proxy_string_XenRefBlob(proxy.blobs);
            tags                 = proxy.tags == null ? new string[] {} : (string [])proxy.tags;
            default_locking_mode = proxy.default_locking_mode == null ? (network_default_locking_mode)0 : (network_default_locking_mode)Helper.EnumParseDefault(typeof(network_default_locking_mode), (string)proxy.default_locking_mode);
        }
Пример #3
0
 /// <summary>
 /// Creates a new SR from a Hashtable.
 /// </summary>
 /// <param name="table"></param>
 public SR(Hashtable table)
 {
     uuid                 = Marshalling.ParseString(table, "uuid");
     name_label           = Marshalling.ParseString(table, "name_label");
     name_description     = Marshalling.ParseString(table, "name_description");
     allowed_operations   = Helper.StringArrayToEnumList <storage_operations>(Marshalling.ParseStringArray(table, "allowed_operations"));
     current_operations   = Maps.convert_from_proxy_string_storage_operations(Marshalling.ParseHashTable(table, "current_operations"));
     VDIs                 = Marshalling.ParseSetRef <VDI>(table, "VDIs");
     PBDs                 = Marshalling.ParseSetRef <PBD>(table, "PBDs");
     virtual_allocation   = Marshalling.ParseLong(table, "virtual_allocation");
     physical_utilisation = Marshalling.ParseLong(table, "physical_utilisation");
     physical_size        = Marshalling.ParseLong(table, "physical_size");
     type                 = Marshalling.ParseString(table, "type");
     content_type         = Marshalling.ParseString(table, "content_type");
     shared               = Marshalling.ParseBool(table, "shared");
     other_config         = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "other_config"));
     tags                 = Marshalling.ParseStringArray(table, "tags");
     sm_config            = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "sm_config"));
     blobs                = Maps.convert_from_proxy_string_XenRefBlob(Marshalling.ParseHashTable(table, "blobs"));
     local_cache_enabled  = Marshalling.ParseBool(table, "local_cache_enabled");
     introduced_by        = Marshalling.ParseRef <DR_task>(table, "introduced_by");
 }
Пример #4
0
        internal void UpdateFromProxy(Proxy_SR proxy)
        {
            uuid               = proxy.uuid == null ? null : (string)proxy.uuid;
            name_label         = proxy.name_label == null ? null : (string)proxy.name_label;
            name_description   = proxy.name_description == null ? null : (string)proxy.name_description;
            allowed_operations = proxy.allowed_operations == null ? null : Helper.StringArrayToEnumList <storage_operations>(proxy.allowed_operations);
            current_operations = proxy.current_operations == null ? null : Maps.convert_from_proxy_string_storage_operations(proxy.current_operations);
            VDIs               = proxy.VDIs == null ? null : XenRef <VDI> .Create(proxy.VDIs);

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

            virtual_allocation   = proxy.virtual_allocation == null ? 0 : long.Parse((string)proxy.virtual_allocation);
            physical_utilisation = proxy.physical_utilisation == null ? 0 : long.Parse((string)proxy.physical_utilisation);
            physical_size        = proxy.physical_size == null ? 0 : long.Parse((string)proxy.physical_size);
            type                = proxy.type == null ? null : (string)proxy.type;
            content_type        = proxy.content_type == null ? null : (string)proxy.content_type;
            shared              = (bool)proxy.shared;
            other_config        = proxy.other_config == null ? null : Maps.convert_from_proxy_string_string(proxy.other_config);
            tags                = proxy.tags == null ? new string[] {} : (string [])proxy.tags;
            sm_config           = proxy.sm_config == null ? null : Maps.convert_from_proxy_string_string(proxy.sm_config);
            blobs               = proxy.blobs == null ? null : Maps.convert_from_proxy_string_XenRefBlob(proxy.blobs);
            local_cache_enabled = (bool)proxy.local_cache_enabled;
            introduced_by       = proxy.introduced_by == null ? null : XenRef <DR_task> .Create(proxy.introduced_by);
        }
Пример #5
0
 /// <summary>
 /// Get the blobs field of the given network.
 /// First published in XenServer 5.0.
 /// </summary>
 /// <param name="session">The session</param>
 /// <param name="_network">The opaque_ref of the given network</param>
 public static Dictionary <string, XenRef <Blob> > get_blobs(Session session, string _network)
 {
     return(Maps.convert_from_proxy_string_XenRefBlob(session.proxy.network_get_blobs(session.uuid, _network ?? "").parse()));
 }
Пример #6
0
 public static Dictionary <string, XenRef <Blob> > get_blobs(Session session, string _sr)
 {
     return(Maps.convert_from_proxy_string_XenRefBlob(session.proxy.sr_get_blobs(session.uuid, (_sr != null) ? _sr : "").parse()));
 }