예제 #1
0
 /// <summary>
 /// Given a Hashtable with field-value pairs, it updates the fields of this SM
 /// with the values listed in the Hashtable. Note that only the fields contained
 /// in the Hashtable will be updated and the rest will remain the same.
 /// </summary>
 /// <param name="table"></param>
 public void UpdateFrom(Hashtable table)
 {
     if (table.ContainsKey("uuid"))
     {
         uuid = Marshalling.ParseString(table, "uuid");
     }
     if (table.ContainsKey("name_label"))
     {
         name_label = Marshalling.ParseString(table, "name_label");
     }
     if (table.ContainsKey("name_description"))
     {
         name_description = Marshalling.ParseString(table, "name_description");
     }
     if (table.ContainsKey("type"))
     {
         type = Marshalling.ParseString(table, "type");
     }
     if (table.ContainsKey("vendor"))
     {
         vendor = Marshalling.ParseString(table, "vendor");
     }
     if (table.ContainsKey("copyright"))
     {
         copyright = Marshalling.ParseString(table, "copyright");
     }
     if (table.ContainsKey("version"))
     {
         version = Marshalling.ParseString(table, "version");
     }
     if (table.ContainsKey("required_api_version"))
     {
         required_api_version = Marshalling.ParseString(table, "required_api_version");
     }
     if (table.ContainsKey("configuration"))
     {
         configuration = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "configuration"));
     }
     if (table.ContainsKey("capabilities"))
     {
         capabilities = Marshalling.ParseStringArray(table, "capabilities");
     }
     if (table.ContainsKey("features"))
     {
         features = Maps.convert_from_proxy_string_long(Marshalling.ParseHashTable(table, "features"));
     }
     if (table.ContainsKey("other_config"))
     {
         other_config = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "other_config"));
     }
     if (table.ContainsKey("driver_filename"))
     {
         driver_filename = Marshalling.ParseString(table, "driver_filename");
     }
     if (table.ContainsKey("required_cluster_stack"))
     {
         required_cluster_stack = Marshalling.ParseStringArray(table, "required_cluster_stack");
     }
 }
예제 #2
0
 /// <summary>
 /// Get the features field of the given SM.
 /// First published in XenServer 6.2.
 /// </summary>
 /// <param name="session">The session</param>
 /// <param name="_sm">The opaque_ref of the given sm</param>
 public static Dictionary <string, long> get_features(Session session, string _sm)
 {
     if (session.JsonRpcClient != null)
     {
         return(session.JsonRpcClient.sm_get_features(session.opaque_ref, _sm));
     }
     else
     {
         return(Maps.convert_from_proxy_string_long(session.proxy.sm_get_features(session.opaque_ref, _sm ?? "").parse()));
     }
 }
예제 #3
0
 /// <summary>
 /// Creates a new SM from a Hashtable.
 /// </summary>
 /// <param name="table"></param>
 public SM(Hashtable table)
 {
     uuid                 = Marshalling.ParseString(table, "uuid");
     name_label           = Marshalling.ParseString(table, "name_label");
     name_description     = Marshalling.ParseString(table, "name_description");
     type                 = Marshalling.ParseString(table, "type");
     vendor               = Marshalling.ParseString(table, "vendor");
     copyright            = Marshalling.ParseString(table, "copyright");
     version              = Marshalling.ParseString(table, "version");
     required_api_version = Marshalling.ParseString(table, "required_api_version");
     configuration        = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "configuration"));
     capabilities         = Marshalling.ParseStringArray(table, "capabilities");
     features             = Maps.convert_from_proxy_string_long(Marshalling.ParseHashTable(table, "features"));
     other_config         = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "other_config"));
     driver_filename      = Marshalling.ParseString(table, "driver_filename");
 }
예제 #4
0
 internal void UpdateFromProxy(Proxy_SM 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;
     type                 = proxy.type == null ? null : (string)proxy.type;
     vendor               = proxy.vendor == null ? null : (string)proxy.vendor;
     copyright            = proxy.copyright == null ? null : (string)proxy.copyright;
     version              = proxy.version == null ? null : (string)proxy.version;
     required_api_version = proxy.required_api_version == null ? null : (string)proxy.required_api_version;
     configuration        = proxy.configuration == null ? null : Maps.convert_from_proxy_string_string(proxy.configuration);
     capabilities         = proxy.capabilities == null ? new string[] {} : (string [])proxy.capabilities;
     features             = proxy.features == null ? null : Maps.convert_from_proxy_string_long(proxy.features);
     other_config         = proxy.other_config == null ? null : Maps.convert_from_proxy_string_string(proxy.other_config);
     driver_filename      = proxy.driver_filename == null ? null : (string)proxy.driver_filename;
 }
예제 #5
0
 /// <summary>
 /// Get the features field of the given SM.
 /// First published in XenServer 6.2.
 /// </summary>
 /// <param name="session">The session</param>
 /// <param name="_sm">The opaque_ref of the given sm</param>
 public static Dictionary <string, long> get_features(Session session, string _sm)
 {
     return(Maps.convert_from_proxy_string_long(session.proxy.sm_get_features(session.uuid, (_sm != null) ? _sm : "").parse()));
 }