From 97fbc1bb4e5f624ab726087e1883015ced6c9e24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carlos=20Mart=C3=ADn?=
+ * assumed to be at $ONE_AUTH, and the endpoint will be set to $ONE_XMLRPC.
* It is the equivalent of Client(null, null).
*
* @throws ClientConfigurationException
diff --git a/src/oca/java/src/org/opennebula/client/Pool.java b/src/oca/java/src/org/opennebula/client/Pool.java
index 2a6dfb2f85..7d4a7fd62d 100644
--- a/src/oca/java/src/org/opennebula/client/Pool.java
+++ b/src/oca/java/src/org/opennebula/client/Pool.java
@@ -21,6 +21,10 @@ import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
@@ -40,6 +44,8 @@ public abstract class Pool{
protected String infoMethod;
protected NodeList poolElements;
+ protected static XPath xpath;
+
/**
* All resources in the pool
*/
@@ -67,6 +73,12 @@ public abstract class Pool{
this.elementName = elementName;
this.infoMethod = infoMethod;
this.client = client;
+
+ if(xpath == null)
+ {
+ XPathFactory factory = XPathFactory.newInstance();
+ xpath = factory.newXPath();
+ }
}
/**
@@ -171,11 +183,12 @@ public abstract class Pool{
new ByteArrayInputStream(info.getMessage().getBytes()));
xml = doc.getDocumentElement();
- poolElements = xml.getElementsByTagName(elementName);
+ poolElements = (NodeList) xpath.evaluate(elementName, xml, XPathConstants.NODESET);
}
catch (ParserConfigurationException e) {}
catch (SAXException e) {}
catch (IOException e) {}
+ catch (XPathExpressionException e) {}
}
/**
diff --git a/src/oca/java/src/org/opennebula/client/acl/Acl.java b/src/oca/java/src/org/opennebula/client/acl/Acl.java
index 7d9e96adc5..ae526c54c7 100644
--- a/src/oca/java/src/org/opennebula/client/acl/Acl.java
+++ b/src/oca/java/src/org/opennebula/client/acl/Acl.java
@@ -28,10 +28,10 @@ import org.w3c.dom.Node;
/**
* This class represents an OpenNebula ACL rule.
* It also offers static XML-RPC call wrappers.
- *
+ *
* There is not a public constructor, because the information for an individual
* ACL rule cannot be retrieved from OpenNebula.
- *
+ *
* Instead, Acl objects should be obtained using AclPool.getById, after the
* info method has been called.
*
diff --git a/src/oca/java/src/org/opennebula/client/datastore/Datastore.java b/src/oca/java/src/org/opennebula/client/datastore/Datastore.java
index 18dd3a0af6..0a11e6116f 100644
--- a/src/oca/java/src/org/opennebula/client/datastore/Datastore.java
+++ b/src/oca/java/src/org/opennebula/client/datastore/Datastore.java
@@ -73,7 +73,8 @@ public class Datastore extends PoolElement
*
* @param client XML-RPC Client.
* @param description A string containing the template of the datastore.
- * @param clusterId Id of the cluster
+ * @param clusterId Id of the cluster. If it is -1, this datastore
+ * won't be added to any cluster.
* @return If successful the message contains the associated
* id generated for this Datastore.
*/
diff --git a/src/oca/java/src/org/opennebula/client/document/Document.java b/src/oca/java/src/org/opennebula/client/document/Document.java
index 6ba8a2819f..2be7b40dcd 100644
--- a/src/oca/java/src/org/opennebula/client/document/Document.java
+++ b/src/oca/java/src/org/opennebula/client/document/Document.java
@@ -24,9 +24,9 @@ import org.w3c.dom.Node;
* This class represents an OpenNebula document.
* Documents are generic objects. You can dynamically create new Pools in
* OpenNebula, creating subclasses with different TYPE values.
- *
+ *
* TYPE must be the same for the corresponding pool, see {@link DocumentPool}
- *
+ *
* For example:
*
*
diff --git a/src/oca/java/src/org/opennebula/client/document/DocumentPool.java b/src/oca/java/src/org/opennebula/client/document/DocumentPool.java
index 81218d7d2d..04ff054f72 100644
--- a/src/oca/java/src/org/opennebula/client/document/DocumentPool.java
+++ b/src/oca/java/src/org/opennebula/client/document/DocumentPool.java
@@ -25,9 +25,9 @@ import org.opennebula.client.Pool;
*
*
@@ -111,7 +111,7 @@ public abstract class DocumentPool extends Pool
* {@link Pool#MINE}: Connected user's Documents
* {@link Pool#MINE_GROUP}: Connected user's Documents, and the ones in
* his group
- * >= 0: UID User's Documents
+ * >= 0 UID User's Documents
*
*/
public DocumentPool(Client client, int filter)
@@ -191,7 +191,7 @@ public abstract class DocumentPool extends Pool
* {@link Pool#MINE}: Connected user's Documents
* {@link Pool#MINE_GROUP}: Connected user's Documents, and the ones in
* his group
- * >= 0: UID User's Documents
+ * >= 0 UID User's Documents
*
* @param startId Lowest Id to retrieve
* @param endId Biggest Id to retrieve
diff --git a/src/oca/java/src/org/opennebula/client/host/Host.java b/src/oca/java/src/org/opennebula/client/host/Host.java
index ab5c597d2a..93e855102b 100644
--- a/src/oca/java/src/org/opennebula/client/host/Host.java
+++ b/src/oca/java/src/org/opennebula/client/host/Host.java
@@ -161,8 +161,7 @@ public class Host extends PoolElement{
*
* @param client XML-RPC Client.
* @param id The host id (hid) of the target machine.
- * @param enable If set true OpenNebula will enable the
- * target host, if set false it will disable it.
+ * @param status Host status
* @return A encapsulated response.
*/
public static OneResponse status(Client client, int id, Status status)
@@ -319,7 +318,7 @@ public class Host extends PoolElement{
/**
* Returns the state of the Host.
- *
+ *
* The method {@link Host#info()} must be called before.
*
* @return The state of the Host.
@@ -332,7 +331,7 @@ public class Host extends PoolElement{
/**
* Returns the short length string state of the Host.
- *
+ *
* The method {@link Host#info()} must be called before.
*
* @return The short length string state of the Host.
diff --git a/src/oca/java/src/org/opennebula/client/image/Image.java b/src/oca/java/src/org/opennebula/client/image/Image.java
index 665030136d..efa4caa8bc 100644
--- a/src/oca/java/src/org/opennebula/client/image/Image.java
+++ b/src/oca/java/src/org/opennebula/client/image/Image.java
@@ -85,8 +85,7 @@ public class Image extends PoolElement
*
* @param client XML-RPC Client.
* @param description A string containing the template of the image.
- * @param datastoreId The cluster ID. If it is -1, this image
- * won't be added to any cluster.
+ * @param datastoreId The Datastore ID
*
* @return If successful the message contains the associated
* id generated for this Image.
@@ -629,7 +628,7 @@ public class Image extends PoolElement
/**
* Returns the state of the Image.
- *
+ *
* The method {@link Image#info()} must be called before.
*
* @return The state of the Image.
@@ -642,7 +641,7 @@ public class Image extends PoolElement
/**
* Returns the short length string state of the Image.
- *
+ *
* The method {@link Image#info()} must be called before.
*
* @return The short length string state of the Image.
diff --git a/src/oca/java/src/org/opennebula/client/image/ImagePool.java b/src/oca/java/src/org/opennebula/client/image/ImagePool.java
index f55a34fa2a..d2b72bb166 100644
--- a/src/oca/java/src/org/opennebula/client/image/ImagePool.java
+++ b/src/oca/java/src/org/opennebula/client/image/ImagePool.java
@@ -61,7 +61,7 @@ public class ImagePool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Images
* {@link Pool#MINE_GROUP}: Connected user's Images, and the ones in
* his group
- * >= 0: UID User's Images
+ * >= 0 UID User's Images
*
*/
public ImagePool(Client client, int filter)
@@ -89,7 +89,7 @@ public class ImagePool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Images
* {@link Pool#MINE_GROUP}: Connected user's Images, and the ones in
* his group
- * >= 0: UID User's Images
+ * >= 0 UID User's Images
*
* @return If successful the message contains the string
* with the information returned by OpenNebula.
@@ -147,7 +147,7 @@ public class ImagePool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Images
* {@link Pool#MINE_GROUP}: Connected user's Images, and the ones in
* his group
- * >= 0: UID User's Images
+ * >= 0 UID User's Images
*
* @param startId Lowest Id to retrieve
* @param endId Biggest Id to retrieve
@@ -219,7 +219,7 @@ public class ImagePool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Images
* {@link Pool#MINE_GROUP}: Connected user's Images, and the ones in
* his group
- * >= 0: UID User's Images
+ * >= 0 UID User's Images
*
* @param startId Lowest Id to retrieve
* @param endId Biggest Id to retrieve
diff --git a/src/oca/java/src/org/opennebula/client/marketplace/MarketPlace.java b/src/oca/java/src/org/opennebula/client/marketplace/MarketPlace.java
new file mode 100644
index 0000000000..837e921084
--- /dev/null
+++ b/src/oca/java/src/org/opennebula/client/marketplace/MarketPlace.java
@@ -0,0 +1,350 @@
+/*******************************************************************************
+ * Copyright 2002-2016, OpenNebula Project, OpenNebula Systems
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.opennebula.client.marketplace;
+
+import org.opennebula.client.Client;
+import org.opennebula.client.OneResponse;
+import org.opennebula.client.PoolElement;
+import org.w3c.dom.Node;
+
+/**
+ * This class represents an OpenNebula MarketPlace.
+ * It also offers static XML-RPC call wrappers.
+ */
+public class MarketPlace extends PoolElement
+{
+
+ private static final String METHOD_PREFIX = "market.";
+ private static final String INFO = METHOD_PREFIX + "info";
+ private static final String ALLOCATE = METHOD_PREFIX + "allocate";
+ private static final String DELETE = METHOD_PREFIX + "delete";
+ private static final String UPDATE = METHOD_PREFIX + "update";
+ private static final String CHOWN = METHOD_PREFIX + "chown";
+ private static final String CHMOD = METHOD_PREFIX + "chmod";
+ private static final String RENAME = METHOD_PREFIX + "rename";
+
+ /**
+ * Creates a new MarketPlace representation.
+ * @param id The MarketPlace id.
+ * @param client XML-RPC Client.
+ */
+ public MarketPlace(int id, Client client)
+ {
+ super(id, client);
+ }
+
+ /**
+ * @see PoolElement
+ */
+ protected MarketPlace(Node xmlElement, Client client)
+ {
+ super(xmlElement, client);
+ }
+
+ // =================================
+ // Static XML-RPC methods
+ // =================================
+
+ /**
+ * Allocates a new MarketPlace in OpenNebula.
+ *
+ * @param client XML-RPC Client.
+ * @param description A string containing the template of the MarketPlace.
+ * @return If successful the message contains the associated
+ * id generated for this MarketPlace.
+ */
+ public static OneResponse allocate(Client client, String description)
+ {
+ return client.call(ALLOCATE, description);
+ }
+
+ /**
+ * Retrieves the information of the given MarketPlace.
+ *
+ * @param client XML-RPC Client.
+ * @param id The MarketPlace id to retrieve the information from
+ * @return If successful the message contains the string
+ * with the information returned by OpenNebula.
+ */
+ public static OneResponse info(Client client, int id)
+ {
+ return client.call(INFO, id);
+ }
+
+ /**
+ * Deletes a MarketPlace from OpenNebula.
+ *
+ * @param client XML-RPC Client.
+ * @param id The id of the target MarketPlace we want to delete.
+ * @return A encapsulated response.
+ */
+ public static OneResponse delete(Client client, int id)
+ {
+ return client.call(DELETE, id);
+ }
+
+ /**
+ * Replaces the MarketPlace contents.
+ *
+ * @param client XML-RPC Client.
+ * @param id The id of the target MarketPlace we want to modify.
+ * @param new_template New MarketPlace contents.
+ * @param append True to append new attributes instead of replace the whole template
+ * @return If successful the message contains the MarketPlace id.
+ */
+ public static OneResponse update(Client client, int id, String new_template,
+ boolean append)
+ {
+ return client.call(UPDATE, id, new_template, append ? 1 : 0);
+ }
+
+ /**
+ * Changes the owner/group
+ *
+ * @param client XML-RPC Client.
+ * @param id The id of the target MarketPlace we want to modify.
+ * @param uid The new owner user ID. Set it to -1 to leave the current one.
+ * @param gid The new group ID. Set it to -1 to leave the current one.
+ * @return If an error occurs the error message contains the reason.
+ */
+ public static OneResponse chown(Client client, int id, int uid, int gid)
+ {
+ return client.call(CHOWN, id, uid, gid);
+ }
+
+ /**
+ * Changes the MarketPlace permissions
+ *
+ * @param client XML-RPC Client.
+ * @param id The id of the target MarketPlace.
+ * @param owner_u 1 to allow, 0 deny, -1 do not change
+ * @param owner_m 1 to allow, 0 deny, -1 do not change
+ * @param owner_a 1 to allow, 0 deny, -1 do not change
+ * @param group_u 1 to allow, 0 deny, -1 do not change
+ * @param group_m 1 to allow, 0 deny, -1 do not change
+ * @param group_a 1 to allow, 0 deny, -1 do not change
+ * @param other_u 1 to allow, 0 deny, -1 do not change
+ * @param other_m 1 to allow, 0 deny, -1 do not change
+ * @param other_a 1 to allow, 0 deny, -1 do not change
+ * @return If an error occurs the error message contains the reason.
+ */
+ 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)
+ {
+ return chmod(client, CHMOD, id,
+ owner_u, owner_m, owner_a,
+ group_u, group_m, group_a,
+ other_u, other_m, other_a);
+ }
+
+ /**
+ * Changes the permissions
+ *
+ * @param client XML-RPC Client.
+ * @param id The id of the target object.
+ * @param octet Permissions octet, e.g. 640
+ * @return If an error occurs the error message contains the reason.
+ */
+ public static OneResponse chmod(Client client, int id, String octet)
+ {
+ return chmod(client, CHMOD, id, octet);
+ }
+
+ /**
+ * Changes the permissions
+ *
+ * @param client XML-RPC Client.
+ * @param id The id of the target object.
+ * @param octet Permissions octed , e.g. 640
+ * @return If an error occurs the error message contains the reason.
+ */
+ public static OneResponse chmod(Client client, int id, int octet)
+ {
+ return chmod(client, CHMOD, id, octet);
+ }
+
+ /**
+ * Renames this MarketPlace.
+ *
+ * @param client XML-RPC Client.
+ * @param id The id of the target object.
+ * @param name New name for the MarketPlace
+ * @return If successful the message contains the MarketPlace id.
+ */
+ public static OneResponse rename(Client client, int id, String name)
+ {
+ return client.call(RENAME, id, name);
+ }
+
+ // =================================
+ // Instanced object XML-RPC methods
+ // =================================
+
+ /**
+ * Retrieves the information of the MarketPlace.
+ *
+ * @return If successful the message contains the string
+ * with the information returned by OpenNebula.
+ */
+ public OneResponse info()
+ {
+ OneResponse response = info(client, id);
+ super.processInfo(response);
+ return response;
+ }
+
+ /**
+ * Deletes the MarketPlace from OpenNebula.
+ *
+ * @return A encapsulated response.
+ */
+ public OneResponse delete()
+ {
+ return delete(client, id);
+ }
+
+ /**
+ * Replaces the MarketPlace template.
+ *
+ * @param new_template New MarketPlace template.
+ * @return If successful the message contains the MarketPlace id.
+ */
+ public OneResponse update(String new_template)
+ {
+ return update(new_template, false);
+ }
+
+ /**
+ * Replaces the MarketPlace template.
+ *
+ * @param new_template New MarketPlace template.
+ * @param append True to append new attributes instead of replace the whole template
+ * @return If successful the message contains the MarketPlace id.
+ */
+ public OneResponse update(String new_template, boolean append)
+ {
+ return update(client, id, new_template, append);
+ }
+
+ /**
+ * Changes the owner/group
+ *
+ * @param uid The new owner user ID. Set it to -1 to leave the current one.
+ * @param gid The new group ID. Set it to -1 to leave the current one.
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse chown(int uid, int gid)
+ {
+ return chown(client, id, uid, gid);
+ }
+
+ /**
+ * Changes the owner
+ *
+ * @param uid The new owner user ID.
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse chown(int uid)
+ {
+ return chown(uid, -1);
+ }
+
+ /**
+ * Changes the group
+ *
+ * @param gid The new group ID.
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse chgrp(int gid)
+ {
+ return chown(-1, gid);
+ }
+
+ /**
+ * Changes the MarketPlace permissions
+ *
+ * @param owner_u 1 to allow, 0 deny, -1 do not change
+ * @param owner_m 1 to allow, 0 deny, -1 do not change
+ * @param owner_a 1 to allow, 0 deny, -1 do not change
+ * @param group_u 1 to allow, 0 deny, -1 do not change
+ * @param group_m 1 to allow, 0 deny, -1 do not change
+ * @param group_a 1 to allow, 0 deny, -1 do not change
+ * @param other_u 1 to allow, 0 deny, -1 do not change
+ * @param other_m 1 to allow, 0 deny, -1 do not change
+ * @param other_a 1 to allow, 0 deny, -1 do not change
+ * @return If an error occurs the error message contains the reason.
+ */
+ 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)
+ {
+ return chmod(client, id,
+ owner_u, owner_m, owner_a,
+ group_u, group_m, group_a,
+ other_u, other_m, other_a);
+ }
+
+ /**
+ * Changes the permissions
+ *
+ * @param octet Permissions octed , e.g. 640
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse chmod(String octet)
+ {
+ return chmod(client, id, octet);
+ }
+
+ /**
+ * Changes the permissions
+ *
+ * @param octet Permissions octed , e.g. 640
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse chmod(int octet)
+ {
+ return chmod(client, id, octet);
+ }
+
+ /**
+ * Renames this MarketPlace
+ *
+ * @param name New name for the MarketPlace.
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse rename(String name)
+ {
+ return rename(client, id, name);
+ }
+
+ // =================================
+ // Helpers
+ // =================================
+
+ /**
+ * Returns whether or not the App is part of this MarketPlace
+ *
+ * @param id The App ID.
+ * @return Whether or not the App is part of this MarketPlace.
+ */
+ public boolean contains(int id)
+ {
+ String res = xpath("MARKETPLACEAPPS/ID[.="+id+"]");
+ return res != null && res.equals(""+id);
+ }
+}
diff --git a/src/oca/java/src/org/opennebula/client/marketplace/MarketPlacePool.java b/src/oca/java/src/org/opennebula/client/marketplace/MarketPlacePool.java
new file mode 100644
index 0000000000..54b50d3295
--- /dev/null
+++ b/src/oca/java/src/org/opennebula/client/marketplace/MarketPlacePool.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright 2002-2016, OpenNebula Project, OpenNebula Systems
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.opennebula.client.marketplace;
+
+import java.util.AbstractList;
+import java.util.Iterator;
+
+
+import org.opennebula.client.Client;
+import org.opennebula.client.OneResponse;
+import org.opennebula.client.Pool;
+import org.opennebula.client.PoolElement;
+import org.w3c.dom.Node;
+
+/**
+ * This class represents an OpenNebula MarketPlace pool.
+ * It also offers static XML-RPC call wrappers.
+ */
+public class MarketPlacePool extends Pool implements Iterable{
+
+ private static final String ELEMENT_NAME = "MARKETPLACE";
+ private static final String INFO_METHOD = "marketpool.info";
+
+ /**
+ * Creates a new MarketPlace pool
+ * @param client XML-RPC Client.
+ */
+ public MarketPlacePool(Client client)
+ {
+ super(ELEMENT_NAME, client, INFO_METHOD);
+ }
+
+ @Override
+ public PoolElement factory(Node node)
+ {
+ return new MarketPlace(node, client);
+ }
+
+ /**
+ * Retrieves all the MarketPlaces in the pool.
+ *
+ * @param client XML-RPC Client.
+ * @return If successful the message contains the string
+ * with the information returned by OpenNebula.
+ */
+ public static OneResponse info(Client client)
+ {
+ return Pool.info(client, INFO_METHOD);
+ }
+
+ /**
+ * Loads the xml representation of the MarketPlace pool.
+ *
+ * @see MarketPlacePool#info(Client)
+ */
+ public OneResponse info()
+ {
+ return super.info();
+ }
+
+ public Iterator iterator()
+ {
+ AbstractList ab = new AbstractList()
+ {
+ public int size()
+ {
+ return getLength();
+ }
+
+ public MarketPlace get(int index)
+ {
+ return (MarketPlace) item(index);
+ }
+ };
+
+ return ab.iterator();
+ }
+
+ /**
+ * Returns the MarketPlace with the given Id from the pool. If it is not found,
+ * then returns null. The method {@link #info()} must be called before.
+ *
+ * @param id of the MarketPlace to retrieve
+ * @return The Image with the given Id, or null if it was not found.
+ */
+ public MarketPlace getById(int id)
+ {
+ return (MarketPlace) super.getById(id);
+ }
+}
diff --git a/src/oca/java/src/org/opennebula/client/marketplaceapp/MarketPlaceApp.java b/src/oca/java/src/org/opennebula/client/marketplaceapp/MarketPlaceApp.java
new file mode 100644
index 0000000000..bb8f214151
--- /dev/null
+++ b/src/oca/java/src/org/opennebula/client/marketplaceapp/MarketPlaceApp.java
@@ -0,0 +1,469 @@
+/*******************************************************************************
+ * Copyright 2002-2016, OpenNebula Project, OpenNebula Systems
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.opennebula.client.marketplaceapp;
+
+import org.opennebula.client.Client;
+import org.opennebula.client.OneResponse;
+import org.opennebula.client.PoolElement;
+import org.w3c.dom.Node;
+
+/**
+ * This class represents an OpenNebula MarketPlaceApp.
+ * It also offers static XML-RPC call wrappers.
+ */
+public class MarketPlaceApp extends PoolElement
+{
+
+ private static final String METHOD_PREFIX = "marketapp.";
+ private static final String ALLOCATE = METHOD_PREFIX + "allocate";
+ private static final String INFO = METHOD_PREFIX + "info";
+ private static final String DELETE = METHOD_PREFIX + "delete";
+ private static final String UPDATE = METHOD_PREFIX + "update";
+ private static final String ENABLE = METHOD_PREFIX + "enable";
+ private static final String CHOWN = METHOD_PREFIX + "chown";
+ private static final String CHMOD = METHOD_PREFIX + "chmod";
+ private static final String RENAME = METHOD_PREFIX + "rename";
+
+ private static final String[] MARKETPLACEAPP_STATES =
+ {"INIT", "READY", "LOCKED", "ERROR", "DISABLED"};
+
+ private static final String[] SHORT_MARKETPLACEAPP_STATES =
+ {"ini", "rdy", "lck", "err", "dis"};
+
+ private static final String[] MARKETPLACEAPP_TYPES =
+ {"UNKNOWN", "IMAGE", "VMTEMPLATE", "SERVICE_TEMPLATE"};
+
+ private static final String[] SHORT_MARKETPLACEAPP_TYPES =
+ {"unk", "img", "tpl", "srv"};
+
+ /**
+ * Creates a new MarketPlaceApp representation.
+ * @param id The MarketPlaceApp id.
+ * @param client XML-RPC Client.
+ */
+ public MarketPlaceApp(int id, Client client)
+ {
+ super(id, client);
+ }
+
+ /**
+ * @see PoolElement
+ */
+ protected MarketPlaceApp(Node xmlElement, Client client)
+ {
+ super(xmlElement, client);
+ }
+
+ // =================================
+ // Static XML-RPC methods
+ // =================================
+
+ /**
+ * Allocates a new MarketPlaceApp in OpenNebula.
+ *
+ * @param client XML-RPC Client.
+ * @param description A string containing the template of the MarketPlaceApp.
+ * @param marketId The MarketPlace ID
+ *
+ * @return If successful the message contains the associated
+ * id generated for this MarketPlaceApp.
+ */
+ public static OneResponse allocate(
+ Client client,
+ String description,
+ int marketId)
+ {
+ return client.call(ALLOCATE, description, marketId);
+ }
+
+ /**
+ * Retrieves the information of the given MarketPlaceApp.
+ *
+ * @param client XML-RPC Client.
+ * @param id The MarketPlaceApp id for the MarketPlaceApp to retrieve the information from
+ * @return If successful the message contains the string
+ * with the information returned by OpenNebula.
+ */
+ public static OneResponse info(Client client, int id)
+ {
+ return client.call(INFO, id);
+ }
+
+ /**
+ * Deletes an MarketPlaceApp from OpenNebula.
+ *
+ * @param client XML-RPC Client.
+ * @param id The MarketPlaceApp id of the target MarketPlaceApp we want to delete.
+ * @return A encapsulated response.
+ */
+ public static OneResponse delete(Client client, int id)
+ {
+ return client.call(DELETE, id);
+ }
+
+ /**
+ * Replaces the template contents.
+ *
+ * @param client XML-RPC Client.
+ * @param id The MarketPlaceApp id of the target MarketPlaceApp we want to modify.
+ * @param new_template New template contents
+ * @param append True to append new attributes instead of replace the whole template
+ * @return If successful the message contains the MarketPlaceApp id.
+ */
+ public static OneResponse update(Client client, int id, String new_template,
+ boolean append)
+ {
+ return client.call(UPDATE, id, new_template, append ? 1 : 0);
+ }
+
+ /**
+ * Enables or disables an MarketPlaceApp.
+ *
+ * @param client XML-RPC Client.
+ * @param id The MarketPlaceApp id of the target MarketPlaceApp we want to modify.
+ * @param enable True for enabling, false for disabling.
+ * @return If successful the message contains the MarketPlaceApp id.
+ */
+ public static OneResponse enable(Client client, int id, boolean enable)
+ {
+ return client.call(ENABLE, id, enable);
+ }
+
+ /**
+ * Changes the owner/group
+ *
+ * @param client XML-RPC Client.
+ * @param id The MarketPlaceApp id of the target MarketPlaceApp we want to modify.
+ * @param uid The new owner user ID. Set it to -1 to leave the current one.
+ * @param gid The new group ID. Set it to -1 to leave the current one.
+ * @return If an error occurs the error message contains the reason.
+ */
+ public static OneResponse chown(Client client, int id, int uid, int gid)
+ {
+ return client.call(CHOWN, id, uid, gid);
+ }
+
+ /**
+ * Changes the MarketPlaceApp permissions
+ *
+ * @param client XML-RPC Client.
+ * @param id The MarketPlaceApp id of the target MarketPlaceApp we want to modify.
+ * @param owner_u 1 to allow, 0 deny, -1 do not change
+ * @param owner_m 1 to allow, 0 deny, -1 do not change
+ * @param owner_a 1 to allow, 0 deny, -1 do not change
+ * @param group_u 1 to allow, 0 deny, -1 do not change
+ * @param group_m 1 to allow, 0 deny, -1 do not change
+ * @param group_a 1 to allow, 0 deny, -1 do not change
+ * @param other_u 1 to allow, 0 deny, -1 do not change
+ * @param other_m 1 to allow, 0 deny, -1 do not change
+ * @param other_a 1 to allow, 0 deny, -1 do not change
+ * @return If an error occurs the error message contains the reason.
+ */
+ 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)
+ {
+ return chmod(client, CHMOD, id,
+ owner_u, owner_m, owner_a,
+ group_u, group_m, group_a,
+ other_u, other_m, other_a);
+ }
+
+ /**
+ * Changes the permissions
+ *
+ * @param client XML-RPC Client.
+ * @param id The id of the target object.
+ * @param octet Permissions octed , e.g. 640
+ * @return If an error occurs the error message contains the reason.
+ */
+ public static OneResponse chmod(Client client, int id, String octet)
+ {
+ return chmod(client, CHMOD, id, octet);
+ }
+
+ /**
+ * Changes the permissions
+ *
+ * @param client XML-RPC Client.
+ * @param id The id of the target object.
+ * @param octet Permissions octed , e.g. 640
+ * @return If an error occurs the error message contains the reason.
+ */
+ public static OneResponse chmod(Client client, int id, int octet)
+ {
+ return chmod(client, CHMOD, id, octet);
+ }
+
+ /**
+ * Renames this MarketPlaceApp
+ *
+ * @param client XML-RPC Client.
+ * @param id The MarketPlaceApp id of the target MarketPlaceApp.
+ * @param name New name for the MarketPlaceApp.
+ * @return If an error occurs the error message contains the reason.
+ */
+ public static OneResponse rename(Client client, int id, String name)
+ {
+ return client.call(RENAME, id, name);
+ }
+
+ // =================================
+ // Instanced object XML-RPC methods
+ // =================================
+
+ /**
+ * Retrieves the information of the MarketPlaceApp.
+ *
+ * @return If successful the message contains the string
+ * with the information returned by OpenNebula.
+ */
+ public OneResponse info()
+ {
+ OneResponse response = info(client, id);
+ super.processInfo(response);
+ return response;
+ }
+
+ /**
+ * Deletes the MarketPlaceApp from OpenNebula.
+ *
+ * @return A encapsulated response.
+ */
+ public OneResponse delete()
+ {
+ return delete(client, id);
+ }
+
+ /**
+ * Replaces the template contents.
+ *
+ * @param new_template New template contents
+ * @return If successful the message contains the MarketPlaceApp id.
+ */
+ public OneResponse update(String new_template)
+ {
+ return update(new_template, false);
+ }
+
+ /**
+ * Replaces the template contents.
+ *
+ * @param new_template New template contents
+ * @param append True to append new attributes instead of replace the whole template
+ * @return If successful the message contains the MarketPlaceApp id.
+ */
+ public OneResponse update(String new_template, boolean append)
+ {
+ return update(client, id, new_template, append);
+ }
+
+ /**
+ * Enables or disables the MarketPlaceApp.
+ *
+ * @param enable True for enabling, false for disabling.
+ * @return If successful the message contains the MarketPlaceApp id.
+ */
+ public OneResponse enable(boolean enable)
+ {
+ return enable(client, id, enable);
+ }
+
+ /**
+ * Enables the MarketPlaceApp.
+ *
+ * @return If successful the message contains the MarketPlaceApp id.
+ */
+ public OneResponse enable()
+ {
+ return enable(true);
+ }
+
+ /**
+ * Disables the MarketPlaceApp.
+ *
+ * @return If successful the message contains the MarketPlaceApp id.
+ */
+ public OneResponse disable()
+ {
+ return enable(false);
+ }
+
+ /**
+ * Changes the owner/group
+ *
+ * @param uid The new owner user ID. Set it to -1 to leave the current one.
+ * @param gid The new group ID. Set it to -1 to leave the current one.
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse chown(int uid, int gid)
+ {
+ return chown(client, id, uid, gid);
+ }
+
+ /**
+ * Changes the owner
+ *
+ * @param uid The new owner user ID.
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse chown(int uid)
+ {
+ return chown(uid, -1);
+ }
+
+ /**
+ * Changes the group
+ *
+ * @param gid The new group ID.
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse chgrp(int gid)
+ {
+ return chown(-1, gid);
+ }
+
+ /**
+ * Changes the MarketPlaceApp permissions
+ *
+ * @param owner_u 1 to allow, 0 deny, -1 do not change
+ * @param owner_m 1 to allow, 0 deny, -1 do not change
+ * @param owner_a 1 to allow, 0 deny, -1 do not change
+ * @param group_u 1 to allow, 0 deny, -1 do not change
+ * @param group_m 1 to allow, 0 deny, -1 do not change
+ * @param group_a 1 to allow, 0 deny, -1 do not change
+ * @param other_u 1 to allow, 0 deny, -1 do not change
+ * @param other_m 1 to allow, 0 deny, -1 do not change
+ * @param other_a 1 to allow, 0 deny, -1 do not change
+ * @return If an error occurs the error message contains the reason.
+ */
+ 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)
+ {
+ return chmod(client, id,
+ owner_u, owner_m, owner_a,
+ group_u, group_m, group_a,
+ other_u, other_m, other_a);
+ }
+
+ /**
+ * Changes the permissions
+ *
+ * @param octet Permissions octed , e.g. 640
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse chmod(String octet)
+ {
+ return chmod(client, id, octet);
+ }
+
+ /**
+ * Changes the permissions
+ *
+ * @param octet Permissions octed , e.g. 640
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse chmod(int octet)
+ {
+ return chmod(client, id, octet);
+ }
+
+ /**
+ * Renames this MarketPlaceApp
+ *
+ * @param name New name for the MarketPlaceApp.
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse rename(String name)
+ {
+ return rename(client, id, name);
+ }
+
+ // =================================
+ // Helpers
+ // =================================
+
+ /**
+ * Returns the state of the MarketPlaceApp.
+ *
+ * The method {@link MarketPlaceApp#info()} must be called before.
+ *
+ * @return The state of the MarketPlaceApp.
+ */
+ public String stateString()
+ {
+ int state = state();
+ return state != -1 ? MARKETPLACEAPP_STATES[state] : null;
+ }
+
+ /**
+ * Returns the short length string state of the MarketPlaceApp.
+ *
+ * The method {@link MarketPlaceApp#info()} must be called before.
+ *
+ * @return The short length string state of the MarketPlaceApp.
+ */
+ public String shortStateStr()
+ {
+ int state = state();
+ return state != -1 ? SHORT_MARKETPLACEAPP_STATES[state] : null;
+ }
+
+ /**
+ * Returns the type of the MarketPlaceApp.
+ *
+ * @return The type of the MarketPlaceApp.
+ */
+ public int type()
+ {
+ String state = xpath("TYPE");
+ return state != null ? Integer.parseInt( state ) : -1;
+ }
+
+ /**
+ * Returns the type of the MarketPlaceApp as a String.
+ *
+ * @return The type of the MarketPlaceApp as a String.
+ */
+ public String typeStr()
+ {
+ int type = type();
+ return type != -1 ? MARKETPLACEAPP_TYPES[type] : null;
+ }
+
+ /**
+ * Returns the type of the MarketPlaceApp as a short String.
+ *
+ * @return The type of the MarketPlaceApp as a short String.
+ */
+ public String shortTypeStr()
+ {
+ int type = type();
+ return type != -1 ? SHORT_MARKETPLACEAPP_TYPES[type] : null;
+ }
+
+ /**
+ * Returns true if the MarketPlaceApp is enabled.
+ *
+ * @return True if the MarketPlaceApp is enabled.
+ */
+ public boolean isEnabled()
+ {
+ return state() != 3;
+ }
+}
diff --git a/src/oca/java/src/org/opennebula/client/marketplaceapp/MarketPlaceAppPool.java b/src/oca/java/src/org/opennebula/client/marketplaceapp/MarketPlaceAppPool.java
new file mode 100644
index 0000000000..8c7ac967a0
--- /dev/null
+++ b/src/oca/java/src/org/opennebula/client/marketplaceapp/MarketPlaceAppPool.java
@@ -0,0 +1,263 @@
+/*******************************************************************************
+ * Copyright 2002-2016, OpenNebula Project, OpenNebula Systems
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.opennebula.client.marketplaceapp;
+
+import java.util.AbstractList;
+import java.util.Iterator;
+
+import org.opennebula.client.Client;
+import org.opennebula.client.OneResponse;
+import org.opennebula.client.Pool;
+import org.opennebula.client.PoolElement;
+import org.w3c.dom.Node;
+
+/**
+ * This class represents an OpenNebula MarketPlaceApp pool.
+ * It also offers static XML-RPC call wrappers.
+ */
+public class MarketPlaceAppPool extends Pool implements Iterable
+{
+ private static final String ELEMENT_NAME = "MARKETPLACEAPP";
+ private static final String INFO_METHOD = "marketapppool.info";
+
+ private int filter;
+
+ /**
+ * Creates a new MarketPlaceApp pool with the default filter flag value
+ * set to {@link Pool#MINE_GROUP} (MarketPlaceApps belonging to the connected user,
+ * and the ones in his group)
+ *
+ * @param client XML-RPC Client.
+ *
+ * @see MarketPlaceAppPool#MarketPlaceAppPool(Client, int)
+ */
+ public MarketPlaceAppPool(Client client)
+ {
+ super(ELEMENT_NAME, client, INFO_METHOD);
+ this.filter = MINE_GROUP;
+ }
+
+ /**
+ * Creates a new MarketPlaceApp pool.
+ *
+ * @param client XML-RPC Client.
+ * @param filter Filter flag to use by default in the method
+ * {@link MarketPlaceAppPool#info()}. Possible values:
+ *
+ * - {@link Pool#ALL}: All MarketPlaceApps
+ * - {@link Pool#MINE}: Connected user's MarketPlaceApps
+ * - {@link Pool#MINE_GROUP}: Connected user's MarketPlaceApps, and the ones in
+ * his group
+ * - >= 0 UID User's MarketPlaceApps
+ *
+ */
+ public MarketPlaceAppPool(Client client, int filter)
+ {
+ super(ELEMENT_NAME, client, INFO_METHOD);
+ this.filter = filter;
+ }
+
+ /* (non-Javadoc)
+ * @see org.opennebula.client.Pool#factory(org.w3c.dom.Node)
+ */
+ @Override
+ public PoolElement factory(Node node)
+ {
+ return new MarketPlaceApp(node, client);
+ }
+
+ /**
+ * Retrieves all or part of the MarketPlaceApps in the pool.
+ *
+ * @param client XML-RPC Client.
+ * @param filter Filter flag to use. Possible values:
+ *
+ * - {@link Pool#ALL}: All MarketPlaceApps
+ * - {@link Pool#MINE}: Connected user's MarketPlaceApps
+ * - {@link Pool#MINE_GROUP}: Connected user's MarketPlaceApps, and the ones in
+ * his group
+ * - >= 0 UID User's MarketPlaceApps
+ *
+ * @return If successful the message contains the string
+ * with the information returned by OpenNebula.
+ */
+ public static OneResponse info(Client client, int filter)
+ {
+ return Pool.info(client, INFO_METHOD, filter, -1, -1);
+ }
+
+ /**
+ * Retrieves all the MarketPlaceApps in the pool.
+ *
+ * @param client XML-RPC Client.
+ * @return If successful the message contains the string
+ * with the information returned by OpenNebula.
+ */
+ public static OneResponse infoAll(Client client)
+ {
+ return Pool.infoAll(client, INFO_METHOD);
+ }
+
+ /**
+ * Retrieves all the connected user's MarketPlaceApps.
+ *
+ * @param client XML-RPC Client.
+ * @return If successful the message contains the string
+ * with the information returned by OpenNebula.
+ */
+ public static OneResponse infoMine(Client client)
+ {
+ return Pool.infoMine(client, INFO_METHOD);
+ }
+
+ /**
+ * Retrieves all the connected user's MarketPlaceApps and the ones in
+ * his group.
+ *
+ * @param client XML-RPC Client.
+ * @return If successful the message contains the string
+ * with the information returned by OpenNebula.
+ */
+ public static OneResponse infoGroup(Client client)
+ {
+ return Pool.infoGroup(client, INFO_METHOD);
+ }
+
+ /**
+ * Retrieves all or part of the MarketPlaceApps in the pool. The MarketPlaceApps to retrieve
+ * can be also filtered by Id, specifying the first and last Id to include.
+ *
+ * @param client XML-RPC Client.
+ * @param filter Filter flag to use. Possible values:
+ *
+ * - {@link Pool#ALL}: All MarketPlaceApps
+ * - {@link Pool#MINE}: Connected user's MarketPlaceApps
+ * - {@link Pool#MINE_GROUP}: Connected user's MarketPlaceApps, and the ones in
+ * his group
+ * - >= 0 UID User's MarketPlaceApps
+ *
+ * @param startId Lowest Id to retrieve
+ * @param endId Biggest Id to retrieve
+ * @return If successful the message contains the string
+ * with the information returned by OpenNebula.
+ */
+ public static OneResponse info(Client client, int filter,
+ int startId, int endId)
+ {
+ return Pool.info(client, INFO_METHOD, filter, startId, endId);
+ }
+
+ /**
+ * Loads the xml representation of all or part of the
+ * MarketPlaceApps in the pool. The filter used is the one set in
+ * the constructor.
+ *
+ * @see MarketPlaceAppPool#info(Client, int)
+ *
+ * @return If successful the message contains the string
+ * with the information returned by OpenNebula.
+ */
+ public OneResponse info()
+ {
+ return super.info(filter, -1, -1);
+ }
+
+ /**
+ * Loads the xml representation of all the MarketPlaceApps in the pool.
+ *
+ * @return If successful the message contains the string
+ * with the information returned by OpenNebula.
+ */
+ public OneResponse infoAll()
+ {
+ return super.infoAll();
+ }
+
+ /**
+ * Loads the xml representation of all the connected user's MarketPlaceApps.
+ *
+ * @return If successful the message contains the string
+ * with the information returned by OpenNebula.
+ */
+ public OneResponse infoMine()
+ {
+ return super.infoMine();
+ }
+
+ /**
+ * Loads the xml representation of all the connected user's MarketPlaceApps and
+ * the ones in his group.
+ *
+ * @return If successful the message contains the string
+ * with the information returned by OpenNebula.
+ */
+ public OneResponse infoGroup()
+ {
+ return super.infoGroup();
+ }
+
+ /**
+ * Retrieves all or part of the MarketPlaceApps in the pool. The MarketPlaceApps to retrieve
+ * can be also filtered by Id, specifying the first and last Id to include.
+ *
+ * @param filter Filter flag to use. Possible values:
+ *
+ * - {@link Pool#ALL}: All MarketPlaceApps
+ * - {@link Pool#MINE}: Connected user's MarketPlaceApps
+ * - {@link Pool#MINE_GROUP}: Connected user's MarketPlaceApps, and the ones in
+ * his group
+ * - >= 0 UID User's MarketPlaceApps
+ *
+ * @param startId Lowest Id to retrieve
+ * @param endId Biggest Id to retrieve
+ * @return If successful the message contains the string
+ * with the information returned by OpenNebula.
+ */
+ public OneResponse info(int filter, int startId, int endId)
+ {
+ return super.info(filter, startId, endId);
+ }
+
+ public Iterator iterator()
+ {
+ AbstractList ab = new AbstractList()
+ {
+ public int size()
+ {
+ return getLength();
+ }
+
+ public MarketPlaceApp get(int index)
+ {
+ return (MarketPlaceApp) item(index);
+ }
+ };
+
+ return ab.iterator();
+ }
+
+ /**
+ * Returns the MarketPlaceApp with the given Id from the pool. If it is not found,
+ * then returns null. The method {@link #info()} must be called before.
+ *
+ * @param id of the MarketPlaceApp to retrieve
+ * @return The MarketPlaceApp with the given Id, or null if it was not found.
+ */
+ public MarketPlaceApp getById(int id)
+ {
+ return (MarketPlaceApp) super.getById(id);
+ }
+}
diff --git a/src/oca/java/src/org/opennebula/client/secgroup/SecurityGroup.java b/src/oca/java/src/org/opennebula/client/secgroup/SecurityGroup.java
index 3f2957dc57..6d7910831e 100644
--- a/src/oca/java/src/org/opennebula/client/secgroup/SecurityGroup.java
+++ b/src/oca/java/src/org/opennebula/client/secgroup/SecurityGroup.java
@@ -36,6 +36,7 @@ public class SecurityGroup extends PoolElement{
private static final String CHMOD = METHOD_PREFIX + "chmod";
private static final String CLONE = METHOD_PREFIX + "clone";
private static final String RENAME = METHOD_PREFIX + "rename";
+ private static final String COMMIT = METHOD_PREFIX + "commit";
/**
* Creates a new security group representation.
@@ -211,6 +212,21 @@ public class SecurityGroup extends PoolElement{
return client.call(RENAME, id, name);
}
+ /**
+ * Commit security group changes to associated VMs
+ *
+ * @param client XML-RPC Client.
+ * @param id The id of the target security group.
+ * @param recover If true will only operate on outdated and error VMs.
+ * This is intended for retrying updates of VMs or reinitialize the
+ * updating process if oned stopped or fail.
+ * @return If an error occurs the error message contains the reason.
+ */
+ public static OneResponse commit(Client client, int id, boolean recover)
+ {
+ return client.call(COMMIT, id, recover);
+ }
+
// =================================
// Instanced object XML-RPC methods
// =================================
@@ -363,6 +379,19 @@ public class SecurityGroup extends PoolElement{
return rename(client, id, name);
}
+ /**
+ * Commit security group changes to associated VMs
+ *
+ * @param recover If true will only operate on outdated and error VMs.
+ * This is intended for retrying updates of VMs or reinitialize the
+ * updating process if oned stopped or fail.
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse commit(boolean recover)
+ {
+ return commit(client, id, recover);
+ }
+
// =================================
// Helpers
// =================================
diff --git a/src/oca/java/src/org/opennebula/client/secgroup/SecurityGroupPool.java b/src/oca/java/src/org/opennebula/client/secgroup/SecurityGroupPool.java
index 7939c7582d..4b766fb2f9 100644
--- a/src/oca/java/src/org/opennebula/client/secgroup/SecurityGroupPool.java
+++ b/src/oca/java/src/org/opennebula/client/secgroup/SecurityGroupPool.java
@@ -62,7 +62,7 @@ public class SecurityGroupPool extends Pool implements Iterable{
* {@link Pool#MINE}: Connected user's Security Groups
* {@link Pool#MINE_GROUP}: Connected user's Security Groups, and the ones in
* his group
- * >= 0: UID User's Security Groups
+ * >= 0 UID User's Security Groups
*
*/
public SecurityGroupPool(Client client, int filter)
@@ -87,7 +87,7 @@ public class SecurityGroupPool extends Pool implements Iterable{
* {@link Pool#MINE}: Connected user's Security Groups
* {@link Pool#MINE_GROUP}: Connected user's Security Groups, and the ones in
* his group
- * >= 0: UID User's Security Groups
+ * >= 0 UID User's Security Groups
*
* @return If successful the message contains the string
* with the information returned by OpenNebula.
@@ -145,7 +145,7 @@ public class SecurityGroupPool extends Pool implements Iterable{
* {@link Pool#MINE}: Connected user's Security Groups
* {@link Pool#MINE_GROUP}: Connected user's Security Groups, and the ones in
* his group
- * >= 0: UID User's Security Groups
+ * >= 0 UID User's Security Groups
*
* @param startId Lowest Id to retrieve
* @param endId Biggest Id to retrieve
@@ -217,7 +217,7 @@ public class SecurityGroupPool extends Pool implements Iterable{
* {@link Pool#MINE}: Connected user's Security Groups
* {@link Pool#MINE_GROUP}: Connected user's Security Groups, and the ones in
* his group
- * >= 0: UID User's Security Groups
+ * >= 0 UID User's Security Groups
*
* @param startId Lowest Id to retrieve
* @param endId Biggest Id to retrieve
diff --git a/src/oca/java/src/org/opennebula/client/template/Template.java b/src/oca/java/src/org/opennebula/client/template/Template.java
index d26b692d03..a3ca8e96e8 100644
--- a/src/oca/java/src/org/opennebula/client/template/Template.java
+++ b/src/oca/java/src/org/opennebula/client/template/Template.java
@@ -107,11 +107,12 @@ public class Template extends PoolElement
*
* @param client XML-RPC Client.
* @param id The template id of the target template we want to delete.
+ * @param recursive deletes the template plus any image defined in DISK.
* @return A encapsulated response.
*/
- public static OneResponse delete(Client client, int id)
+ public static OneResponse delete(Client client, int id, boolean recursive)
{
- return client.call(DELETE, id);
+ return client.call(DELETE, id, recursive);
}
/**
@@ -179,10 +180,42 @@ public class Template extends PoolElement
int group_u, int group_m, int group_a,
int other_u, int other_m, int other_a)
{
- return chmod(client, CHMOD, id,
+ return client.call(CHMOD, id,
owner_u, owner_m, owner_a,
group_u, group_m, group_a,
- other_u, other_m, other_a);
+ other_u, other_m, other_a,
+ false);
+ }
+
+ /**
+ * Changes the template permissions
+ *
+ * @param client XML-RPC Client.
+ * @param id The template id of the target template.
+ * @param owner_u 1 to allow, 0 deny, -1 do not change
+ * @param owner_m 1 to allow, 0 deny, -1 do not change
+ * @param owner_a 1 to allow, 0 deny, -1 do not change
+ * @param group_u 1 to allow, 0 deny, -1 do not change
+ * @param group_m 1 to allow, 0 deny, -1 do not change
+ * @param group_a 1 to allow, 0 deny, -1 do not change
+ * @param other_u 1 to allow, 0 deny, -1 do not change
+ * @param other_m 1 to allow, 0 deny, -1 do not change
+ * @param other_a 1 to allow, 0 deny, -1 do not change
+ * @param recursive chmods the template plus any image defined in DISK.
+ *
+ * @return If an error occurs the error message contains the reason.
+ */
+ 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,
+ boolean recursive)
+ {
+ return client.call(CHMOD, id,
+ owner_u, owner_m, owner_a,
+ group_u, group_m, group_a,
+ other_u, other_m, other_a,
+ recursive);
}
/**
@@ -195,7 +228,38 @@ public class Template extends PoolElement
*/
public static OneResponse chmod(Client client, int id, String octet)
{
- return chmod(client, CHMOD, id, octet);
+ return chmod(client, id, octet, false);
+ }
+
+
+ /**
+ * Changes the permissions
+ *
+ * @param client XML-RPC Client.
+ * @param id The id of the target object.
+ * @param octet Permissions octed , e.g. 640
+ * @param recursive chmods the template plus any image defined in DISK.
+ *
+ * @return If an error occurs the error message contains the reason.
+ */
+ public static OneResponse chmod(Client client, int id, String octet,
+ boolean recursive)
+ {
+ int owner_u = (Integer.parseInt(octet.substring(0, 1)) & 4) != 0 ? 1 : 0;
+ int owner_m = (Integer.parseInt(octet.substring(0, 1)) & 2) != 0 ? 1 : 0;
+ int owner_a = (Integer.parseInt(octet.substring(0, 1)) & 1) != 0 ? 1 : 0;
+ int group_u = (Integer.parseInt(octet.substring(1, 2)) & 4) != 0 ? 1 : 0;
+ int group_m = (Integer.parseInt(octet.substring(1, 2)) & 2) != 0 ? 1 : 0;
+ int group_a = (Integer.parseInt(octet.substring(1, 2)) & 1) != 0 ? 1 : 0;
+ int other_u = (Integer.parseInt(octet.substring(2, 3)) & 4) != 0 ? 1 : 0;
+ int other_m = (Integer.parseInt(octet.substring(2, 3)) & 2) != 0 ? 1 : 0;
+ int other_a = (Integer.parseInt(octet.substring(2, 3)) & 1) != 0 ? 1 : 0;
+
+ return chmod(client, id,
+ owner_u, owner_m, owner_a,
+ group_u, group_m, group_a,
+ other_u, other_m, other_a,
+ recursive);
}
/**
@@ -208,7 +272,23 @@ public class Template extends PoolElement
*/
public static OneResponse chmod(Client client, int id, int octet)
{
- return chmod(client, CHMOD, id, octet);
+ return chmod(client, id, octet, false);
+ }
+
+ /**
+ * Changes the permissions
+ *
+ * @param client XML-RPC Client.
+ * @param id The id of the target object.
+ * @param octet Permissions octed , e.g. 640
+ * @param recursive chmods the template plus any image defined in DISK.
+ *
+ * @return If an error occurs the error message contains the reason.
+ */
+ public static OneResponse chmod(Client client, int id, int octet,
+ boolean recursive)
+ {
+ return chmod(client, id, Integer.toString(octet), recursive);
}
/**
@@ -220,12 +300,14 @@ public class Template extends PoolElement
* @param onHold False to create this VM in pending state, true on hold
* @param template User provided Template to merge with the one
* being instantiated
+ * @param persistent true to create a private persistent copy of the
+ * template plus any image defined in DISK, and instantiate that copy
* @return If successful the message contains the VM Instance ID.
*/
public static OneResponse instantiate(Client client, int id, String name,
- boolean onHold, String template)
+ boolean onHold, String template, boolean persistent)
{
- return client.call(INSTANTIATE, id, name, onHold, template);
+ return client.call(INSTANTIATE, id, name, onHold, template, persistent);
}
/**
@@ -238,7 +320,23 @@ public class Template extends PoolElement
*/
public static OneResponse clone(Client client, int id, String name)
{
- return client.call(CLONE, id, name);
+ return clone(client, id, name);
+ }
+
+ /**
+ * Clones this template into a new one
+ *
+ * @param client XML-RPC Client.
+ * @param id The template id of the target template.
+ * @param name Name for the new template.
+ * @param recursive clones the template plus any image defined in DISK.
+ * The new IMAGE_ID is set into each DISK.
+ * @return If successful the message contains the new template ID.
+ */
+ public static OneResponse clone(Client client, int id, String name,
+ boolean recursive)
+ {
+ return client.call(CLONE, id, name, recursive);
}
/**
@@ -291,7 +389,18 @@ public class Template extends PoolElement
*/
public OneResponse delete()
{
- return delete(client, id);
+ return delete(client, id, false);
+ }
+
+ /**
+ * Deletes the template from OpenNebula.
+ * @param recursive deletes the template plus any image defined in DISK.
+ *
+ * @return A encapsulated response.
+ */
+ public OneResponse delete(boolean recursive)
+ {
+ return delete(client, id, recursive);
}
/**
@@ -403,7 +512,36 @@ public class Template extends PoolElement
return chmod(client, id,
owner_u, owner_m, owner_a,
group_u, group_m, group_a,
- other_u, other_m, other_a);
+ other_u, other_m, other_a,
+ false);
+ }
+
+ /**
+ * Changes the template permissions
+ *
+ * @param owner_u 1 to allow, 0 deny, -1 do not change
+ * @param owner_m 1 to allow, 0 deny, -1 do not change
+ * @param owner_a 1 to allow, 0 deny, -1 do not change
+ * @param group_u 1 to allow, 0 deny, -1 do not change
+ * @param group_m 1 to allow, 0 deny, -1 do not change
+ * @param group_a 1 to allow, 0 deny, -1 do not change
+ * @param other_u 1 to allow, 0 deny, -1 do not change
+ * @param other_m 1 to allow, 0 deny, -1 do not change
+ * @param other_a 1 to allow, 0 deny, -1 do not change
+ * @param recursive chmods the template plus any image defined in DISK.
+ *
+ * @return If an error occurs the error message contains the reason.
+ */
+ 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,
+ boolean recursive)
+ {
+ return chmod(client, id,
+ owner_u, owner_m, owner_a,
+ group_u, group_m, group_a,
+ other_u, other_m, other_a,
+ recursive);
}
/**
@@ -414,7 +552,20 @@ public class Template extends PoolElement
*/
public OneResponse chmod(String octet)
{
- return chmod(client, id, octet);
+ return chmod(client, id, octet, false);
+ }
+
+ /**
+ * Changes the permissions
+ *
+ * @param octet Permissions octed , e.g. 640
+ * @param recursive chmods the template plus any image defined in DISK.
+ *
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse chmod(String octet, boolean recursive)
+ {
+ return chmod(client, id, octet, recursive);
}
/**
@@ -425,7 +576,20 @@ public class Template extends PoolElement
*/
public OneResponse chmod(int octet)
{
- return chmod(client, id, octet);
+ return chmod(client, id, octet, false);
+ }
+
+ /**
+ * Changes the permissions
+ *
+ * @param octet Permissions octed , e.g. 640
+ * @param recursive chmods the template plus any image defined in DISK.
+ *
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse chmod(int octet, boolean recursive)
+ {
+ return chmod(client, id, octet, recursive);
}
/**
@@ -435,11 +599,15 @@ public class Template extends PoolElement
* @param onHold False to create this VM in pending state, true on hold
* @param template User provided Template to merge with the one
* being instantiated
+ * @param persistent true to create a private persistent copy of the
+ * template plus any image defined in DISK, and instantiate that copy
+ *
* @return If successful the message contains the VM Instance ID.
*/
- public OneResponse instantiate(String name, boolean onHold, String template)
+ public OneResponse instantiate(String name, boolean onHold,
+ String template, boolean persistent)
{
- return instantiate(client, id, name, onHold, template);
+ return instantiate(client, id, name, onHold, template, persistent);
}
/**
@@ -450,7 +618,7 @@ public class Template extends PoolElement
*/
public OneResponse instantiate(String name)
{
- return instantiate(client, id, name, false, "");
+ return instantiate(client, id, name, false, "", false);
}
/**
@@ -460,7 +628,7 @@ public class Template extends PoolElement
*/
public OneResponse instantiate()
{
- return instantiate(client, id, "", false, "");
+ return instantiate(client, id, "", false, "", false);
}
/**
@@ -474,6 +642,19 @@ public class Template extends PoolElement
return clone(client, id, name);
}
+ /**
+ * Clones this template into a new one
+ *
+ * @param name Name for the new template.
+ * @param recursive clones the template plus any image defined in DISK.
+ * The new IMAGE_ID is set into each DISK.
+ * @return If successful the message contains the new template ID.
+ */
+ public OneResponse clone(String name, boolean recursive)
+ {
+ return clone(client, id, name, recursive);
+ }
+
/**
* Renames this Template
*
diff --git a/src/oca/java/src/org/opennebula/client/template/TemplatePool.java b/src/oca/java/src/org/opennebula/client/template/TemplatePool.java
index e90553a8f3..06b5b92198 100644
--- a/src/oca/java/src/org/opennebula/client/template/TemplatePool.java
+++ b/src/oca/java/src/org/opennebula/client/template/TemplatePool.java
@@ -61,7 +61,7 @@ public class TemplatePool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Templates
* {@link Pool#MINE_GROUP}: Connected user's Templates, and the ones in
* his group
- * >= 0: UID User's Templates
+ * >= 0: UID User's Templates
*
*/
public TemplatePool(Client client, int filter)
@@ -89,7 +89,7 @@ public class TemplatePool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Templates
* {@link Pool#MINE_GROUP}: Connected user's Templates, and the ones in
* his group
- * >= 0: UID User's Templates
+ * >= 0: UID User's Templates
*
* @return If successful the message contains the string
* with the information returned by OpenNebula.
@@ -147,7 +147,7 @@ public class TemplatePool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Templates
* {@link Pool#MINE_GROUP}: Connected user's Templates, and the ones in
* his group
- * >= 0: UID User's Templates
+ * >= 0: UID User's Templates
*
* @param startId Lowest Id to retrieve
* @param endId Biggest Id to retrieve
@@ -219,7 +219,7 @@ public class TemplatePool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Templates
* {@link Pool#MINE_GROUP}: Connected user's Templates, and the ones in
* his group
- * >= 0: UID User's Templates
+ * >= 0: UID User's Templates
*
* @param startId Lowest Id to retrieve
* @param endId Biggest Id to retrieve
diff --git a/src/oca/java/src/org/opennebula/client/user/User.java b/src/oca/java/src/org/opennebula/client/user/User.java
index 3ab1d1f1f9..d91b0e5ac5 100644
--- a/src/oca/java/src/org/opennebula/client/user/User.java
+++ b/src/oca/java/src/org/opennebula/client/user/User.java
@@ -228,7 +228,7 @@ public class User extends PoolElement{
* @param username of the user
* @param token the login token, if empty OpenNebula will
* generate one
- * @param expire valid period of the token in secs. If <= 0
+ * @param expire valid period of the token in secs. If <= 0
* the token will be reset
* @return token in case of success, Error otherwise
*/
@@ -376,7 +376,7 @@ public class User extends PoolElement{
*
* @param token the login token, if empty OpenNebula will
* generate one
- * @param expire valid period of the token in secs. If <= 0
+ * @param expire valid period of the token in secs. If <= 0
* the token will be reset
* @return token in case of success, Error otherwise
*/
diff --git a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java
index 2702a0c201..5e255453da 100644
--- a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java
+++ b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java
@@ -51,6 +51,7 @@ public class VirtualMachine extends PoolElement{
private static final String DISKSNAPSHOTCREATE = METHOD_PREFIX + "disksnapshotcreate";
private static final String DISKSNAPSHOTREVERT = METHOD_PREFIX + "disksnapshotrevert";
private static final String DISKSNAPSHOTDELETE = METHOD_PREFIX + "disksnapshotdelete";
+ private static final String UPDATECONF = METHOD_PREFIX + "updateconf";
private static final String[] VM_STATES =
{
@@ -64,7 +65,9 @@ public class VirtualMachine extends PoolElement{
"FAILED",
"POWEROFF",
"UNDEPLOYED",
- "CLONING" };
+ "CLONING",
+ "CLONING_FAILURE"
+ };
private static final String[] SHORT_VM_STATES =
{
@@ -78,7 +81,9 @@ public class VirtualMachine extends PoolElement{
"fail",
"poff",
"unde",
- "clon" };
+ "clon",
+ "fail"
+ };
private static final String[] LCM_STATE =
{
@@ -625,27 +630,28 @@ public class VirtualMachine extends PoolElement{
/**
* Submits an action to be performed on the virtual machine.
- *
+ *
* It is recommended to use the helper methods instead:
*
- * - {@link VirtualMachine#shutdown(boolean)}
+ * - {@link VirtualMachine#terminate(boolean)}
* - {@link VirtualMachine#reboot(boolean)}
* - {@link VirtualMachine#hold()}
* - {@link VirtualMachine#release()}
* - {@link VirtualMachine#stop()}
* - {@link VirtualMachine#suspend()}
* - {@link VirtualMachine#resume()}
- * - {@link VirtualMachine#delete(boolean)}
- * - {@link VirtualMachine#poweroff()}
+ * - {@link VirtualMachine#poweroff(boolean)}
* - {@link VirtualMachine#resched()}
* - {@link VirtualMachine#unresched()}
* - {@link VirtualMachine#undeploy(boolean)}
*
*
- * @param action The action name to be performed, can be:
- * "shutdown", "hold", "release", "stop", "shutdown-hard", "suspend",
- * "resume", "delete", "delete-recreate", "reboot", "resched",
- * "unresched", "reboot-hard", "poweroff", "undeploy", "undeploy-hard"
+ * @param action The action name to be performed, can be:
+ *
+ * "terminate-hard", "terminate", "undeploy-hard", "undeploy",
+ * "poweroff-hard", "poweroff", "reboot-hard", "reboot", "hold",
+ * "release", "stop", "suspend", "resume", "resched", "unresched"
+ *
* @return If an error occurs the error message contains the reason.
*/
protected OneResponse action(String action)
@@ -997,8 +1003,15 @@ public class VirtualMachine extends PoolElement{
/**
* Recovers a stuck VM.
*
- * @param operation to recover the VM: (0) failure, (1) success or (2)
- * retry
+ * @param operation to recover the VM:
+ *
+ * - 0 failure
+ * - 1 success
+ * - 2 retry
+ * - 3 delete
+ * - 4 delete-recreate
+ *
+ *
* @return If an error occurs the error message contains the reason.
*/
public OneResponse recover(int operation)
@@ -1014,9 +1027,9 @@ public class VirtualMachine extends PoolElement{
* Gracefully shuts down the already deployed VM.
* @return If an error occurs the error message contains the reason.
*/
- public OneResponse shutdown()
+ public OneResponse terminate()
{
- return shutdown(false);
+ return terminate(false);
}
/**
@@ -1025,9 +1038,9 @@ public class VirtualMachine extends PoolElement{
* graceful shutdown
* @return If an error occurs the error message contains the reason.
*/
- public OneResponse shutdown(boolean hard)
+ public OneResponse terminate(boolean hard)
{
- String actionSt = hard ? "shutdown-hard" : "shutdown";
+ String actionSt = hard ? "terminate-hard" : "terminate";
return action(actionSt);
}
@@ -1137,27 +1150,6 @@ public class VirtualMachine extends PoolElement{
return action("resume");
}
- /**
- * Deletes the VM from the pool and database.
- * @return If an error occurs the error message contains the reason.
- */
- public OneResponse delete()
- {
- return delete(false);
- }
-
- /**
- * Deletes the VM from the pool and database.
- * @param recreate True to recreate the VM in the pending state.
- * @return If an error occurs the error message contains the reason.
- */
- public OneResponse delete(boolean recreate)
- {
- String actionSt = recreate ? "delete-recreate" : "delete";
-
- return action(actionSt);
- }
-
/**
* Sets the re-scheduling flag for the VM
* @return If an error occurs the error message contains the reason.
@@ -1279,54 +1271,10 @@ public class VirtualMachine extends PoolElement{
return diskDetach(diskId);
}
- /**
- * Cancels the running VM.
- * @return If an error occurs the error message contains the reason.
- *
- * @deprecated Replaced by hard shutdown {@link #shutdown(boolean)}
- */
- @Deprecated public OneResponse cancel()
- {
- return action("cancel");
- }
-
- /**
- * Resets a running VM.
- * @return If an error occurs the error message contains the reason.
- *
- * @deprecated Replaced by hard reboot {@link #reboot(boolean)}
- */
- @Deprecated public OneResponse reset()
- {
- return action("reset");
- }
-
- /**
- * Deletes the VM from the pool and database.
- * @return If an error occurs the error message contains the reason.
- *
- * @deprecated Replaced by {@link #delete}
- */
- @Deprecated public OneResponse finalizeVM()
- {
- return action("finalize");
- }
-
- /**
- * Resubmits a VM to PENDING state.
- * @return If an error occurs the error message contains the reason.
- *
- * @deprecated Replaced by delete and recreate {@link #delete(boolean)}
- */
- @Deprecated public OneResponse resubmit()
- {
- return action("resubmit");
- }
-
/**
* Performs a live migration of the virtual machine to the
* target host (hid).
- *
+ *
* It does the same as {@link VirtualMachine#migrate(int, boolean)}
* with live set to true.
*
diff --git a/src/oca/java/src/org/opennebula/client/vm/VirtualMachinePool.java b/src/oca/java/src/org/opennebula/client/vm/VirtualMachinePool.java
index 95f122710e..a26dd65d59 100644
--- a/src/oca/java/src/org/opennebula/client/vm/VirtualMachinePool.java
+++ b/src/oca/java/src/org/opennebula/client/vm/VirtualMachinePool.java
@@ -73,7 +73,7 @@ public class VirtualMachinePool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Virtual Machines
* {@link Pool#MINE_GROUP}: Connected user's Virtual Machines, and the ones in
* his group
- * >= 0: UID User's Virtual Machines
+ * >= 0 UID User's Virtual Machines
*
*/
public VirtualMachinePool(Client client, int filter)
@@ -99,7 +99,7 @@ public class VirtualMachinePool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Virtual Machines
* {@link Pool#MINE_GROUP}: Connected user's Virtual Machines, and the ones in
* his group
- * >= 0: UID User's Virtual Machines
+ * >= 0 UID User's Virtual Machines
*
* @return If successful the message contains the string
* with the information returned by OpenNebula.
@@ -158,7 +158,7 @@ public class VirtualMachinePool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Virtual Machines
* {@link Pool#MINE_GROUP}: Connected user's Virtual Machines, and the ones in
* his group
- * >= 0: UID User's Virtual Machines
+ * >= 0 UID User's Virtual Machines
*
* @param startId Lowest Id to retrieve
* @param endId Biggest Id to retrieve
@@ -185,7 +185,7 @@ public class VirtualMachinePool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Virtual Machines
* {@link Pool#MINE_GROUP}: Connected user's Virtual Machines, and
* the ones in his group
- * >= 0: UID User's Virtual Machines
+ * >= 0 UID User's Virtual Machines
*
* @return If successful the message contains the string
* with the information returned by OpenNebula.
@@ -262,7 +262,7 @@ public class VirtualMachinePool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Virtual Machines
* {@link Pool#MINE_GROUP}: Connected user's Virtual Machines, and the ones in
* his group
- * >= 0: UID User's Virtual Machines
+ * >= 0 UID User's Virtual Machines
*
* @param startId Lowest Id to retrieve
* @param endId Biggest Id to retrieve
@@ -287,7 +287,7 @@ public class VirtualMachinePool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Virtual Machines
* {@link Pool#MINE_GROUP}: Connected user's Virtual Machines, and
* the ones in his group
- * >= 0: UID User's Virtual Machines
+ * >= 0 UID User's Virtual Machines
*
* @return If successful the message contains the string
* with the information returned by OpenNebula.
diff --git a/src/oca/java/src/org/opennebula/client/vnet/VirtualNetworkPool.java b/src/oca/java/src/org/opennebula/client/vnet/VirtualNetworkPool.java
index bdd8b4e365..56a9b8d7dc 100644
--- a/src/oca/java/src/org/opennebula/client/vnet/VirtualNetworkPool.java
+++ b/src/oca/java/src/org/opennebula/client/vnet/VirtualNetworkPool.java
@@ -62,7 +62,7 @@ public class VirtualNetworkPool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Virtual Networks
* {@link Pool#MINE_GROUP}: Connected user's Virtual Networks, and the ones in
* his group
- * >= 0: UID User's Virtual Networks
+ * >= 0 UID User's Virtual Networks
*
*/
public VirtualNetworkPool(Client client, int filter)
@@ -87,7 +87,7 @@ public class VirtualNetworkPool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Virtual Networks
* {@link Pool#MINE_GROUP}: Connected user's Virtual Networks, and the ones in
* his group
- * >= 0: UID User's Virtual Networks
+ * >= 0 UID User's Virtual Networks
*
* @return If successful the message contains the string
* with the information returned by OpenNebula.
@@ -145,7 +145,7 @@ public class VirtualNetworkPool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Virtual Networks
* {@link Pool#MINE_GROUP}: Connected user's Virtual Networks, and the ones in
* his group
- * >= 0: UID User's Virtual Networks
+ * >= 0 UID User's Virtual Networks
*
* @param startId Lowest Id to retrieve
* @param endId Biggest Id to retrieve
@@ -217,7 +217,7 @@ public class VirtualNetworkPool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's Virtual Networks
* {@link Pool#MINE_GROUP}: Connected user's Virtual Networks, and the ones in
* his group
- * >= 0: UID User's Virtual Networks
+ * >= 0 UID User's Virtual Networks
*
* @param startId Lowest Id to retrieve
* @param endId Biggest Id to retrieve
diff --git a/src/oca/java/src/org/opennebula/client/vrouter/VirtualRouter.java b/src/oca/java/src/org/opennebula/client/vrouter/VirtualRouter.java
index 029b163372..400f137847 100644
--- a/src/oca/java/src/org/opennebula/client/vrouter/VirtualRouter.java
+++ b/src/oca/java/src/org/opennebula/client/vrouter/VirtualRouter.java
@@ -231,6 +231,34 @@ public class VirtualRouter extends PoolElement
return client.call(RENAME, id, name);
}
+ /**
+ * Attaches a NIC to this VirtualRouter, and each one of its VMs
+ *
+ * @param client XML-RPC Client.
+ * @param id The id of the target VirtualRouter.
+ * @param nicTemplate Template containing the new NIC definition
+ * @return If an error occurs the error message contains the reason.
+ */
+ public static OneResponse nicAttach(Client client, int id,
+ String nicTemplate)
+ {
+ return client.call(ATTACHNIC, id, nicTemplate);
+ }
+
+ /**
+ * Detaches a NIC from this VirtualRouter, and each one of its VMs
+ *
+ * @param client XML-RPC Client.
+ * @param id The id of the target VirtualRouter.
+ * @param nicId The NIC_ID of the NIC to detach
+ * @return If an error occurs the error message contains the reason.
+ */
+ public static OneResponse nicDetach(Client client, int id,
+ int nicId)
+ {
+ return client.call(DETACHNIC, id, nicId);
+ }
+
// =================================
// Instanced object XML-RPC methods
// =================================
@@ -435,6 +463,28 @@ public class VirtualRouter extends PoolElement
return rename(client, id, name);
}
+ /**
+ * Attaches a NIC to this VirtualRouter, and each one of its VMs
+ *
+ * @param nicTemplate Template containing the new NIC definition
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse nicAttach(String nicTemplate)
+ {
+ return nicAttach(client, id, nicTemplate);
+ }
+
+ /**
+ * Detaches a NIC from this VirtualRouter, and each one of its VMs
+ *
+ * @param nicId The NIC_ID of the NIC to detach
+ * @return If an error occurs the error message contains the reason.
+ */
+ public OneResponse nicDetach(int nicId)
+ {
+ return nicDetach(client, id, nicId);
+ }
+
// =================================
// Helpers
// =================================
diff --git a/src/oca/java/src/org/opennebula/client/vrouter/VirtualRouterPool.java b/src/oca/java/src/org/opennebula/client/vrouter/VirtualRouterPool.java
index b562e48767..45b8886ef4 100644
--- a/src/oca/java/src/org/opennebula/client/vrouter/VirtualRouterPool.java
+++ b/src/oca/java/src/org/opennebula/client/vrouter/VirtualRouterPool.java
@@ -61,7 +61,7 @@ public class VirtualRouterPool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's VirtualRouters
* {@link Pool#MINE_GROUP}: Connected user's VirtualRouters, and the ones in
* his group
- * >= 0: UID User's VirtualRouters
+ * >= 0 UID User's VirtualRouters
*
*/
public VirtualRouterPool(Client client, int filter)
@@ -89,7 +89,7 @@ public class VirtualRouterPool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's VirtualRouters
* {@link Pool#MINE_GROUP}: Connected user's VirtualRouters, and the ones in
* his group
- * >= 0: UID User's VirtualRouters
+ * >= 0 UID User's VirtualRouters
*
* @return If successful the message contains the string
* with the information returned by OpenNebula.
@@ -147,7 +147,7 @@ public class VirtualRouterPool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's VirtualRouters
* {@link Pool#MINE_GROUP}: Connected user's VirtualRouters, and the ones in
* his group
- * >= 0: UID User's VirtualRouters
+ * >= 0 UID User's VirtualRouters
*
* @param startId Lowest Id to retrieve
* @param endId Biggest Id to retrieve
@@ -219,7 +219,7 @@ public class VirtualRouterPool extends Pool implements Iterable
* {@link Pool#MINE}: Connected user's VirtualRouters
* {@link Pool#MINE_GROUP}: Connected user's VirtualRouters, and the ones in
* his group
- * >= 0: UID User's VirtualRouters
+ * >= 0 UID User's VirtualRouters
*
* @param startId Lowest Id to retrieve
* @param endId Biggest Id to retrieve
diff --git a/src/oca/java/test/AclTest.java b/src/oca/java/test/AclTest.java
index ae1862e945..b2472dc5d1 100644
--- a/src/oca/java/test/AclTest.java
+++ b/src/oca/java/test/AclTest.java
@@ -68,7 +68,7 @@ public class AclTest
{
for(Acl rule : aclPool)
{
- if( rule.id() > 3 )
+ if( rule.id() > 4 )
{
rule.delete();
}
@@ -81,7 +81,7 @@ public class AclTest
res = aclPool.info();
assertTrue( res.getErrorMessage(), !res.isError() );
- assertEquals(4, aclPool.getLength());
+ assertEquals(5, aclPool.getLength());
}
/*
@Test
@@ -240,13 +240,13 @@ public class AclTest
assertTrue( res.getErrorMessage(), !res.isError() );
aclPool.info();
- assertEquals( 5, aclPool.getLength() );
+ assertEquals( 6, aclPool.getLength() );
res = Acl.delete(client, res.getIntMessage());
assertTrue( res.getErrorMessage(), !res.isError() );
aclPool.info();
- assertEquals( 4, aclPool.getLength() );
+ assertEquals( 5, aclPool.getLength() );
}
catch (RuleParseException e)
{
diff --git a/src/oca/java/test/HostTest.java b/src/oca/java/test/HostTest.java
index dca86171e3..d8946c2b18 100644
--- a/src/oca/java/test/HostTest.java
+++ b/src/oca/java/test/HostTest.java
@@ -63,7 +63,7 @@ public class HostTest
@Before
public void setUp() throws Exception
{
- res = Host.allocate(client, name, "dummy", "dummy", "dummy");
+ res = Host.allocate(client, name, "dummy", "dummy");
int hid = !res.isError() ? Integer.parseInt(res.getMessage()) : -1;
host = new Host(hid, client);
@@ -84,7 +84,7 @@ public class HostTest
{
String name = "allocate_test";
- res = Host.allocate(client, name, "im_dummy", "vmm_dummy", "dummy");
+ res = Host.allocate(client, name, "im_dummy", "vmm_dummy");
assertTrue( res.getErrorMessage(), !res.isError() );
// assertTrue( res.getMessage().equals("0") );
diff --git a/src/oca/java/test/VirtualMachineTest.java b/src/oca/java/test/VirtualMachineTest.java
index f018aa9081..41180f48ed 100644
--- a/src/oca/java/test/VirtualMachineTest.java
+++ b/src/oca/java/test/VirtualMachineTest.java
@@ -82,11 +82,11 @@ public class VirtualMachineTest
res = Host.allocate(client, "host_A",
- "dummy", "dummy", "dummy");
+ "dummy", "dummy");
hid_A = Integer.parseInt( res.getMessage() );
res = Host.allocate(client, "host_B",
- "dummy", "dummy", "dummy");
+ "dummy", "dummy");
hid_B = Integer.parseInt( res.getMessage() );
Datastore systemDs = new Datastore(0, client);
@@ -124,7 +124,7 @@ public class VirtualMachineTest
@After
public void tearDown() throws Exception
{
- vm.finalizeVM();
+ vm.recover(3);
waitAssert(vm, "DONE", "-");
vm = null;
@@ -197,29 +197,29 @@ public class VirtualMachineTest
vm.deploy(hid_A);
waitAssert(vm, "ACTIVE", "RUNNING");
- res = vm.liveMigrate(hid_B);
+ res = vm.migrate(hid_B, true);
assertTrue( res.getErrorMessage(), !res.isError() );
waitAssert(vm, "ACTIVE", "RUNNING");
}
@Test
- public void shutdown()
+ public void terminate()
{
vm.deploy(hid_A);
waitAssert(vm, "ACTIVE", "RUNNING");
- res = vm.shutdown();
+ res = vm.terminate();
assertTrue( res.getErrorMessage(), !res.isError() );
waitAssert(vm, "DONE", "-");
}
@Test
- public void cancel()
+ public void terminatehard()
{
vm.deploy(hid_A);
waitAssert(vm, "ACTIVE", "RUNNING");
- res = vm.cancel();
+ res = vm.terminate(true);
assertTrue( res.getErrorMessage(), !res.isError() );
waitAssert(vm, "DONE", "-");
}
@@ -261,11 +261,11 @@ public class VirtualMachineTest
}
@Test
- public void finalizeVM()
+ public void delete()
{
vm.deploy(hid_A);
waitAssert(vm, "ACTIVE", "RUNNING");
- res = vm.finalizeVM();
+ res = vm.recover(3);
assertTrue( res.getErrorMessage(), !res.isError() );
waitAssert(vm, "DONE", "-");
@@ -278,11 +278,11 @@ public class VirtualMachineTest
}
@Test
- public void resubmit()
+ public void deleteRecreate()
{
vm.deploy(hid_A);
waitAssert(vm, "ACTIVE", "RUNNING");
- res = vm.resubmit();
+ res = vm.recover(4);
assertTrue( res.getErrorMessage(), !res.isError() );
waitAssert(vm, "PENDING", "-");
diff --git a/src/oca/java/test/VirtualNetworkTest.java b/src/oca/java/test/VirtualNetworkTest.java
index 80500f25c0..7533a20388 100644
--- a/src/oca/java/test/VirtualNetworkTest.java
+++ b/src/oca/java/test/VirtualNetworkTest.java
@@ -40,12 +40,14 @@ public class VirtualNetworkTest
private static String template =
"NAME = " + name + "\n"+
"BRIDGE = vbr0\n" +
+ "VN_MAD = dummy\n" +
"NETWORK_ADDRESS = 192.168.0.0\n"+
"AR = [ TYPE = IP4, IP = 192.168.0.1, SIZE = 254 ]\n";
private static String second_template =
"NAME = \"Net number one\"\n" +
"BRIDGE = br1\n" +
+ "VN_MAD = dummy\n" +
"AR = [ TYPE = IP4, IP=130.10.0.1, SIZE = 1]";
/**
@@ -74,6 +76,8 @@ public class VirtualNetworkTest
{
res = VirtualNetwork.allocate(client, template);
+ assertTrue( res.getErrorMessage(), !res.isError() );
+
int vnid = !res.isError() ? Integer.parseInt(res.getMessage()) : -1;
vnet = new VirtualNetwork(vnid, client);
}
diff --git a/src/oca/java/test/VirtualRouterTest.java b/src/oca/java/test/VirtualRouterTest.java
index 660a9a262a..59d1f2f037 100644
--- a/src/oca/java/test/VirtualRouterTest.java
+++ b/src/oca/java/test/VirtualRouterTest.java
@@ -44,6 +44,7 @@ public class VirtualRouterTest
private static String template_str =
"NAME = \"" + name + "\"\n" +
+ "VROUTER = YES\n" +
"ATT1 = \"VAL1\"\n" +
"ATT2 = \"VAL2\"";
@@ -98,7 +99,8 @@ public class VirtualRouterTest
vrouter = new VirtualRouter(oid, client);
- vrouterPool.info();
+ res = vrouterPool.info();
+ assertTrue( res.getErrorMessage(), !res.isError() );
boolean found = false;
for(VirtualRouter temp : vrouterPool)
@@ -273,6 +275,7 @@ public class VirtualRouterTest
String tmpl_str =
"NAME = vrtemplate\n"+
"CPU = 0.1\n"+
+ "VROUTER = YES\n"+
"MEMORY = 64\n";
res = Template.allocate(client, tmpl_str);
diff --git a/src/oca/java/test/all_tests.sh b/src/oca/java/test/all_tests.sh
index 1e7b63d775..758bf19c18 100755
--- a/src/oca/java/test/all_tests.sh
+++ b/src/oca/java/test/all_tests.sh
@@ -33,47 +33,54 @@ else
cp oned.conf $ONEDCONF_LOCATION
fi
-export ONE_XMLRPC=http://localhost:2666/RPC2
+export ONE_XMLRPC=http://localhost:2633/RPC2
RC=0
-./test.sh HostTest
+LOG_FILE="/tmp/one-java-test.txt"
+
+rm $LOG_FILE
+
+./test.sh HostTest 2>&1 | tee -a $LOG_FILE
let RC=RC+$?
-./test.sh ImageTest
+./test.sh ImageTest 2>&1 | tee -a $LOG_FILE
let RC=RC+$?
-./test.sh SessionTest
+./test.sh SessionTest 2>&1 | tee -a $LOG_FILE
let RC=RC+$?
-./test.sh UserTest
+./test.sh UserTest 2>&1 | tee -a $LOG_FILE
let RC=RC+$?
-./test.sh VirtualMachineTest
+./test.sh VirtualMachineTest 2>&1 | tee -a $LOG_FILE
let RC=RC+$?
-./test.sh VirtualNetworkTest
+./test.sh VirtualNetworkTest 2>&1 | tee -a $LOG_FILE
let RC=RC+$?
-./test.sh TemplateTest
+./test.sh TemplateTest 2>&1 | tee -a $LOG_FILE
let RC=RC+$?
-./test.sh GroupTest
+./test.sh GroupTest 2>&1 | tee -a $LOG_FILE
let RC=RC+$?
-./test.sh AclTest
+./test.sh AclTest 2>&1 | tee -a $LOG_FILE
let RC=RC+$?
-./test.sh DocumentTest
+./test.sh DocumentTest 2>&1 | tee -a $LOG_FILE
let RC=RC+$?
-./test.sh VdcTest
+./test.sh VdcTest 2>&1 | tee -a $LOG_FILE
let RC=RC+$?
-./test.sh SecurityGroupTest
+./test.sh SecurityGroupTest 2>&1 | tee -a $LOG_FILE
let RC=RC+$?
-./test.sh VirtualRouterTest
+./test.sh VirtualRouterTest 2>&1 | tee -a $LOG_FILE
let RC=RC+$?
+echo ""
+echo "Output saved in $LOG_FILE"
+
exit $RC
\ No newline at end of file
diff --git a/src/oca/java/test/oned.conf b/src/oca/java/test/oned.conf
index ebd387b144..c3da2c7945 100644
--- a/src/oca/java/test/oned.conf
+++ b/src/oca/java/test/oned.conf
@@ -39,13 +39,16 @@
# passwd : (mysql) the password for user
# db_name : (mysql) the database name
#
-# VNC_BASE_PORT: VNC ports for VMs can be automatically set to VNC_BASE_PORT +
-# VMID
+# VNC_PORTS: VNC port pool for automatic VNC port assignment, if possible the
+# port will be set to ``START`` + ``VMID``
+# start : first port to assign
+# reserved: comma separated list of ports
#
# LOG: Configuration for the logging system
# system: defines the logging system:
# file to log in the oned.log file
# syslog to use the syslog facilities
+# std to use the default log stream (stderr) to use with systemd
# debug_level: 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG
#
# VM_SUBMIT_ON_HOLD: Forces VMs to be created on hold state instead of pending.
@@ -53,11 +56,11 @@
#*******************************************************************************
LOG = [
- system = "file",
- debug_level = 3
+ SYSTEM = "file",
+ DEBUG_LEVEL = 3
]
-#MANAGER_TIMER = 30
+#MANAGER_TIMER = 15
MONITORING_INTERVAL = 60
MONITORING_THREADS = 50
@@ -71,21 +74,24 @@ MONITORING_THREADS = 50
SCRIPTS_REMOTE_DIR=/var/tmp/one
-PORT = 2666
+PORT = 2633
LISTEN_ADDRESS = "0.0.0.0"
-DB = [ backend = "sqlite" ]
+DB = [ BACKEND = "sqlite" ]
# Sample configuration for MySQL
-# DB = [ backend = "mysql",
-# server = "localhost",
-# port = 0,
-# user = "oneadmin",
-# passwd = "oneadmin",
-# db_name = "opennebula" ]
+# DB = [ BACKEND = "mysql",
+# SERVER = "localhost",
+# PORT = 0,
+# USER = "oneadmin",
+# PASSWD = "oneadmin",
+# DB_NAME = "opennebula" ]
-VNC_BASE_PORT = 5900
+VNC_PORTS = [
+ START = 5900
+# RESERVED = "6800, 6801, 9869"
+]
#VM_SUBMIT_ON_HOLD = "NO"
@@ -106,8 +112,8 @@ VNC_BASE_PORT = 5900
#*******************************************************************************
FEDERATION = [
- MODE = "STANDALONE",
- ZONE_ID = 0,
+ MODE = "STANDALONE",
+ ZONE_ID = 0,
MASTER_ONED = ""
]
@@ -144,7 +150,8 @@ DEFAULT_COST = [
# a single connection
#
# TIMEOUT: Maximum time in seconds the server will wait for the client to
-# do anything while processing an RPC
+# do anything while processing an RPC. This timeout will be also used when
+# proxy calls to the master in a federation.
#
# RPC_LOG: Create a separated log file for xml-rpc requests, in
# "/var/log/one/one_xmlrpc.log".
@@ -179,37 +186,55 @@ DEFAULT_COST = [
# NETWORK_SIZE: Here you can define the default size for the virtual networks
#
# MAC_PREFIX: Default MAC prefix to be used to create the auto-generated MAC
-# addresses is defined here (this can be overrided by the Virtual Network
+# addresses is defined here (this can be overwritten by the Virtual Network
# template)
+#
+# VLAN_IDS: VLAN ID pool for the automatic VLAN_ID assignment. This pool
+# is for 802.1Q networks (Open vSwitch and 802.1Q drivers). The driver
+# will try first to allocate VLAN_IDS[START] + VNET_ID
+# start: First VLAN_ID to use
+# reserved: Comma separated list of VLAN_IDs
+#
+# VXLAN_IDS: Automatic VXLAN Network ID (VNI) assignment. This is used
+# for vxlan networks.
+# start: First VNI to use
+# NOTE: reserved is not supported by this pool
#*******************************************************************************
NETWORK_SIZE = 254
MAC_PREFIX = "02:00"
+VLAN_IDS = [
+ START = "2",
+ RESERVED = "0, 1, 4095"
+]
+
+VXLAN_IDS = [
+ START = "2"
+]
+
#*******************************************************************************
# DataStore Configuration
#*******************************************************************************
# DATASTORE_LOCATION: Path for Datastores. It IS the same for all the hosts
# and front-end. It defaults to /var/lib/one/datastores (in self-contained mode
-# defaults to $ONE_LOCATION/var/datastores). Each datastore has it's own
+# defaults to $ONE_LOCATION/var/datastores). Each datastore has its own
# directory (called BASE_PATH) in the form: $DATASTORE_LOCATION/
-# You can symlink this direcorty to any other path if needed. BASE_PATH is
+# You can symlink this directory to any other path if needed. BASE_PATH is
# generated from this attribute each time oned is started.
#
# DATASTORE_CAPACITY_CHECK: Checks that there is enough capacity before
-# creating a new imag. Defaults to Yes
+# creating a new image. Defaults to Yes
#
# DEFAULT_IMAGE_TYPE: This can take values
# OS Image file holding an operating system
# CDROM Image file holding a CDROM
-# DATABLOCK Image file holding a datablock,
-# always created as an empty block
+# DATABLOCK Image file holding a datablock, created as an empty block
#
# DEFAULT_DEVICE_PREFIX: This can be set to
# hd IDE prefix
# sd SCSI
-# xvd XEN Virtual Disk
# vd KVM virtual disk
#
# DEFAULT_CDROM_DEVICE_PREFIX: Same as above but for CDROM devices.
@@ -242,23 +267,22 @@ DEFAULT_CDROM_DEVICE_PREFIX = "hd"
#*******************************************************************************
#-------------------------------------------------------------------------------
-# Information Collector for KVM and Xen IM's.
+# Information Collector for KVM IM's.
#-------------------------------------------------------------------------------
-# This driver CANNOT BE ASSIGNED TO A HOST, and needs to be used with KVM or
-# Xen drivers
+# This driver CANNOT BE ASSIGNED TO A HOST, and needs to be used with KVM
# -h prints this help.
-# -a Address to bind the collectd sockect (defults 0.0.0.0)
+# -a Address to bind the collectd socket (default 0.0.0.0)
# -p UDP port to listen for monitor information (default 4124)
# -f Interval in seconds to flush collected information (default 5)
-# -t Number of threads for the server (defult 50)
+# -t Number of threads for the server (default 50)
# -i Time in seconds of the monitorization push cycle. This parameter must
# be smaller than MONITORING_INTERVAL, otherwise push monitorization will
# not be effective.
#-------------------------------------------------------------------------------
IM_MAD = [
- name = "collectd",
- executable = "collectd",
- arguments = "-p 4124 -f 5 -t 50 -i 20" ]
+ NAME = "collectd",
+ EXECUTABLE = "collectd",
+ ARGUMENTS = "-p 4124 -f 5 -t 50 -i 20" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
@@ -267,9 +291,10 @@ IM_MAD = [
# -t number of threads, i.e. number of hosts monitored at the same time
#-------------------------------------------------------------------------------
IM_MAD = [
- name = "kvm",
- executable = "one_im_ssh",
- arguments = "-r 3 -t 15 kvm" ]
+ NAME = "kvm",
+ SUNSTONE_NAME = "KVM",
+ EXECUTABLE = "one_im_ssh",
+ ARGUMENTS = "-r 3 -t 15 kvm" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
@@ -278,58 +303,10 @@ IM_MAD = [
# -t number of threads, i.e. number of hosts monitored at the same time
#-------------------------------------------------------------------------------
# IM_MAD = [
-# name = "kvm",
-# executable = "one_im_ssh",
-# arguments = "-r 3 -t 15 kvm-probes" ]
-#-------------------------------------------------------------------------------
-
-#-------------------------------------------------------------------------------
-# XEN UDP-push Information Driver Manager Configuration
-# -r number of retries when monitoring a host
-# -t number of threads, i.e. number of hosts monitored at the same time
-#-------------------------------------------------------------------------------
-
-# Driver for Xen 3.x
-#IM_MAD = [
-# name = "xen",
-# executable = "one_im_ssh",
-# arguments = "-r 3 -t 15 xen3" ]
-
-# Driver for Xen 4.x
-#IM_MAD = [
-# name = "xen",
-# executable = "one_im_ssh",
-# arguments = "-r 3 -t 15 xen4" ]
-
-#-------------------------------------------------------------------------------
-# XEN SSH-pull Information Driver Manager Configuration
-# -r number of retries when monitoring a host
-# -t number of threads, i.e. number of hosts monitored at the same time
-#-------------------------------------------------------------------------------
-
-# Driver for Xen 3.x
-#IM_MAD = [
-# name = "xen",
-# executable = "one_im_ssh",
-# arguments = "-r 0 -t 15 xen3-probes" ]
-
-# Driver for Xen 4.x
-#IM_MAD = [
-# name = "xen",
-# executable = "one_im_ssh",
-# arguments = "-r 0 -t 15 xen4-probes" ]
-
-#-------------------------------------------------------------------------------
-
-#-------------------------------------------------------------------------------
-# VMware Information Driver Manager Configuration
-# -r number of retries when monitoring a host
-# -t number of threads, i.e. number of hosts monitored at the same time
-#-------------------------------------------------------------------------------
-#IM_MAD = [
-# name = "vmware",
-# executable = "one_im_sh",
-# arguments = "-c -t 15 -r 0 vmware" ]
+# NAME = "kvm",
+# SUNSTONE_NAME = "kvm-ssh",
+# EXECUTABLE = "one_im_ssh",
+# ARGUMENTS = "-r 3 -t 15 kvm-probes" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
@@ -338,9 +315,10 @@ IM_MAD = [
# -t number of threads, i.e. number of hosts monitored at the same time
#-------------------------------------------------------------------------------
#IM_MAD = [
-# name = "vcenter",
-# executable = "one_im_sh",
-# arguments = "-c -t 15 -r 0 vcenter" ]
+# NAME = "vcenter",
+# SUNSTONE_NAME = "VMWare vCenter",
+# EXECUTABLE = "one_im_sh",
+# ARGUMENTS = "-c -t 15 -r 0 vcenter" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
@@ -349,20 +327,10 @@ IM_MAD = [
# -t number of threads, i.e. number of hosts monitored at the same time
#-------------------------------------------------------------------------------
#IM_MAD = [
-# name = "ec2",
-# executable = "one_im_sh",
-# arguments = "-c -t 1 -r 0 ec2" ]
-#-------------------------------------------------------------------------------
-
-#-------------------------------------------------------------------------------
-# SoftLayer Information Driver Manager Configuration
-# -r number of retries when monitoring a host
-# -t number of threads, i.e. number of hosts monitored at the same time
-#-------------------------------------------------------------------------------
-#IM_MAD = [
-# name = "sl",
-# executable = "one_im_sh",
-# arguments = "-c -t 1 -r 0 sl" ]
+# NAME = "ec2",
+# SUNSTONE_NAME = "Amazon EC2",
+# EXECUTABLE = "one_im_sh",
+# ARGUMENTS = "-c -t 1 -r 0 ec2" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
@@ -371,15 +339,16 @@ IM_MAD = [
# -t number of threads, i.e. number of hosts monitored at the same time
#-------------------------------------------------------------------------------
#IM_MAD = [
-# name = "az",
-# executable = "one_im_sh",
-# arguments = "-c -t 1 -r 0 az" ]
+# NAME = "az",
+# SUNSTONE_NAME = "Microsoft Azure",
+# EXECUTABLE = "one_im_sh",
+# ARGUMENTS = "-c -t 1 -r 0 az" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Dummy Information Driver Manager Configuration
#-------------------------------------------------------------------------------
-IM_MAD = [ name="dummy", executable="one_im_dummy"]
+#IM_MAD = [ NAME="dummy", SUNSTONE_NAME="Testing", EXECUTABLE="one_im_dummy"]
#-------------------------------------------------------------------------------
#*******************************************************************************
@@ -401,6 +370,37 @@ IM_MAD = [ name="dummy", executable="one_im_dummy"]
# /etc/one/ if OpenNebula was installed in /)
#
# type : driver type, supported drivers: xen, kvm, xml
+#
+# keep_snapshots: do not remove snapshots on power on/off cycles and live
+# migrations if the hypervisor supports that.
+#
+# imported_vms_actions : comma-separated list of actions supported
+# for imported vms. The available actions are:
+# migrate
+# live-migrate
+# terminate
+# terminate-hard
+# undeploy
+# undeploy-hard
+# hold
+# release
+# stop
+# suspend
+# resume
+# delete
+# delete-recreate
+# reboot
+# reboot-hard
+# resched
+# unresched
+# poweroff
+# poweroff-hard
+# disk-attach
+# disk-detach
+# nic-attach
+# nic-detach
+# snap-create
+# snap-delete
#*******************************************************************************
#-------------------------------------------------------------------------------
@@ -413,67 +413,23 @@ IM_MAD = [ name="dummy", executable="one_im_dummy"]
# An example: "-l migrate=migrate_local,save"
# -p more than one action per host in parallel, needs support from hypervisor
# -s to execute remote commands, bash by default
-# -d detach disks on running VMs before creating/reverting snaps, by default
-# the VM will be suspended
#
# Note: You can use type = "qemu" to use qemu emulated guests, e.g. if your
# CPU does not have virtualization extensions or use nested Qemu-KVM hosts
#-------------------------------------------------------------------------------
VM_MAD = [
- name = "kvm",
- executable = "one_vmm_exec",
- arguments = "-t 15 -r 0 kvm",
- default = "vmm_exec/vmm_exec_kvm.conf",
- type = "kvm" ]
-#-------------------------------------------------------------------------------
+ NAME = "kvm",
+ SUNSTONE_NAME = "KVM",
+ EXECUTABLE = "one_vmm_exec",
+ ARGUMENTS = "-t 15 -r 0 kvm",
+ DEFAULT = "vmm_exec/vmm_exec_kvm.conf",
+ TYPE = "kvm",
+ KEEP_SNAPSHOTS = "no",
+ IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold, release, suspend,
+ resume, delete, reboot, reboot-hard, resched, unresched, disk-attach,
+ disk-detach, nic-attach, nic-detach, snap-create, snap-delete"
+]
-#-------------------------------------------------------------------------------
-# XEN Virtualization Driver Manager Configuration
-# -r number of retries when monitoring a host
-# -t number of threads, i.e. number of hosts monitored at the same time
-# -l actions executed locally, command can be
-# overridden for each action.
-# Valid actions: deploy, shutdown, cancel, save, restore, migrate, poll
-# An example: "-l migrate,save"
-# -p more than one action per host in parallel, needs support from hypervisor
-# -s to execute commands, bash by default
-# -d detach disks on running VMs before creating/reverting snaps, by default
-# the VM will be suspended
-#-------------------------------------------------------------------------------
-#
-# Driver for Xen 3.x
-#VM_MAD = [
-# name = "xen",
-# executable = "one_vmm_exec",
-# arguments = "-t 15 -r 0 xen3",
-# default = "vmm_exec/vmm_exec_xen3.conf",
-# type = "xen" ]
-#
-# Driver for Xen 4.x
-#VM_MAD = [
-# name = "xen",
-# executable = "one_vmm_exec",
-# arguments = "-t 15 -r 0 xen4",
-# default = "vmm_exec/vmm_exec_xen4.conf",
-# type = "xen" ]
-#
-#-------------------------------------------------------------------------------
-
-#-------------------------------------------------------------------------------
-# VMware Virtualization Driver Manager Configuration
-# -r number of retries when monitoring a host
-# -t number of threads, i.e. number of hosts monitored at the same time
-# -p more than one action per host in parallel, needs support from hypervisor
-# -s to execute commands, bash by default
-# -d detach disks on running VMs before creating/reverting snaps, by default
-# the VM will be suspended
-#-------------------------------------------------------------------------------
-#VM_MAD = [
-# name = "vmware",
-# executable = "one_vmm_sh",
-# arguments = "-t 15 -r 0 vmware -s sh",
-# default = "vmm_exec/vmm_exec_vmware.conf",
-# type = "vmware" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
@@ -482,15 +438,22 @@ VM_MAD = [
# -t number of threads, i.e. number of hosts monitored at the same time
# -p more than one action per host in parallel, needs support from hypervisor
# -s to execute commands, bash by default
-# -d detach disks on running VMs before creating/reverting snaps, by default
-# the VM will be suspended
+# -d default snapshot strategy. It can be either 'detach' or 'suspend'. It
+# defaults to 'suspend'.
#-------------------------------------------------------------------------------
#VM_MAD = [
-# name = "vcenter",
-# executable = "one_vmm_sh",
-# arguments = "-p -t 15 -r 0 vcenter -s sh",
-# default = "vmm_exec/vmm_exec_vcenter.conf",
-# type = "xml" ]
+# NAME = "vcenter",
+# SUNSTONE_NAME = "VMWare vCenter",
+# EXECUTABLE = "one_vmm_sh",
+# ARGUMENTS = "-p -t 15 -r 0 vcenter -s sh",
+# DEFAULT = "vmm_exec/vmm_exec_vcenter.conf",
+# TYPE = "xml",
+# KEEP_SNAPSHOTS = "yes",
+# IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold, release, suspend,
+# resume, delete, reboot, reboot-hard, resched, unresched, poweroff,
+# poweroff-hard, disk-attach, disk-detach, nic-attach, nic-detach,
+# snap-create, snap-delete"
+#]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
@@ -499,39 +462,43 @@ VM_MAD = [
# -t number of threads, i.e. number of actions performed at the same time
#-------------------------------------------------------------------------------
#VM_MAD = [
-# name = "ec2",
-# executable = "one_vmm_sh",
-# arguments = "-t 15 -r 0 ec2",
-# type = "xml" ]
+# NAME = "ec2",
+# SUNSTONE_NAME = "Amazon EC2",
+# EXECUTABLE = "one_vmm_sh",
+# ARGUMENTS = "-t 15 -r 0 ec2",
+# TYPE = "xml",
+# KEEP_SNAPSHOTS = "no",
+# IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold, release, suspend,
+# resume, delete, reboot, reboot-hard, resched, unresched, poweroff,
+# poweroff-hard, disk-attach, disk-detach, nic-attach, nic-detach,
+# snap-create, snap-delete"
+#]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
-# SoftLayer Virtualization Driver Manager Configuration
-# -r number of retries when monitoring a host
-# -t number of threads, i.e. number of actions performed at the same time
-#-------------------------------------------------------------------------------
-#VM_MAD = [
-# name = "sl",
-# executable = "one_vmm_sh",
-# arguments = "-t 15 -r 0 sl",
-# type = "xml" ]
-#-------------------------------------------------------------------------------
-
# Azure Virtualization Driver Manager Configuration
# -r number of retries when monitoring a host
# -t number of threads, i.e. number of actions performed at the same time
#-------------------------------------------------------------------------------
#VM_MAD = [
-# name = "az",
-# executable = "one_vmm_sh",
-# arguments = "-t 15 -r 0 az",
-# type = "xml" ]
+# NAME = "az",
+# SUNSTONE_NAME = "Microsoft Azure",
+# EXECUTABLE = "one_vmm_sh",
+# ARGUMENTS = "-t 15 -r 0 az",
+# TYPE = "xml",
+# KEEP_SNAPSHOTS = "no",
+# IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold, release, suspend,
+# resume, delete, reboot, reboot-hard, resched, unresched, poweroff,
+# poweroff-hard, disk-attach, disk-detach, nic-attach, nic-detach,
+# snap-create, snap-delete"
+#]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Dummy Virtualization Driver Configuration
#-------------------------------------------------------------------------------
-VM_MAD = [ name="dummy", executable="one_vmm_dummy", type="xml" ]
+VM_MAD = [ NAME="dummy", SUNSTONE_NAME="Testing", EXECUTABLE="one_vmm_dummy",
+ TYPE="xml" ]
#-------------------------------------------------------------------------------
#*******************************************************************************
@@ -551,8 +518,8 @@ VM_MAD = [ name="dummy", executable="one_vmm_dummy", type="xml" ]
#*******************************************************************************
TM_MAD = [
- executable = "one_tm",
- arguments = "-t 15 -d dummy,lvm,shared,fs_lvm,qcow2,ssh,vmfs,ceph,dev"
+ EXECUTABLE = "one_tm",
+ ARGUMENTS = "-t 15 -d dummy,lvm,shared,fs_lvm,qcow2,ssh,ceph,dev,vcenter,iscsi_libvirt"
]
#*******************************************************************************
@@ -566,11 +533,30 @@ TM_MAD = [
# arguments : for the driver executable
# -t number of threads, i.e. number of repo operations at the same time
# -d datastore mads separated by commas
+# -s system datastore tm drivers, used to monitor shared system ds.
#*******************************************************************************
DATASTORE_MAD = [
- executable = "one_datastore",
- arguments = "-t 15 -d dummy,fs,vmfs,lvm,ceph,dev"
+ EXECUTABLE = "one_datastore",
+ ARGUMENTS = "-t 15 -d dummy,fs,lvm,ceph,dev,iscsi_libvirt,vcenter -s shared,ssh,ceph,fs_lvm,qcow2"
+]
+
+#*******************************************************************************
+# Marketplace Driver Configuration
+#*******************************************************************************
+# Drivers to manage different marketplaces, specialized for the storage backend
+# executable: path of the transfer driver executable, can be an
+# absolute path or relative to $ONE_LOCATION/lib/mads (or
+# /usr/lib/one/mads/ if OpenNebula was installed in /)
+#
+# arguments : for the driver executable
+# -t number of threads, i.e. number of repo operations at the same time
+# -m marketplace mads separated by commas
+#*******************************************************************************
+
+MARKET_MAD = [
+ EXECUTABLE = "one_market",
+ ARGUMENTS = "-t 15 -m http,s3,one"
]
#*******************************************************************************
@@ -651,6 +637,7 @@ DATASTORE_MAD = [
# - NO, The hook is executed in the OpenNebula server (default)
#
# Virtual Network (VNET_HOOK)
+# Virtual Router (VROUTER_HOOK)
# User (USER_HOOK)
# Group (GROUP_HOOK)
# Image (IMAGE_HOOK)
@@ -675,7 +662,7 @@ DATASTORE_MAD = [
# the master OpenNebula.
#-------------------------------------------------------------------------------
HM_MAD = [
- executable = "one_hm" ]
+ EXECUTABLE = "one_hm" ]
#*******************************************************************************
# Fault Tolerance Hooks
@@ -693,11 +680,11 @@ HM_MAD = [
#*******************************************************************************
#
#HOST_HOOK = [
-# name = "error",
-# on = "ERROR",
-# command = "ft/host_error.rb",
-# arguments = "$ID -m -p 5",
-# remote = "no" ]
+# NAME = "error",
+# ON = "ERROR",
+# COMMAND = "ft/host_error.rb",
+# ARGUMENTS = "$ID -m -p 5",
+# REMOTE = "no" ]
#-------------------------------------------------------------------------------
#*******************************************************************************
@@ -736,8 +723,8 @@ HM_MAD = [
#*******************************************************************************
AUTH_MAD = [
- executable = "one_auth_mad",
- authn = "ssh,x509,ldap,server_cipher,server_x509"
+ EXECUTABLE = "one_auth_mad",
+ AUTHN = "ssh,x509,ldap,server_cipher,server_x509"
]
#DEFAULT_AUTH = "default"
@@ -776,9 +763,13 @@ VM_RESTRICTED_ATTR = "DISK/WRITE_BYTES_SEC"
VM_RESTRICTED_ATTR = "DISK/TOTAL_IOPS_SEC"
VM_RESTRICTED_ATTR = "DISK/READ_IOPS_SEC"
VM_RESTRICTED_ATTR = "DISK/WRITE_IOPS_SEC"
+#VM_RESTRICTED_ATTR = "DISK/SIZE"
+VM_RESTRICTED_ATTR = "DISK/ORIGINAL_SIZE"
VM_RESTRICTED_ATTR = "CPU_COST"
VM_RESTRICTED_ATTR = "MEMORY_COST"
VM_RESTRICTED_ATTR = "DISK_COST"
+VM_RESTRICTED_ATTR = "PCI"
+VM_RESTRICTED_ATTR = "USER_INPUTS"
#VM_RESTRICTED_ATTR = "RANK"
#VM_RESTRICTED_ATTR = "SCHED_RANK"
@@ -792,14 +783,14 @@ IMAGE_RESTRICTED_ATTR = "SOURCE"
# Normal VNets do not have restricted attributes.
#*******************************************************************************
+VNET_RESTRICTED_ATTR = "VN_MAD"
VNET_RESTRICTED_ATTR = "PHYDEV"
VNET_RESTRICTED_ATTR = "VLAN_ID"
-VNET_RESTRICTED_ATTR = "VLAN"
VNET_RESTRICTED_ATTR = "BRIDGE"
+VNET_RESTRICTED_ATTR = "AR/VN_MAD"
VNET_RESTRICTED_ATTR = "AR/PHYDEV"
VNET_RESTRICTED_ATTR = "AR/VLAN_ID"
-VNET_RESTRICTED_ATTR = "AR/VLAN"
VNET_RESTRICTED_ATTR = "AR/BRIDGE"
#*******************************************************************************
@@ -826,10 +817,27 @@ VNET_RESTRICTED_ATTR = "AR/BRIDGE"
INHERIT_DATASTORE_ATTR = "CEPH_HOST"
INHERIT_DATASTORE_ATTR = "CEPH_SECRET"
INHERIT_DATASTORE_ATTR = "CEPH_USER"
+INHERIT_DATASTORE_ATTR = "CEPH_CONF"
+INHERIT_DATASTORE_ATTR = "POOL_NAME"
+
+INHERIT_DATASTORE_ATTR = "ISCSI_USER"
+INHERIT_DATASTORE_ATTR = "ISCSI_USAGE"
+INHERIT_DATASTORE_ATTR = "ISCSI_HOST"
+
+INHERIT_IMAGE_ATTR = "ISCSI_USER"
+INHERIT_IMAGE_ATTR = "ISCSI_USAGE"
+INHERIT_IMAGE_ATTR = "ISCSI_HOST"
+INHERIT_IMAGE_ATTR = "ISCSI_IQN"
INHERIT_DATASTORE_ATTR = "GLUSTER_HOST"
INHERIT_DATASTORE_ATTR = "GLUSTER_VOLUME"
+INHERIT_DATASTORE_ATTR = "DISK_TYPE"
+INHERIT_DATASTORE_ATTR = "ADAPTER_TYPE"
+
+INHERIT_IMAGE_ATTR = "DISK_TYPE"
+INHERIT_IMAGE_ATTR = "ADAPTER_TYPE"
+
INHERIT_VNET_ATTR = "VLAN_TAGGED_ID"
INHERIT_VNET_ATTR = "FILTER_IP_SPOOFING"
INHERIT_VNET_ATTR = "FILTER_MAC_SPOOFING"
@@ -855,41 +863,139 @@ INHERIT_VNET_ATTR = "MTU"
# SYSTEM: The image will be cloned in the System datastore
# shared : determines if the storage holding the system datastore is shared
# among the different hosts or not. Valid values: "yes" or "no"
+# ds_migrate : The driver allows migrations across datastores. Valid values:
+# "yes" or "no". Note: THIS ONLY APPLIES TO SYSTEM DS.
#*******************************************************************************
TM_MAD_CONF = [
- name = "dummy", ln_target = "NONE", clone_target = "SYSTEM", shared = "yes"
+ NAME = "dummy", LN_TARGET = "NONE", CLONE_TARGET = "SYSTEM", SHARED = "YES",
+ DS_MIGRATE = "YES"
]
TM_MAD_CONF = [
- name = "lvm", ln_target = "NONE", clone_target = "SELF", shared = "yes"
+ NAME = "lvm", LN_TARGET = "NONE", CLONE_TARGET = "SELF", SHARED = "YES"
]
TM_MAD_CONF = [
- name = "shared", ln_target = "NONE", clone_target = "SYSTEM", shared = "yes"
+ NAME = "shared", LN_TARGET = "NONE", CLONE_TARGET = "SYSTEM", SHARED = "YES",
+ DS_MIGRATE = "YES"
]
TM_MAD_CONF = [
- name = "fs_lvm", ln_target = "SYSTEM", clone_target = "SYSTEM", shared="yes"
+ NAME = "fs_lvm", LN_TARGET = "SYSTEM", CLONE_TARGET = "SYSTEM", SHARED="YES"
]
TM_MAD_CONF = [
- name = "qcow2", ln_target = "NONE", clone_target = "SYSTEM", shared = "yes"
+ NAME = "qcow2", LN_TARGET = "NONE", CLONE_TARGET = "SYSTEM", SHARED = "YES"
]
TM_MAD_CONF = [
- name = "ssh", ln_target = "SYSTEM", clone_target = "SYSTEM", shared = "no"
+ NAME = "ssh", LN_TARGET = "SYSTEM", CLONE_TARGET = "SYSTEM", SHARED = "NO",
+ DS_MIGRATE = "YES"
]
TM_MAD_CONF = [
- name = "vmfs", ln_target = "NONE", clone_target= "SYSTEM", shared = "yes"
+ NAME = "ceph", LN_TARGET = "NONE", CLONE_TARGET = "SELF", SHARED = "YES",
+ DS_MIGRATE = "NO"
]
TM_MAD_CONF = [
- name = "ceph", ln_target = "NONE", clone_target = "SELF", shared = "yes"
+ NAME = "iscsi_libvirt", LN_TARGET = "NONE", CLONE_TARGET = "SELF", SHARED = "YES",
+ DS_MIGRATE = "NO"
]
TM_MAD_CONF = [
- name = "dev", ln_target = "NONE", clone_target = "NONE", shared = "yes"
+ NAME = "dev", LN_TARGET = "NONE", CLONE_TARGET = "NONE", SHARED = "YES"
]
+TM_MAD_CONF = [
+ NAME = "vcenter", LN_TARGET = "NONE", CLONE_TARGET = "NONE", SHARED = "YES"
+]
+
+#*******************************************************************************
+# Datastore Manager Driver Behavior Configuration
+#*******************************************************************************
+# The configuration for each driver is defined in DS_MAD_CONF. These
+# values are used when creating a new datastore and should not be modified
+# since they define the datastore behavior.
+# name : name of the transfer driver, listed in the -d option of the
+# DS_MAD section
+# required_attrs : comma separated list of required attributes in the DS
+# template
+# persistent_only: specifies whether the datastore can only manage persistent
+# images
+#*******************************************************************************
+
+DS_MAD_CONF = [
+ NAME = "ceph",
+ REQUIRED_ATTRS = "DISK_TYPE,BRIDGE_LIST",
+ PERSISTENT_ONLY = "NO",
+ MARKETPLACE_ACTIONS = "export"
+]
+
+DS_MAD_CONF = [
+ NAME = "dev", REQUIRED_ATTRS = "DISK_TYPE", PERSISTENT_ONLY = "YES"
+]
+
+DS_MAD_CONF = [
+ NAME = "iscsi_libvirt", REQUIRED_ATTRS = "DISK_TYPE,ISCSI_HOST",
+ PERSISTENT_ONLY = "YES"
+]
+
+DS_MAD_CONF = [
+ NAME = "dummy", REQUIRED_ATTRS = "", PERSISTENT_ONLY = "NO"
+]
+
+DS_MAD_CONF = [
+ NAME = "fs", REQUIRED_ATTRS = "", PERSISTENT_ONLY = "NO",
+ MARKETPLACE_ACTIONS = "export"
+]
+
+DS_MAD_CONF = [
+ NAME = "lvm", REQUIRED_ATTRS = "DISK_TYPE,BRIDGE_LIST",
+ PERSISTENT_ONLY = "NO"
+]
+
+DS_MAD_CONF = [
+ NAME = "vcenter", REQUIRED_ATTRS = "VCENTER_CLUSTER", PERSISTENT_ONLY = "YES",
+ MARKETPLACE_ACTIONS = "export"
+]
+
+#*******************************************************************************
+# MarketPlace Driver Behavior Configuration
+#*******************************************************************************
+# The configuration for each driver is defined in MARKET_MAD_CONF. These
+# values are used when creating a new marketplaces and should not be modified
+# since they define the marketplace behavior.
+# name : name of the market driver
+# required_attrs : comma separated list of required attributes in the Market
+# template
+# app_actions: List of actions allowed for a MarketPlaceApp
+# - monitor The apps of the marketplace will be monitored
+# - create, the app in the marketplace
+# - delete, the app from the marketplace
+# public: set to yes for external marketplaces. A public marketplace can be
+# removed even if it has registered apps.
+#*******************************************************************************
+
+MARKET_MAD_CONF = [
+ NAME = "one",
+ SUNSTONE_NAME = "OpenNebula.org Marketplace",
+ REQUIRED_ATTRS = "",
+ APP_ACTIONS = "monitor",
+ PUBLIC = "yes"
+]
+
+MARKET_MAD_CONF = [
+ NAME = "http",
+ SUNSTONE_NAME = "HTTP server",
+ REQUIRED_ATTRS = "BASE_URL,PUBLIC_DIR",
+ APP_ACTIONS = "create, delete, monitor"
+]
+
+MARKET_MAD_CONF = [
+ NAME = "s3",
+ SUNSTONE_NAME = "Amazon S3",
+ REQUIRED_ATTRS = "ACCESS_KEY_ID,SECRET_ACCESS_KEY,REGION,BUCKET",
+ APP_ACTIONS = "create, delete, monitor"
+]
diff --git a/src/oca/java/test/test.sh b/src/oca/java/test/test.sh
index ca34d7413c..8927cd288f 100755
--- a/src/oca/java/test/test.sh
+++ b/src/oca/java/test/test.sh
@@ -52,6 +52,9 @@ until grep 'Datastore default (1) successfully monitored' $LOG_LOCATION/oned.log
sleep 1;
done
+echo 'SAFE_DIRS = "/"' > /tmp/one-javatest-ds.txt
+onedatastore update --append 1 /tmp/one-javatest-ds.txt
+
java -cp ../lib/*:../jar/*:$JUNIT_JAR:. org.junit.runner.JUnitCore $1
CODE=$?