Exemple #1
0
 /// <summary>
 /// Get the current_operations field of the given task.
 /// First published in XenServer 4.0.
 /// </summary>
 /// <param name="session">The session</param>
 /// <param name="_task">The opaque_ref of the given task</param>
 public static Dictionary <string, task_allowed_operations> get_current_operations(Session session, string _task)
 {
     if (session.JsonRpcClient != null)
     {
         return(session.JsonRpcClient.task_get_current_operations(session.opaque_ref, _task));
     }
     else
     {
         return(Maps.convert_from_proxy_string_task_allowed_operations(session.proxy.task_get_current_operations(session.opaque_ref, _task ?? "").parse()));
     }
 }
Exemple #2
0
 /// <summary>
 /// Creates a new Task from a Hashtable.
 /// </summary>
 /// <param name="table"></param>
 public Task(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 <task_allowed_operations>(Marshalling.ParseStringArray(table, "allowed_operations"));
     current_operations = Maps.convert_from_proxy_string_task_allowed_operations(Marshalling.ParseHashTable(table, "current_operations"));
     created            = Marshalling.ParseDateTime(table, "created");
     finished           = Marshalling.ParseDateTime(table, "finished");
     status             = (task_status_type)Helper.EnumParseDefault(typeof(task_status_type), Marshalling.ParseString(table, "status"));
     resident_on        = Marshalling.ParseRef <Host>(table, "resident_on");
     progress           = Marshalling.ParseDouble(table, "progress");
     type               = Marshalling.ParseString(table, "type");
     result             = Marshalling.ParseString(table, "result");
     error_info         = Marshalling.ParseStringArray(table, "error_info");
     other_config       = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "other_config"));
     subtask_of         = Marshalling.ParseRef <Task>(table, "subtask_of");
     subtasks           = Marshalling.ParseSetRef <Task>(table, "subtasks");
 }
Exemple #3
0
        internal void UpdateFromProxy(Proxy_Task 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 <task_allowed_operations>(proxy.allowed_operations);
            current_operations = proxy.current_operations == null ? null : Maps.convert_from_proxy_string_task_allowed_operations(proxy.current_operations);
            created            = proxy.created;
            finished           = proxy.finished;
            status             = proxy.status == null ? (task_status_type)0 : (task_status_type)Helper.EnumParseDefault(typeof(task_status_type), (string)proxy.status);
            resident_on        = proxy.resident_on == null ? null : XenRef <Host> .Create(proxy.resident_on);

            progress     = Convert.ToDouble(proxy.progress);
            type         = proxy.type == null ? null : (string)proxy.type;
            result       = proxy.result == null ? null : (string)proxy.result;
            error_info   = proxy.error_info == null ? new string[] {} : (string [])proxy.error_info;
            other_config = proxy.other_config == null ? null : Maps.convert_from_proxy_string_string(proxy.other_config);
            subtask_of   = proxy.subtask_of == null ? null : XenRef <Task> .Create(proxy.subtask_of);

            subtasks = proxy.subtasks == null ? null : XenRef <Task> .Create(proxy.subtasks);
        }
Exemple #4
0
 /// <summary>
 /// Get the current_operations field of the given task.
 /// First published in XenServer 4.0.
 /// </summary>
 /// <param name="session">The session</param>
 /// <param name="_task">The opaque_ref of the given task</param>
 public static Dictionary <string, task_allowed_operations> get_current_operations(Session session, string _task)
 {
     return(Maps.convert_from_proxy_string_task_allowed_operations(session.proxy.task_get_current_operations(session.uuid, (_task != null) ? _task : "").parse()));
 }
Exemple #5
0
 /// <summary>
 /// Given a Hashtable with field-value pairs, it updates the fields of this Task
 /// 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("allowed_operations"))
     {
         allowed_operations = Helper.StringArrayToEnumList <task_allowed_operations>(Marshalling.ParseStringArray(table, "allowed_operations"));
     }
     if (table.ContainsKey("current_operations"))
     {
         current_operations = Maps.convert_from_proxy_string_task_allowed_operations(Marshalling.ParseHashTable(table, "current_operations"));
     }
     if (table.ContainsKey("created"))
     {
         created = Marshalling.ParseDateTime(table, "created");
     }
     if (table.ContainsKey("finished"))
     {
         finished = Marshalling.ParseDateTime(table, "finished");
     }
     if (table.ContainsKey("status"))
     {
         status = (task_status_type)Helper.EnumParseDefault(typeof(task_status_type), Marshalling.ParseString(table, "status"));
     }
     if (table.ContainsKey("resident_on"))
     {
         resident_on = Marshalling.ParseRef <Host>(table, "resident_on");
     }
     if (table.ContainsKey("progress"))
     {
         progress = Marshalling.ParseDouble(table, "progress");
     }
     if (table.ContainsKey("type"))
     {
         type = Marshalling.ParseString(table, "type");
     }
     if (table.ContainsKey("result"))
     {
         result = Marshalling.ParseString(table, "result");
     }
     if (table.ContainsKey("error_info"))
     {
         error_info = Marshalling.ParseStringArray(table, "error_info");
     }
     if (table.ContainsKey("other_config"))
     {
         other_config = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "other_config"));
     }
     if (table.ContainsKey("subtask_of"))
     {
         subtask_of = Marshalling.ParseRef <Task>(table, "subtask_of");
     }
     if (table.ContainsKey("subtasks"))
     {
         subtasks = Marshalling.ParseSetRef <Task>(table, "subtasks");
     }
     if (table.ContainsKey("backtrace"))
     {
         backtrace = Marshalling.ParseString(table, "backtrace");
     }
 }