Example #1
0
 /// <summary>
 /// Get the VCPUs/CPU field of the given VM_metrics.
 /// First published in XenServer 4.0.
 /// </summary>
 /// <param name="session">The session</param>
 /// <param name="_vm_metrics">The opaque_ref of the given vm_metrics</param>
 public static Dictionary <long, long> get_VCPUs_CPU(Session session, string _vm_metrics)
 {
     if (session.JsonRpcClient != null)
     {
         return(session.JsonRpcClient.vm_metrics_get_vcpus_cpu(session.opaque_ref, _vm_metrics));
     }
     else
     {
         return(Maps.convert_from_proxy_long_long(session.proxy.vm_metrics_get_vcpus_cpu(session.opaque_ref, _vm_metrics ?? "").parse()));
     }
 }
Example #2
0
 internal void UpdateFromProxy(Proxy_VM_metrics proxy)
 {
     uuid              = proxy.uuid == null ? null : (string)proxy.uuid;
     memory_actual     = proxy.memory_actual == null ? 0 : long.Parse((string)proxy.memory_actual);
     VCPUs_number      = proxy.VCPUs_number == null ? 0 : long.Parse((string)proxy.VCPUs_number);
     VCPUs_utilisation = proxy.VCPUs_utilisation == null ? null : Maps.convert_from_proxy_long_double(proxy.VCPUs_utilisation);
     VCPUs_CPU         = proxy.VCPUs_CPU == null ? null : Maps.convert_from_proxy_long_long(proxy.VCPUs_CPU);
     VCPUs_params      = proxy.VCPUs_params == null ? null : Maps.convert_from_proxy_string_string(proxy.VCPUs_params);
     VCPUs_flags       = proxy.VCPUs_flags == null ? null : Maps.convert_from_proxy_long_string_array(proxy.VCPUs_flags);
     state             = proxy.state == null ? new string[] {} : (string [])proxy.state;
     start_time        = proxy.start_time;
     install_time      = proxy.install_time;
     last_updated      = proxy.last_updated;
     other_config      = proxy.other_config == null ? null : Maps.convert_from_proxy_string_string(proxy.other_config);
 }
Example #3
0
 /// <summary>
 /// Creates a new VM_metrics from a Hashtable.
 /// </summary>
 /// <param name="table"></param>
 public VM_metrics(Hashtable table)
 {
     uuid              = Marshalling.ParseString(table, "uuid");
     memory_actual     = Marshalling.ParseLong(table, "memory_actual");
     VCPUs_number      = Marshalling.ParseLong(table, "VCPUs_number");
     VCPUs_utilisation = Maps.convert_from_proxy_long_double(Marshalling.ParseHashTable(table, "VCPUs_utilisation"));
     VCPUs_CPU         = Maps.convert_from_proxy_long_long(Marshalling.ParseHashTable(table, "VCPUs_CPU"));
     VCPUs_params      = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "VCPUs_params"));
     VCPUs_flags       = Maps.convert_from_proxy_long_string_array(Marshalling.ParseHashTable(table, "VCPUs_flags"));
     state             = Marshalling.ParseStringArray(table, "state");
     start_time        = Marshalling.ParseDateTime(table, "start_time");
     install_time      = Marshalling.ParseDateTime(table, "install_time");
     last_updated      = Marshalling.ParseDateTime(table, "last_updated");
     other_config      = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "other_config"));
 }
Example #4
0
 internal void UpdateFromProxy(Proxy_VM_metrics proxy)
 {
     uuid              = proxy.uuid == null ? null : proxy.uuid;
     memory_actual     = proxy.memory_actual == null ? 0 : long.Parse(proxy.memory_actual);
     VCPUs_number      = proxy.VCPUs_number == null ? 0 : long.Parse(proxy.VCPUs_number);
     VCPUs_utilisation = proxy.VCPUs_utilisation == null ? null : Maps.convert_from_proxy_long_double(proxy.VCPUs_utilisation);
     VCPUs_CPU         = proxy.VCPUs_CPU == null ? null : Maps.convert_from_proxy_long_long(proxy.VCPUs_CPU);
     VCPUs_params      = proxy.VCPUs_params == null ? null : Maps.convert_from_proxy_string_string(proxy.VCPUs_params);
     VCPUs_flags       = proxy.VCPUs_flags == null ? null : Maps.convert_from_proxy_long_string_array(proxy.VCPUs_flags);
     state             = proxy.state == null ? new string[] {} : (string [])proxy.state;
     start_time        = proxy.start_time;
     install_time      = proxy.install_time;
     last_updated      = proxy.last_updated;
     other_config      = proxy.other_config == null ? null : Maps.convert_from_proxy_string_string(proxy.other_config);
     hvm                 = (bool)proxy.hvm;
     nested_virt         = (bool)proxy.nested_virt;
     nomigrate           = (bool)proxy.nomigrate;
     current_domain_type = proxy.current_domain_type == null ? (domain_type)0 : (domain_type)Helper.EnumParseDefault(typeof(domain_type), (string)proxy.current_domain_type);
 }
Example #5
0
 /// <summary>
 /// Given a Hashtable with field-value pairs, it updates the fields of this VM_metrics
 /// 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("memory_actual"))
     {
         memory_actual = Marshalling.ParseLong(table, "memory_actual");
     }
     if (table.ContainsKey("VCPUs_number"))
     {
         VCPUs_number = Marshalling.ParseLong(table, "VCPUs_number");
     }
     if (table.ContainsKey("VCPUs_utilisation"))
     {
         VCPUs_utilisation = Maps.convert_from_proxy_long_double(Marshalling.ParseHashTable(table, "VCPUs_utilisation"));
     }
     if (table.ContainsKey("VCPUs_CPU"))
     {
         VCPUs_CPU = Maps.convert_from_proxy_long_long(Marshalling.ParseHashTable(table, "VCPUs_CPU"));
     }
     if (table.ContainsKey("VCPUs_params"))
     {
         VCPUs_params = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "VCPUs_params"));
     }
     if (table.ContainsKey("VCPUs_flags"))
     {
         VCPUs_flags = Maps.convert_from_proxy_long_string_array(Marshalling.ParseHashTable(table, "VCPUs_flags"));
     }
     if (table.ContainsKey("state"))
     {
         state = Marshalling.ParseStringArray(table, "state");
     }
     if (table.ContainsKey("start_time"))
     {
         start_time = Marshalling.ParseDateTime(table, "start_time");
     }
     if (table.ContainsKey("install_time"))
     {
         install_time = Marshalling.ParseDateTime(table, "install_time");
     }
     if (table.ContainsKey("last_updated"))
     {
         last_updated = Marshalling.ParseDateTime(table, "last_updated");
     }
     if (table.ContainsKey("other_config"))
     {
         other_config = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "other_config"));
     }
     if (table.ContainsKey("hvm"))
     {
         hvm = Marshalling.ParseBool(table, "hvm");
     }
     if (table.ContainsKey("nested_virt"))
     {
         nested_virt = Marshalling.ParseBool(table, "nested_virt");
     }
     if (table.ContainsKey("nomigrate"))
     {
         nomigrate = Marshalling.ParseBool(table, "nomigrate");
     }
     if (table.ContainsKey("current_domain_type"))
     {
         current_domain_type = (domain_type)Helper.EnumParseDefault(typeof(domain_type), Marshalling.ParseString(table, "current_domain_type"));
     }
 }
Example #6
0
 /// <summary>
 /// Get the VCPUs/CPU field of the given VM_metrics.
 /// First published in XenServer 4.0.
 /// </summary>
 /// <param name="session">The session</param>
 /// <param name="_vm_metrics">The opaque_ref of the given vm_metrics</param>
 public static Dictionary <long, long> get_VCPUs_CPU(Session session, string _vm_metrics)
 {
     return(Maps.convert_from_proxy_long_long(session.proxy.vm_metrics_get_vcpus_cpu(session.uuid, _vm_metrics ?? "").parse()));
 }