Package com.xensource.xenapi
Class Task
java.lang.Object
com.xensource.xenapi.XenAPIObject
com.xensource.xenapi.Task
A long-running asynchronous task
First published in XenServer 4.0.
- Author:
- Cloud Software Group, Inc.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToOtherConfig
(Connection c, String key, String value) Add the given key-value pair to the other_config field of the given task.void
cancel
(Connection c) Request that a task be cancelled.Request that a task be cancelled.static Task
create
(Connection c, String label, String description) Create a new task object which must be manually destroyed.void
Destroy the task object Minimum allowed role: read-only First published in XenServer 4.0.boolean
If obj is a Task, compares XenAPI references for equality.getAll
(Connection c) Return a list of all the tasks known to the system.Get the allowed_operations field of the given task.static Map<Task,
Task.Record> Return a map of task references to task records for all tasks known to the system.Get the backtrace field of the given task.getByNameLabel
(Connection c, String label) Get all the task instances with the given label.static Task
getByUuid
(Connection c, String uuid) Get a reference to the task instance with the specified UUID.Get the created field of the given task.Get the current_operations field of the given task.Get the error_info field of the given task.Get the finished field of the given task.Get the name/description field of the given task.Get the name/label field of the given task.Get the other_config field of the given task.Get the progress field of the given task.Get a record containing the current state of the given task.Get the resident_on field of the given task.Get the result field of the given task.Get the status field of the given task.Get the subtask_of field of the given task.Get the subtasks field of the given task.Get the type field of the given task.Get the uuid field of the given task.int
hashCode()
void
removeFromOtherConfig
(Connection c, String key) Remove the given key and its corresponding value from the other_config field of the given task.void
setErrorInfo
(Connection c, Set<String> value) Set the task error info Minimum allowed role: read-only First published in 21.3.0.void
setOtherConfig
(Connection c, Map<String, String> otherConfig) Set the other_config field of the given task.void
setProgress
(Connection c, Double value) Set the task progress Minimum allowed role: read-only First published in Citrix Hypervisor 8.2.void
setResult
(Connection c, String value) Set the task result Minimum allowed role: read-only First published in 21.3.0.void
setStatus
(Connection c, Types.TaskStatusType value) Set the task status Minimum allowed role: read-only First published in XenServer 7.2.Methods inherited from class com.xensource.xenapi.XenAPIObject
isNull
-
Field Details
-
ref
The XenAPI reference (OpaqueRef) to this object.
-
-
Method Details
-
toWireString
- Specified by:
toWireString
in classXenAPIObject
- Returns:
- The XenAPI reference (OpaqueRef) to this object.
-
equals
If obj is a Task, compares XenAPI references for equality. -
hashCode
public int hashCode() -
getRecord
public Task.Record getRecord(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get a record containing the current state of the given task. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- all fields from the object
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getByUuid
public static Task getByUuid(Connection c, String uuid) throws Types.BadServerResponse, Types.XenAPIException, IOException Get a reference to the task instance with the specified UUID. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made onuuid
- UUID of object to return- Returns:
- reference to the object
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getByNameLabel
public static Set<Task> getByNameLabel(Connection c, String label) throws Types.BadServerResponse, Types.XenAPIException, IOException Get all the task instances with the given label. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made onlabel
- label of object to return- Returns:
- references to objects with matching names
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getUuid
public String getUuid(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the uuid field of the given task. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getNameLabel
public String getNameLabel(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the name/label field of the given task. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getNameDescription
public String getNameDescription(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the name/description field of the given task. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getAllowedOperations
public Set<Types.TaskAllowedOperations> getAllowedOperations(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the allowed_operations field of the given task. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getCurrentOperations
public Map<String,Types.TaskAllowedOperations> getCurrentOperations(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the current_operations field of the given task. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getCreated
public Date getCreated(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the created field of the given task. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getFinished
public Date getFinished(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the finished field of the given task. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getStatus
public Types.TaskStatusType getStatus(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the status field of the given task. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getResidentOn
public Host getResidentOn(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the resident_on field of the given task. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getProgress
public Double getProgress(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the progress field of the given task. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getType
public String getType(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the type field of the given task. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getResult
public String getResult(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the result field of the given task. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getErrorInfo
public Set<String> getErrorInfo(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the error_info field of the given task. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getOtherConfig
public Map<String,String> getOtherConfig(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the other_config field of the given task. Minimum allowed role: read-only First published in XenServer 4.1.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getSubtaskOf
public Task getSubtaskOf(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the subtask_of field of the given task. Minimum allowed role: read-only First published in XenServer 5.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getSubtasks
public Set<Task> getSubtasks(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the subtasks field of the given task. Minimum allowed role: read-only First published in XenServer 5.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getBacktrace
public String getBacktrace(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Get the backtrace field of the given task. Minimum allowed role: read-only First published in XenServer 7.0.- Parameters:
c
- The connection the call is made on- Returns:
- value of the field
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
setOtherConfig
public void setOtherConfig(Connection c, Map<String, String> otherConfig) throws Types.BadServerResponse, Types.XenAPIException, IOExceptionSet the other_config field of the given task. Minimum allowed role: pool-operator First published in XenServer 4.1.- Parameters:
c
- The connection the call is made onotherConfig
- New value to set- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
addToOtherConfig
public void addToOtherConfig(Connection c, String key, String value) throws Types.BadServerResponse, Types.XenAPIException, IOException Add the given key-value pair to the other_config field of the given task. Minimum allowed role: pool-operator First published in XenServer 4.1.- Parameters:
c
- The connection the call is made onkey
- Key to addvalue
- Value to add- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
removeFromOtherConfig
public void removeFromOtherConfig(Connection c, String key) throws Types.BadServerResponse, Types.XenAPIException, IOException Remove the given key and its corresponding value from the other_config field of the given task. If the key is not in that Map, then do nothing. Minimum allowed role: pool-operator First published in XenServer 4.1.- Parameters:
c
- The connection the call is made onkey
- Key to remove- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
create
public static Task create(Connection c, String label, String description) throws Types.BadServerResponse, Types.XenAPIException, IOException Create a new task object which must be manually destroyed. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made onlabel
- short label for the new taskdescription
- longer description for the new task- Returns:
- The reference of the created task object
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
destroy
public void destroy(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Destroy the task object Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
cancel
public void cancel(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException, Types.OperationNotAllowed Request that a task be cancelled. Note that a task may fail to be cancelled and may complete or fail normally and note that, even when a task does cancel, it might take an arbitrary amount of time. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.Types.OperationNotAllowed
- You attempted an operation that was not allowed.
-
cancelAsync
public Task cancelAsync(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException, Types.OperationNotAllowed Request that a task be cancelled. Note that a task may fail to be cancelled and may complete or fail normally and note that, even when a task does cancel, it might take an arbitrary amount of time. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- Task
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.Types.OperationNotAllowed
- You attempted an operation that was not allowed.
-
setStatus
public void setStatus(Connection c, Types.TaskStatusType value) throws Types.BadServerResponse, Types.XenAPIException, IOException Set the task status Minimum allowed role: read-only First published in XenServer 7.2.- Parameters:
c
- The connection the call is made onvalue
- task status value to be set- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
setProgress
public void setProgress(Connection c, Double value) throws Types.BadServerResponse, Types.XenAPIException, IOException Set the task progress Minimum allowed role: read-only First published in Citrix Hypervisor 8.2.- Parameters:
c
- The connection the call is made onvalue
- Task progress value to be set- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
setResult
public void setResult(Connection c, String value) throws Types.BadServerResponse, Types.XenAPIException, IOException Set the task result Minimum allowed role: read-only First published in 21.3.0.- Parameters:
c
- The connection the call is made onvalue
- Task result to be set- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
setErrorInfo
public void setErrorInfo(Connection c, Set<String> value) throws Types.BadServerResponse, Types.XenAPIException, IOException Set the task error info Minimum allowed role: read-only First published in 21.3.0.- Parameters:
c
- The connection the call is made onvalue
- Task error info to be set- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getAll
public static Set<Task> getAll(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Return a list of all the tasks known to the system. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- references to all objects
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-
getAllRecords
public static Map<Task,Task.Record> getAllRecords(Connection c) throws Types.BadServerResponse, Types.XenAPIException, IOException Return a map of task references to task records for all tasks known to the system. Minimum allowed role: read-only First published in XenServer 4.0.- Parameters:
c
- The connection the call is made on- Returns:
- records of all objects
- Throws:
Types.BadServerResponse
- Thrown if the response from the server contains an invalid status.Types.XenAPIException
- if the call failed.IOException
- if an error occurs during a send or receive. This includes cases where a payload is invalid JSON.
-