Package org.opennebula.client.datastore
Class Datastore
java.lang.Object
org.opennebula.client.PoolElement
org.opennebula.client.datastore.Datastore
This class represents an OpenNebula datastore.
It also offers static XML-RPC call wrappers.
-
Field Summary
Fields inherited from class org.opennebula.client.PoolElement
client, id, xml, xpath
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OneResponse
Allocates a new Datastore in OpenNebula.static OneResponse
Allocates a new Datastore in OpenNebula.chgrp
(int gid) Changes the groupchmod
(int octet) Changes the permissionschmod
(int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a) Changes the datastore permissionsChanges the permissionsstatic OneResponse
Changes the permissionsstatic OneResponse
chmod
(Client client, int id, int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a) Changes the datastore permissionsstatic OneResponse
Changes the permissionschown
(int uid) Changes the ownerchown
(int uid, int gid) Changes the owner/groupstatic OneResponse
Changes the owner/groupboolean
contains
(int id) Returns whether or not the image is part of this datastoredelete()
Deletes the datastore from OpenNebula.static OneResponse
Deletes a datastore from OpenNebula.disable()
Disables the datastore.enable()
Enables the datastore.enable
(boolean enable) Enables or disables the datastore.static OneResponse
Enables or disables this Datastore.info()
Retrieves the information of the Datastore.static OneResponse
Retrieves the information of the given Datastore.static OneResponse
Retrieves the information of the given Datastore.publish()
Publishes the datastore.publish
(boolean publish) Publishes or unpublishes the datastore.static OneResponse
Publishes or unpublishes a datastore.Renames this Datastorestatic OneResponse
Renames this Datastore.Returns the state of the Datastore as a short String.Returns the type of the Datastore as a short String.int
state()
Returns the state of the Datastore.stateStr()
Returns the state of the Datastore as a String.int
type()
Returns the type of the Datastore.typeStr()
Returns the type of the Datastore as a String.Unpublishes the datastore.Replaces the datastore template.Replaces the datastore template.static OneResponse
Replaces the datastore contents.
-
Constructor Details
-
Datastore
Creates a new Datastore representation.- Parameters:
id
- The datastore id.client
- XML-RPC Client.
-
Datastore
- See Also:
-
-
Method Details
-
allocate
Allocates a new Datastore in OpenNebula.- Parameters:
client
- XML-RPC Client.description
- A string containing the template of the datastore.clusterId
- Id of the cluster. If it is -1, this datastore won't be added to any cluster.- Returns:
- If successful the message contains the associated id generated for this Datastore.
-
allocate
Allocates a new Datastore in OpenNebula.- Parameters:
client
- XML-RPC Client.description
- A string containing the template of the datastore.- Returns:
- If successful the message contains the associated id generated for this Datastore.
-
info
Retrieves the information of the given Datastore.- Parameters:
client
- XML-RPC Client.id
- The datastore id to retrieve the information from- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
info
Retrieves the information of the given Datastore.- Parameters:
client
- XML-RPC Client.id
- The Datastore id for the Datastore to retrieve the information fromdecrypt
- If true decrypt sensitive attributes- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
delete
Deletes a datastore from OpenNebula.- Parameters:
client
- XML-RPC Client.id
- The id of the target datastore we want to delete.- Returns:
- A encapsulated response.
-
update
Replaces the datastore contents.- Parameters:
client
- XML-RPC Client.id
- The id of the target datastore we want to modify.new_template
- New datastore contents.append
- True to append new attributes instead of replace the whole template- Returns:
- If successful the message contains the datastore id.
-
publish
Publishes or unpublishes a datastore.- Parameters:
client
- XML-RPC Client.id
- The id of the target datastore we want to modify.publish
- True for publishing, false for unpublishing.- Returns:
- If successful the message contains the datastore id.
-
chown
Changes the owner/group- Parameters:
client
- XML-RPC Client.id
- The id of the target datastore we want to modify.uid
- The new owner user ID. Set it to -1 to leave the current one.gid
- The new group ID. Set it to -1 to leave the current one.- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public static OneResponse chmod(Client client, int id, int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a) Changes the datastore permissions- Parameters:
client
- XML-RPC Client.id
- The id of the target datastore.owner_u
- 1 to allow, 0 deny, -1 do not changeowner_m
- 1 to allow, 0 deny, -1 do not changeowner_a
- 1 to allow, 0 deny, -1 do not changegroup_u
- 1 to allow, 0 deny, -1 do not changegroup_m
- 1 to allow, 0 deny, -1 do not changegroup_a
- 1 to allow, 0 deny, -1 do not changeother_u
- 1 to allow, 0 deny, -1 do not changeother_m
- 1 to allow, 0 deny, -1 do not changeother_a
- 1 to allow, 0 deny, -1 do not change- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
client
- XML-RPC Client.id
- The id of the target object.octet
- Permissions octet, e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
client
- XML-RPC Client.id
- The id of the target object.octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
rename
Renames this Datastore.- Parameters:
client
- XML-RPC Client.id
- The id of the target object.name
- New name for the Datastore- Returns:
- If successful the message contains the datastore id.
-
enable
Enables or disables this Datastore.- Parameters:
client
- XML-RPC Client.id
- The id of the target object.enable
- True for enabling, false for disabling.- Returns:
- If successful the message contains the datastore id.
-
info
Retrieves the information of the Datastore.- Returns:
- If successful the message contains the string with the information returned by OpenNebula.
-
delete
Deletes the datastore from OpenNebula.- Returns:
- A encapsulated response.
-
update
Replaces the datastore template.- Parameters:
new_template
- New datastore template.- Returns:
- If successful the message contains the datastore id.
-
update
Replaces the datastore template.- Parameters:
new_template
- New datastore template.append
- True to append new attributes instead of replace the whole template- Returns:
- If successful the message contains the datastore id.
-
publish
Publishes or unpublishes the datastore.- Parameters:
publish
- True for publishing, false for unpublishing.- Returns:
- If successful the message contains the datastore id.
-
publish
Publishes the datastore.- Returns:
- If successful the message contains the datastore id.
-
unpublish
Unpublishes the datastore.- Returns:
- If successful the message contains the datastore id.
-
chown
Changes the owner/group- Parameters:
uid
- The new owner user ID. Set it to -1 to leave the current one.gid
- The new group ID. Set it to -1 to leave the current one.- Returns:
- If an error occurs the error message contains the reason.
-
chown
Changes the owner- Parameters:
uid
- The new owner user ID.- Returns:
- If an error occurs the error message contains the reason.
-
chgrp
Changes the group- Parameters:
gid
- The new group ID.- Returns:
- If an error occurs the error message contains the reason.
-
chmod
public OneResponse chmod(int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a) Changes the datastore permissions- Parameters:
owner_u
- 1 to allow, 0 deny, -1 do not changeowner_m
- 1 to allow, 0 deny, -1 do not changeowner_a
- 1 to allow, 0 deny, -1 do not changegroup_u
- 1 to allow, 0 deny, -1 do not changegroup_m
- 1 to allow, 0 deny, -1 do not changegroup_a
- 1 to allow, 0 deny, -1 do not changeother_u
- 1 to allow, 0 deny, -1 do not changeother_m
- 1 to allow, 0 deny, -1 do not changeother_a
- 1 to allow, 0 deny, -1 do not change- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
chmod
Changes the permissions- Parameters:
octet
- Permissions octed , e.g. 640- Returns:
- If an error occurs the error message contains the reason.
-
rename
Renames this Datastore- Parameters:
name
- New name for the Datastore.- Returns:
- If an error occurs the error message contains the reason.
-
enable
Enables or disables the datastore.- Parameters:
enable
- True for enabling, false for disabling.- Returns:
- If successful the message contains the datastore id.
-
enable
Enables the datastore.- Returns:
- If successful the message contains the datastore id.
-
disable
Disables the datastore.- Returns:
- If successful the message contains the datastore id.
-
type
public int type()Returns the type of the Datastore.- Returns:
- The type of the Datastore.
-
typeStr
Returns the type of the Datastore as a String.- Returns:
- The type of the Datastore as a String.
-
shortTypeStr
Returns the type of the Datastore as a short String.- Returns:
- The type of the Datastore as a short String.
-
state
public int state()Returns the state of the Datastore.- Overrides:
state
in classPoolElement
- Returns:
- The state of the Datastore.
-
stateStr
Returns the state of the Datastore as a String.- Returns:
- The state of the Datastore as a String.
-
shortStateStr
Returns the state of the Datastore as a short String.- Returns:
- The state of the Datastore as a short String.
-
contains
public boolean contains(int id) Returns whether or not the image is part of this datastore- Parameters:
id
- The image ID.- Returns:
- Whether or not the image is part of this datastore.
-