diff --git a/include/Nebula.h b/include/Nebula.h index deee3fb633..41fabb9a7a 100644 --- a/include/Nebula.h +++ b/include/Nebula.h @@ -273,12 +273,12 @@ public: static string version() { - return "OpenNebula 3.3.0"; + return "OpenNebula 3.3.80"; }; static string db_version() { - return "3.3.0"; + return "3.3.80"; } void start(); diff --git a/install.sh b/install.sh index c1f9eadc76..84b0157313 100755 --- a/install.sh +++ b/install.sh @@ -1323,6 +1323,8 @@ OZONES_LIB_ZONE_FILES="src/ozones/Server/lib/OZones/Zones.rb \ src/ozones/Server/lib/OZones/AggregatedVirtualNetworks.rb \ src/ozones/Server/lib/OZones/AggregatedPool.rb \ src/ozones/Server/lib/OZones/AggregatedImages.rb \ + src/ozones/Server/lib/OZones/AggregatedDatastores.rb \ + src/ozones/Server/lib/OZones/AggregatedClusters.rb \ src/ozones/Server/lib/OZones/AggregatedTemplates.rb" OZONES_LIB_API_FILES="src/ozones/Client/lib/zona.rb" diff --git a/share/man/SConstruct b/share/man/SConstruct index 774287fd50..6ca1ff5aee 100644 --- a/share/man/SConstruct +++ b/share/man/SConstruct @@ -35,6 +35,8 @@ env.Man('occi-network') env.Man('occi-storage') env.Man('oneacl') env.Man('oneauth') +env.Man('onecluster') +env.Man('onedatastore') env.Man('onedb') env.Man('onehost') env.Man('oneimage') diff --git a/share/man/econe-describe-images.1 b/share/man/econe-describe-images.1 index 4360e7d8b8..fcc6b5ec8c 100644 --- a/share/man/econe-describe-images.1 +++ b/share/man/econe-describe-images.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH OPENNEBULA "1" "February 2012" "OpenNebula 3.3.0" "User Commands" +.TH OPENNEBULA "1" "March 2012" "OpenNebula 3.3.80" "User Commands" .SH NAME OpenNebula \- OpenNebula econe-describe-images .SH SYNOPSIS diff --git a/share/man/econe-describe-instances.1 b/share/man/econe-describe-instances.1 index 5e0a490696..c30a1c7c0f 100644 --- a/share/man/econe-describe-instances.1 +++ b/share/man/econe-describe-instances.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH OPENNEBULA "1" "February 2012" "OpenNebula 3.3.0" "User Commands" +.TH OPENNEBULA "1" "March 2012" "OpenNebula 3.3.80" "User Commands" .SH NAME OpenNebula \- OpenNebula econe-describe-instances .SH SYNOPSIS diff --git a/share/man/econe-register.1 b/share/man/econe-register.1 index 5a2efa12b1..5ff6eafe27 100644 --- a/share/man/econe-register.1 +++ b/share/man/econe-register.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH OPENNEBULA "1" "February 2012" "OpenNebula 3.3.0" "User Commands" +.TH OPENNEBULA "1" "March 2012" "OpenNebula 3.3.80" "User Commands" .SH NAME OpenNebula \- OpenNebula econe-register .SH SYNOPSIS diff --git a/share/man/econe-run-instances.1 b/share/man/econe-run-instances.1 index b1b686439f..a34fcd875b 100644 --- a/share/man/econe-run-instances.1 +++ b/share/man/econe-run-instances.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH OPENNEBULA "1" "February 2012" "OpenNebula 3.3.0" "User Commands" +.TH OPENNEBULA "1" "March 2012" "OpenNebula 3.3.80" "User Commands" .SH NAME OpenNebula \- OpenNebula econe-run-instances .SH SYNOPSIS diff --git a/share/man/econe-terminate-instances.1 b/share/man/econe-terminate-instances.1 index 0bb112286f..9259791954 100644 --- a/share/man/econe-terminate-instances.1 +++ b/share/man/econe-terminate-instances.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH OPENNEBULA "1" "February 2012" "OpenNebula 3.3.0" "User Commands" +.TH OPENNEBULA "1" "March 2012" "OpenNebula 3.3.80" "User Commands" .SH NAME OpenNebula \- OpenNebula econe-terminate-instances .SH SYNOPSIS diff --git a/share/man/econe-upload.1 b/share/man/econe-upload.1 index 3b28a415d5..3404363225 100644 --- a/share/man/econe-upload.1 +++ b/share/man/econe-upload.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH OPENNEBULA "1" "September 2011" "OpenNebula 3.3.0" "User Commands" +.TH OPENNEBULA "1" "September 2011" "OpenNebula 3.3.80" "User Commands" .SH NAME OpenNebula \- OpenNebula econe-upload .SH SYNOPSIS diff --git a/share/man/occi-compute.1 b/share/man/occi-compute.1 index 8da520ee83..382416410e 100644 --- a/share/man/occi-compute.1 +++ b/share/man/occi-compute.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH OPENNEBULA "1" "February 2012" "OpenNebula 3.3.0" "User Commands" +.TH OPENNEBULA "1" "March 2012" "OpenNebula 3.3.80" "User Commands" .SH NAME OpenNebula \- OpenNebula occi-compute .SH SYNOPSIS diff --git a/share/man/occi-network.1 b/share/man/occi-network.1 index ab3414993a..598ee1f74b 100644 --- a/share/man/occi-network.1 +++ b/share/man/occi-network.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH OPENNEBULA "1" "February 2012" "OpenNebula 3.3.0" "User Commands" +.TH OPENNEBULA "1" "March 2012" "OpenNebula 3.3.80" "User Commands" .SH NAME OpenNebula \- OpenNebula occi-network .SH SYNOPSIS diff --git a/share/man/occi-storage.1 b/share/man/occi-storage.1 index 50f340f9ad..d4367a4b53 100644 --- a/share/man/occi-storage.1 +++ b/share/man/occi-storage.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH OPENNEBULA "1" "February 2012" "OpenNebula 3.3.0" "User Commands" +.TH OPENNEBULA "1" "March 2012" "OpenNebula 3.3.80" "User Commands" .SH NAME OpenNebula \- OpenNebula occi-storage .SH SYNOPSIS diff --git a/share/man/oneacl.1 b/share/man/oneacl.1 index 96215cf3b1..7f0d8e8647 100644 --- a/share/man/oneacl.1 +++ b/share/man/oneacl.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "ONEACL" "1" "February 2012" "" "oneacl(1) -- manages OpenNebula ACLs" +.TH "ONEACL" "1" "March 2012" "" "oneacl(1) -- manages OpenNebula ACLs" . .SH "NAME" \fBoneacl\fR @@ -128,7 +128,7 @@ Comma\-separated list of OpenNebula ACL names or ids .IP "" 0 . .SH "LICENSE" -OpenNebula 3\.3\.0 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) +OpenNebula 3\.3\.80 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) . .P 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 diff --git a/share/man/onecluster.1 b/share/man/onecluster.1 new file mode 100644 index 0000000000..ab6cbf45be --- /dev/null +++ b/share/man/onecluster.1 @@ -0,0 +1,292 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "ONECLUSTER" "1" "March 2012" "" "onecluster(1) -- manages OpenNebula clusters" +. +.SH "NAME" +\fBonecluster\fR +. +.SH "SYNOPSIS" +\fBonecluster\fR \fIcommand\fR [\fIargs\fR] [\fIoptions\fR] +. +.SH "OPTIONS" +. +.nf + + \-l, \-\-list x,y,z Selects columns to display with list command + \-d, \-\-delay x Sets the delay in seconds for top command + \-x, \-\-xml Show the resource in xml format + \-n, \-\-numeric Do not translate user and group IDs + \-v, \-\-verbose Verbose mode + \-h, \-\-help Show this message + \-V, \-\-version Show version and copyright information +. +.fi +. +.SH "COMMANDS" +. +.IP "\(bu" 4 +create \fIname\fR +. +.IP "" 4 +. +.nf + +Creates a new Cluster +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +delete \fIrange|clusterid_list\fR +. +.IP "" 4 +. +.nf + +Deletes the given Cluster +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +list +. +.IP "" 4 +. +.nf + +Lists Clusters in the pool +valid options: list, delay, xml, numeric +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +show \fIclusterid\fR +. +.IP "" 4 +. +.nf + +Shows information for the given Cluster +valid options: xml +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +addhost \fIclusterid\fR \fIhostid\fR +. +.IP "" 4 +. +.nf + +Adds a Host to the given Cluster +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +delhost \fIclusterid\fR \fIhostid\fR +. +.IP "" 4 +. +.nf + +Deletes a Host from the given Cluster +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +adddatastore \fIclusterid\fR \fIdatastoreid\fR +. +.IP "" 4 +. +.nf + +Adds a Datastore to the given Cluster +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +deldatastore \fIclusterid\fR \fIdatastoreid\fR +. +.IP "" 4 +. +.nf + +Deletes a Datastore from the given Cluster +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +addvnet \fIclusterid\fR \fIvnetid\fR +. +.IP "" 4 +. +.nf + +Adds a Virtual Network to the given Cluster +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +delvnet \fIclusterid\fR \fIvnetid\fR +. +.IP "" 4 +. +.nf + +Deletes a Virtual Network from the given Cluster +. +.fi +. +.IP "" 0 + +. +.IP "" 0 +. +.SH "ARGUMENT FORMATS" +. +.IP "\(bu" 4 +file +. +.IP "" 4 +. +.nf + +Path to a file +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +range +. +.IP "" 4 +. +.nf + +List of id\'s in the form 1,8\.\.15 +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +text +. +.IP "" 4 +. +.nf + +String +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +clusterid +. +.IP "" 4 +. +.nf + +OpenNebula CLUSTER name or id +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +clusterid_list +. +.IP "" 4 +. +.nf + +Comma\-separated list of OpenNebula CLUSTER names or ids +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +vnetid +. +.IP "" 4 +. +.nf + +OpenNebula VNET name or id +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +hostid +. +.IP "" 4 +. +.nf + +OpenNebula HOST name or id +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +datastoreid +. +.IP "" 4 +. +.nf + +OpenNebula DATASTORE name or id +. +.fi +. +.IP "" 0 + +. +.IP "" 0 +. +.SH "LICENSE" +OpenNebula 3\.3\.80 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) +. +.P +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 diff --git a/share/man/onedatastore.1 b/share/man/onedatastore.1 new file mode 100644 index 0000000000..107c0bbf6b --- /dev/null +++ b/share/man/onedatastore.1 @@ -0,0 +1,266 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "ONEDATASTORE" "1" "March 2012" "" "onedatastore(1) -- manages OpenNebula datastores" +. +.SH "NAME" +\fBonedatastore\fR +. +.SH "SYNOPSIS" +\fBonedatastore\fR \fIcommand\fR [\fIargs\fR] [\fIoptions\fR] +. +.SH "OPTIONS" +. +.nf + + \-c, \-\-cluster id|name Selects the cluster + \-l, \-\-list x,y,z Selects columns to display with list command + \-d, \-\-delay x Sets the delay in seconds for top command + \-x, \-\-xml Show the resource in xml format + \-n, \-\-numeric Do not translate user and group IDs + \-v, \-\-verbose Verbose mode + \-h, \-\-help Show this message + \-V, \-\-version Show version and copyright information +. +.fi +. +.SH "COMMANDS" +. +.IP "\(bu" 4 +create \fIfile\fR +. +.IP "" 4 +. +.nf + +Creates a new Datastore from the given template file +valid options: cluster +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +delete \fIrange|datastoreid_list\fR +. +.IP "" 4 +. +.nf + +Deletes the given Datastore +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +chgrp \fIrange|datastoreid_list\fR \fIgroupid\fR +. +.IP "" 4 +. +.nf + +Changes the Datastore group +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +chown \fIrange|datastoreid_list\fR \fIuserid\fR [\fIgroupid\fR] +. +.IP "" 4 +. +.nf + +Changes the Datastore owner and group +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +chmod \fIrange|datastoreid_list\fR \fIoctet\fR +. +.IP "" 4 +. +.nf + +Changes the Datastore permissions +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +list +. +.IP "" 4 +. +.nf + +Lists Datastores in the pool +valid options: list, delay, xml, numeric +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +show \fIdatastoreid\fR +. +.IP "" 4 +. +.nf + +Shows information for the given Datastore +valid options: xml +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +update \fIdatastoreid\fR +. +.IP "" 4 +. +.nf + +Launches the system editor to modify and update the template contents +. +.fi +. +.IP "" 0 + +. +.IP "" 0 +. +.SH "ARGUMENT FORMATS" +. +.IP "\(bu" 4 +file +. +.IP "" 4 +. +.nf + +Path to a file +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +range +. +.IP "" 4 +. +.nf + +List of id\'s in the form 1,8\.\.15 +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +text +. +.IP "" 4 +. +.nf + +String +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +datastoreid +. +.IP "" 4 +. +.nf + +OpenNebula DATASTORE name or id +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +datastoreid_list +. +.IP "" 4 +. +.nf + +Comma\-separated list of OpenNebula DATASTORE names or ids +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +clusterid +. +.IP "" 4 +. +.nf + +OpenNebula CLUSTER name or id +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +groupid +. +.IP "" 4 +. +.nf + +OpenNebula GROUP name or id +. +.fi +. +.IP "" 0 + +. +.IP "\(bu" 4 +userid +. +.IP "" 4 +. +.nf + +OpenNebula USER name or id +. +.fi +. +.IP "" 0 + +. +.IP "" 0 +. +.SH "LICENSE" +OpenNebula 3\.3\.80 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) +. +.P +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 diff --git a/share/man/onedb.1 b/share/man/onedb.1 index fc460471bd..8cb567a562 100644 --- a/share/man/onedb.1 +++ b/share/man/onedb.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "ONEDB" "1" "February 2012" "" "onedb(1) -- OpenNebula database migration tool" +.TH "ONEDB" "1" "March 2012" "" "onedb(1) -- OpenNebula database migration tool" . .SH "NAME" \fBonedb\fR diff --git a/share/man/onegroup.1 b/share/man/onegroup.1 index a3c8f50f51..7430645366 100644 --- a/share/man/onegroup.1 +++ b/share/man/onegroup.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "ONEGROUP" "1" "February 2012" "" "onegroup(1) -- manages OpenNebula groups" +.TH "ONEGROUP" "1" "March 2012" "" "onegroup(1) -- manages OpenNebula groups" . .SH "NAME" \fBonegroup\fR @@ -160,7 +160,7 @@ Comma\-separated list of OpenNebula GROUP names or ids .IP "" 0 . .SH "LICENSE" -OpenNebula 3\.3\.0 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) +OpenNebula 3\.3\.80 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) . .P 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 diff --git a/share/man/onehost.1 b/share/man/onehost.1 index f73815a8ee..0b35222ea0 100644 --- a/share/man/onehost.1 +++ b/share/man/onehost.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "ONEHOST" "1" "February 2012" "" "onehost(1) -- manages OpenNebula hosts" +.TH "ONEHOST" "1" "March 2012" "" "onehost(1) -- manages OpenNebula hosts" . .SH "NAME" \fBonehost\fR @@ -13,6 +13,10 @@ . .nf + \-i, \-\-im im_mad Set the information driver for the host + \-v, \-\-vm vmm_mad Set the virtualization driver for the host + \-n, \-\-net vnet_mad Set the network driver for the host + \-c, \-\-cluster id|name Selects the cluster \-l, \-\-list x,y,z Selects columns to display with list command \-d, \-\-delay x Sets the delay in seconds for top command \-x, \-\-xml Show the resource in xml format @@ -27,13 +31,14 @@ .SH "COMMANDS" . .IP "\(bu" 4 -create \fIhostname\fR \fIim_mad\fR \fIvmm_mad\fR \fItm_mad\fR \fIvnm_mad\fR +create \fIhostname\fR . .IP "" 4 . .nf Creates a new Host +valid options: im, vmm, vnm, cluster . .fi . @@ -234,7 +239,7 @@ Comma\-separated list of OpenNebula HOST names or ids .IP "" 0 . .SH "LICENSE" -OpenNebula 3\.3\.0 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) +OpenNebula 3\.3\.80 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) . .P 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 diff --git a/share/man/oneimage.1 b/share/man/oneimage.1 index e63e257858..fc39d0dc35 100644 --- a/share/man/oneimage.1 +++ b/share/man/oneimage.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "ONEIMAGE" "1" "February 2012" "" "oneimage(1) -- manages OpenNebula images" +.TH "ONEIMAGE" "1" "March 2012" "" "oneimage(1) -- manages OpenNebula images" . .SH "NAME" \fBoneimage\fR @@ -13,6 +13,7 @@ . .nf + \-d, \-\-datastore id|name Selects the datastore \-l, \-\-list x,y,z Selects columns to display with list command \-d, \-\-delay x Sets the delay in seconds for top command \-x, \-\-xml Show the resource in xml format @@ -33,6 +34,7 @@ create \fIfile\fR .nf Creates a new Image from the given template file +valid options: datastore . .fi . @@ -381,7 +383,7 @@ user IMAGE of the user identified by the username .IP "" 0 . .SH "LICENSE" -OpenNebula 3\.3\.0 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) +OpenNebula 3\.3\.80 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) . .P 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 diff --git a/share/man/onetemplate.1 b/share/man/onetemplate.1 index cca82c5d33..8e282b2b2d 100644 --- a/share/man/onetemplate.1 +++ b/share/man/onetemplate.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "ONETEMPLATE" "1" "February 2012" "" "onetemplate(1) -- manages OpenNebula templates" +.TH "ONETEMPLATE" "1" "March 2012" "" "onetemplate(1) -- manages OpenNebula templates" . .SH "NAME" \fBonetemplate\fR @@ -330,7 +330,7 @@ user VMTEMPLATE of the user identified by the username .IP "" 0 . .SH "LICENSE" -OpenNebula 3\.3\.0 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) +OpenNebula 3\.3\.80 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) . .P 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 diff --git a/share/man/oneuser.1 b/share/man/oneuser.1 index 12fb7016b8..7ed8ccf62b 100644 --- a/share/man/oneuser.1 +++ b/share/man/oneuser.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "ONEUSER" "1" "February 2012" "" "oneuser(1) -- manages OpenNebula users" +.TH "ONEUSER" "1" "March 2012" "" "oneuser(1) -- manages OpenNebula users" . .SH "NAME" \fBoneuser\fR @@ -305,7 +305,7 @@ User password .IP "" 0 . .SH "LICENSE" -OpenNebula 3\.3\.0 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) +OpenNebula 3\.3\.80 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) . .P 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 diff --git a/share/man/onevdc.1 b/share/man/onevdc.1 index acfe8524f9..3451d31435 100644 --- a/share/man/onevdc.1 +++ b/share/man/onevdc.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "ONEVDC" "1" "February 2012" "" "onevdc(1) -- manages OpenNebula Virtual DataCenters" +.TH "ONEVDC" "1" "March 2012" "" "onevdc(1) -- manages OpenNebula Virtual DataCenters" . .SH "NAME" \fBonevdc\fR @@ -14,6 +14,10 @@ .nf \-f, \-\-force Force the usage of Hosts in more than one VDC + \-j, \-\-json Show the resource in JSON format + \-s, \-\-hosts 1,2,3 Host IDs + \-d, \-\-datastores 1,2,3 Datastore IDs + \-n, \-\-networks 1,2,3 Network IDs \-v, \-\-verbose Verbose mode \-h, \-\-help Show this message \-V, \-\-version Show version and copyright information @@ -45,6 +49,7 @@ show \fIvdcid\fR .nf Show information of a particular VDC +valid options: json . .fi . @@ -59,6 +64,7 @@ list .nf Lists VDCs in the pool +valid options: json . .fi . @@ -80,14 +86,14 @@ Deletes a VDC . .IP "\(bu" 4 -addhost \fIvdcid\fR \fIrange\fR +add \fIvdcid\fR . .IP "" 4 . .nf -Adds the set of hosts to the VDC -valid options: force +Adds the set of resources to the VDC +valid options: force, hosts, datastores, networks . .fi . @@ -95,13 +101,14 @@ valid options: force . .IP "\(bu" 4 -delhost \fIvdcid\fR \fIrange\fR +del \fIvdcid\fR . .IP "" 4 . .nf -Deletes the set of hosts from the VDC +Deletes the set of resources from the VDC +valid options: hosts, datastores, networks . .fi . @@ -171,7 +178,7 @@ VDC ID .IP "" 0 . .SH "LICENSE" -OpenNebula 3\.3\.0 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) +OpenNebula 3\.3\.80 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) . .P 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 diff --git a/share/man/onevm.1 b/share/man/onevm.1 index 3798929421..eed0e1bbd9 100644 --- a/share/man/onevm.1 +++ b/share/man/onevm.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "ONEVM" "1" "February 2012" "" "onevm(1) -- manages OpenNebula virtual machines" +.TH "ONEVM" "1" "March 2012" "" "onevm(1) -- manages OpenNebula virtual machines" . .SH "NAME" \fBonevm\fR @@ -526,7 +526,7 @@ user VM of the user identified by the username .IP "" 0 . .SH "LICENSE" -OpenNebula 3\.3\.0 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) +OpenNebula 3\.3\.80 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) . .P 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 diff --git a/share/man/onevnet.1 b/share/man/onevnet.1 index 3e155b169f..8c3abf3ced 100644 --- a/share/man/onevnet.1 +++ b/share/man/onevnet.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "ONEVNET" "1" "February 2012" "" "onevnet(1) -- manages OpenNebula networks" +.TH "ONEVNET" "1" "March 2012" "" "onevnet(1) -- manages OpenNebula networks" . .SH "NAME" \fBonevnet\fR @@ -13,6 +13,7 @@ . .nf + \-c, \-\-cluster id|name Selects the cluster \-l, \-\-list x,y,z Selects columns to display with list command \-d, \-\-delay x Sets the delay in seconds for top command \-x, \-\-xml Show the resource in xml format @@ -34,6 +35,7 @@ create \fIfile\fR .nf Creates a new Virtual Network from the given template file +valid options: cluster . .fi . @@ -351,7 +353,7 @@ user VNET of the user identified by the username .IP "" 0 . .SH "LICENSE" -OpenNebula 3\.3\.0 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) +OpenNebula 3\.3\.80 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) . .P 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 diff --git a/share/man/onezone.1 b/share/man/onezone.1 index ebcfe58c9c..2387747986 100644 --- a/share/man/onezone.1 +++ b/share/man/onezone.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "ONEZONE" "1" "February 2012" "" "onezone(1) -- manages OpenNebula zones" +.TH "ONEZONE" "1" "March 2012" "" "onezone(1) -- manages OpenNebula zones" . .SH "NAME" \fBonezone\fR @@ -13,6 +13,7 @@ . .nf + \-j, \-\-json Show the resource in JSON format \-v, \-\-verbose Verbose mode \-h, \-\-help Show this message \-V, \-\-version Show version and copyright information @@ -43,10 +44,12 @@ show \fIzoneid\fR [\fIresource\fR] .nf Show information of a particular Zone -Available resources: host, vm, image, vnet, vmtemplate, user +Available resources: host, vm, image, vnet, vmtemplate, + user, cluster, datastore Examples: onezone show 4 onezone show 4 host +valid options: json . .fi . @@ -61,6 +64,7 @@ list .nf Lists Zones in the pool +valid options: json . .fi . @@ -144,7 +148,7 @@ Zone ID .IP "" 0 . .SH "LICENSE" -OpenNebula 3\.3\.0 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) +OpenNebula 3\.3\.80 Copyright 2002\-2012, OpenNebula Project Leads (OpenNebula\.org) . .P 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 diff --git a/src/authm_mad/remotes/quota/quota.rb b/src/authm_mad/remotes/quota/quota.rb index fedddd5f3e..e7a94b166e 100644 --- a/src/authm_mad/remotes/quota/quota.rb +++ b/src/authm_mad/remotes/quota/quota.rb @@ -17,6 +17,8 @@ require 'sequel' require 'base64' require 'yaml' +require 'uri' +require 'net/http' class Quota ########################################################################### @@ -82,7 +84,15 @@ class Quota if template['TYPE'] == 'DATABLOCK' template['SIZE'].to_i elsif template['PATH'] - (File.size(template['PATH']).to_f / 2**20).round + uri = URI.parse(template['PATH']) + size = if uri.scheme.nil? + File.size(template['PATH']) + else + Net::HTTP.start(uri.host,uri.port) { |http| + http.head(uri.path) + }.content_length + end + (size.to_f / 2**20).round elsif template['SAVED_VM_ID'] vm_id = template['SAVED_VM_ID'].to_i disk_id = template['SAVED_DISK_ID'].to_i diff --git a/src/cli/one_helper.rb b/src/cli/one_helper.rb index 50cc513fc1..257a77d128 100644 --- a/src/cli/one_helper.rb +++ b/src/cli/one_helper.rb @@ -21,7 +21,7 @@ include OpenNebula module OpenNebulaHelper ONE_VERSION=<<-EOT -OpenNebula 3.3.0 +OpenNebula 3.3.80 Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) Licensed under the Apache License, Version 2.0 (the "License"); you may diff --git a/src/cloud/common/CloudClient.rb b/src/cloud/common/CloudClient.rb index a6006b66dd..e2c360e3ca 100644 --- a/src/cloud/common/CloudClient.rb +++ b/src/cloud/common/CloudClient.rb @@ -181,7 +181,7 @@ module CloudCLI def version_text version=< diff --git a/src/datastore_mad/remotes/iscsi/cp b/src/datastore_mad/remotes/iscsi/cp index e7de096d11..7eb8c4bd83 100755 --- a/src/datastore_mad/remotes/iscsi/cp +++ b/src/datastore_mad/remotes/iscsi/cp @@ -61,7 +61,7 @@ BASE_PATH="${XPATH_ELEMENTS[0]}" RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}" SAFE_DIRS="${XPATH_ELEMENTS[2]}" UMASK="${XPATH_ELEMENTS[3]}" -DST_HOST="${XPATH_ELEMENTS[4]}" +DST_HOST="${XPATH_ELEMENTS[4]:-$HOST}" VG_NAME="${XPATH_ELEMENTS[5]:-$VG_NAME}" BASE_IQN="${XPATH_ELEMENTS[6]:-$BASE_IQN}" BASE_TID="${XPATH_ELEMENTS[7]:-$BASE_TID}" diff --git a/src/datastore_mad/remotes/iscsi/iscsi.conf b/src/datastore_mad/remotes/iscsi/iscsi.conf index 2938398891..f8a175f2d8 100644 --- a/src/datastore_mad/remotes/iscsi/iscsi.conf +++ b/src/datastore_mad/remotes/iscsi/iscsi.conf @@ -14,6 +14,9 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +# Default iSCSI target host +HOST=localhost + # Default IQN path BASE_IQN=iqn.2012-02.org.opennebula diff --git a/src/datastore_mad/remotes/iscsi/mkfs b/src/datastore_mad/remotes/iscsi/mkfs index 636f1a5197..c06d64ce6b 100755 --- a/src/datastore_mad/remotes/iscsi/mkfs +++ b/src/datastore_mad/remotes/iscsi/mkfs @@ -62,7 +62,7 @@ BASE_PATH="${XPATH_ELEMENTS[0]}" RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}" SAFE_DIRS="${XPATH_ELEMENTS[2]}" UMASK="${XPATH_ELEMENTS[3]}" -DST_HOST="${XPATH_ELEMENTS[4]}" +DST_HOST="${XPATH_ELEMENTS[4]:-$HOST}" VG_NAME="${XPATH_ELEMENTS[5]:-$VG_NAME}" BASE_IQN="${XPATH_ELEMENTS[6]:-$BASE_IQN}" BASE_TID="${XPATH_ELEMENTS[7]:-$BASE_TID}" diff --git a/src/datastore_mad/remotes/iscsi/rm b/src/datastore_mad/remotes/iscsi/rm index 7b05a7fcf4..3fb58c5710 100755 --- a/src/datastore_mad/remotes/iscsi/rm +++ b/src/datastore_mad/remotes/iscsi/rm @@ -49,7 +49,7 @@ done < <($XPATH /DS_DRIVER_ACTION_DATA/IMAGE/SOURCE \ /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BASE_TID) SRC="${XPATH_ELEMENTS[0]}" -DST_HOST="${XPATH_ELEMENTS[1]}" +DST_HOST="${XPATH_ELEMENTS[1]:-$HOST}" BASE_TID="${XPATH_ELEMENTS[2]:-$BASE_TID}" BASE_IQN=`echo $SRC|$CUT -d: -f1` diff --git a/src/image/ImageManagerActions.cc b/src/image/ImageManagerActions.cc index ad1b8e2627..58f41d3d33 100644 --- a/src/image/ImageManagerActions.cc +++ b/src/image/ImageManagerActions.cc @@ -296,6 +296,7 @@ int ImageManager::delete_image(int iid, const string& ds_data) if ( imd == 0 ) { + img->unlock(); return -1; } diff --git a/src/oca/java/build.sh b/src/oca/java/build.sh index 4aecb6b16d..14d3ad1694 100755 --- a/src/oca/java/build.sh +++ b/src/oca/java/build.sh @@ -124,6 +124,12 @@ do_clean() find share/examples -name '*.class' -delete find test/ -name '*.class' -delete + + echo "Cleaning javadoc files..." + rm -rf $DOC_DIR > /dev/null 2>&1 + + echo "Cleaning jar files..." + rm -rf $JAR_DIR > /dev/null 2>&1 } if [ "$DO_CLEAN" = "yes" ] ; then diff --git a/src/oca/java/src/org/opennebula/client/PoolElement.java b/src/oca/java/src/org/opennebula/client/PoolElement.java index a478b26f11..28f1831772 100644 --- a/src/oca/java/src/org/opennebula/client/PoolElement.java +++ b/src/oca/java/src/org/opennebula/client/PoolElement.java @@ -1,12 +1,12 @@ /******************************************************************************* * Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) - * + * * 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. @@ -59,7 +59,7 @@ public abstract class PoolElement { /** * Creates a new PoolElement from the xml provided. - * + * * @param client XML-RPC Client. * @param xmlElement XML representation of the element. */ @@ -102,7 +102,7 @@ public abstract class PoolElement { /** * Changes the permissions - * + * * @param client XML-RPC Client. * @param method XML-RPC method. * @param id The id of the target object. @@ -130,11 +130,11 @@ public abstract class PoolElement { /** * Changes the permissions - * + * * @param client XML-RPC Client. * @param method XML-RPC method. * @param id The id of the target object. - * @param octet Permissions octed , e.g. 640 + * @param octet Permissions octet, e.g. 640 * @return If an error occurs the error message contains the reason. */ protected static OneResponse chmod(Client client, String method, int id, @@ -158,7 +158,7 @@ public abstract class PoolElement { /** * Changes the permissions - * + * * @param client XML-RPC Client. * @param method XML-RPC method. * @param id The id of the target object. @@ -207,7 +207,7 @@ public abstract class PoolElement { /** * Returns the owner User's ID, or -1 if the element doesn't have one. - * + * * @return the owner User's ID, or -1 if the element doesn't have one. */ public int uid() @@ -229,7 +229,7 @@ public abstract class PoolElement { /** * Returns the element group's ID, or -1 if the element doesn't have one. - * + * * @return the element group's ID, or -1 if the element doesn't have one. */ public int gid() 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 c95fb69a77..cc5c1d762e 100644 --- a/src/oca/java/src/org/opennebula/client/acl/Acl.java +++ b/src/oca/java/src/org/opennebula/client/acl/Acl.java @@ -64,6 +64,8 @@ public class Acl extends PoolElement{ tmpResources.put("USER" , 0x0000010000000000L); tmpResources.put("TEMPLATE" , 0x0000020000000000L); tmpResources.put("GROUP" , 0x0000040000000000L); + tmpResources.put("DATASTORE", 0x0000100000000000L); + tmpResources.put("CLUSTER" , 0x0000200000000000L); RESOURCES = Collections.unmodifiableMap(tmpResources); diff --git a/src/oca/java/src/org/opennebula/client/cluster/Cluster.java b/src/oca/java/src/org/opennebula/client/cluster/Cluster.java new file mode 100644 index 0000000000..fdf1b75703 --- /dev/null +++ b/src/oca/java/src/org/opennebula/client/cluster/Cluster.java @@ -0,0 +1,321 @@ +/******************************************************************************* + * Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) + * + * 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.cluster; + +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 cluster. + * It also offers static XML-RPC call wrappers. + */ +public class Cluster extends PoolElement{ + + private static final String METHOD_PREFIX = "cluster."; + private static final String ALLOCATE = METHOD_PREFIX + "allocate"; + private static final String DELETE = METHOD_PREFIX + "delete"; + private static final String INFO = METHOD_PREFIX + "info"; + private static final String ADDHOST = METHOD_PREFIX + "addhost"; + private static final String DELHOST = METHOD_PREFIX + "delhost"; + private static final String ADDDATASTORE = METHOD_PREFIX + "adddatastore"; + private static final String DELDATASTORE = METHOD_PREFIX + "deldatastore"; + private static final String ADDVNET = METHOD_PREFIX + "addvnet"; + private static final String DELVNET = METHOD_PREFIX + "delvnet"; + + /** + * Creates a new Cluster representation. + * + * @param id The cluster id. + * @param client XML-RPC Client. + */ + public Cluster(int id, Client client) + { + super(id, client); + } + + /** + * @see PoolElement + */ + protected Cluster(Node xmlElement, Client client) + { + super(xmlElement, client); + } + + + // ================================= + // Static XML-RPC methods + // ================================= + + /** + * Allocates a new cluster in OpenNebula + * + * @param client XML-RPC Client. + * @param name Name for the new cluster. + * @return If successful the message contains the associated + * id generated for this cluster. + */ + public static OneResponse allocate(Client client, String name) + { + return client.call(ALLOCATE, name); + } + + /** + * Retrieves the information of the given cluster. + * + * @param client XML-RPC Client. + * @param id The cluster id. + * @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 cluster from OpenNebula. + * + * @param client XML-RPC Client. + * @param id The cluster id. + * @return A encapsulated response. + */ + public static OneResponse delete(Client client, int id) + { + return client.call(DELETE, id); + } + + /** + * Adds a Host to this Cluster + * + * @param client XML-RPC Client. + * @param id The cluster id. + * @param hid Host ID. + * + * @return A encapsulated response. + */ + public static OneResponse addHost(Client client, int id, int hid) + { + return client.call(ADDHOST, id, hid); + } + + /** + * Deletes a Host from this Cluster + * + * @param client XML-RPC Client. + * @param id The cluster id. + * @param hid Host ID. + * + * @return A encapsulated response. + */ + public static OneResponse delHost(Client client, int id, int hid) + { + return client.call(DELHOST, id, hid); + } + + /** + * Adds a Datastore to this Cluster + * + * @param client XML-RPC Client. + * @param id The cluster id. + * @param dsId Datastore ID. + * + * @return A encapsulated response. + */ + public static OneResponse addDatastore(Client client, int id, int dsId) + { + return client.call(ADDDATASTORE, id, dsId); + } + + /** + * Deletes a Datastore from this Cluster + * + * @param client XML-RPC Client. + * @param id The cluster id. + * @param dsId Datastore ID. + * + * @return A encapsulated response. + */ + public static OneResponse delDatastore(Client client, int id, int dsId) + { + return client.call(DELDATASTORE, id, dsId); + } + + /** + * Adds a VNet to this Cluster + * + * @param client XML-RPC Client. + * @param id The cluster id. + * @param vnetId VNet ID. + * + * @return A encapsulated response. + */ + public static OneResponse addVnet(Client client, int id, int vnetId) + { + return client.call(ADDVNET, id, vnetId); + } + + /** + * Deletes a VNet from this Cluster + * + * @param client XML-RPC Client. + * @param id The cluster id. + * @param vnetId VNet ID. + * + * @return A encapsulated response. + */ + public static OneResponse delVnet(Client client, int id, int vnetId) + { + return client.call(DELVNET, id, vnetId); + } + + // ================================= + // Instanced object XML-RPC methods + // ================================= + + /** + * Loads the xml representation of the cluster. + * The info is also stored internally. + * + * @see Cluster#info(Client, int) + */ + public OneResponse info() + { + OneResponse response = info(client, id); + super.processInfo(response); + return response; + } + + /** + * Deletes the cluster from OpenNebula. + * + * @see Cluster#delete(Client, int) + */ + public OneResponse delete() + { + return delete(client, id); + } + + /** + * Adds a Host to this Cluster + * + * @param hid Host ID. + * @return A encapsulated response. + */ + public OneResponse addHost(int hid) + { + return addHost(client, id, hid); + } + + /** + * Deletes a Host from this Cluster + * + * @param hid Host ID. + * @return A encapsulated response. + */ + public OneResponse delHost(int hid) + { + return delHost(client, id, hid); + } + + /** + * Adds a Datastore to this Cluster + * + * @param dsId Datastore ID. + * @return A encapsulated response. + */ + public OneResponse addDatastore(int dsId) + { + return addDatastore(client, id, dsId); + } + + /** + * Deletes a Datastore from this Cluster + * + * @param dsId Datastore ID. + * @return A encapsulated response. + */ + public OneResponse delDatastore(int dsId) + { + return delDatastore(client, id, dsId); + } + + /** + * Adds a VNet to this Cluster + * + * @param vnetId VNet ID. + * @return A encapsulated response. + */ + public OneResponse addVnet(int vnetId) + { + return addVnet(client, id, vnetId); + } + + /** + * Deletes a VNet from this Cluster + * + * @param vnetId VNet ID. + * @return A encapsulated response. + */ + public OneResponse delVnet(int vnetId) + { + return delVnet(client, id, vnetId); + } + + // ================================= + // Helpers + // ================================= + + /** + * Returns whether or not the host is part of this cluster + * + * @param id The host ID. + * @return Whether or not the host is part of this cluster. + */ + public boolean containsHost(int id) + { + return containsResource("HOSTS", id); + } + + /** + * Returns whether or not the datastore is part of this cluster + * + * @param id The datastore ID. + * @return Whether or not the datastore is part of this cluster. + */ + public boolean containsDatastore(int id) + { + return containsResource("DATASTORES", id); + } + + /** + * Returns whether or not the vnet is part of this cluster + * + * @param id The vnet ID. + * @return Whether or not the vnet is part of this cluster. + */ + public boolean containsVnet(int id) + { + return containsResource("VNETS", id); + } + + private boolean containsResource(String resource, int id) + { + String res = xpath(resource+"/ID[.="+id+"]"); + return res != null && res.equals(""+id); + } +} diff --git a/src/oca/java/src/org/opennebula/client/cluster/ClusterPool.java b/src/oca/java/src/org/opennebula/client/cluster/ClusterPool.java new file mode 100644 index 0000000000..e3172d42a9 --- /dev/null +++ b/src/oca/java/src/org/opennebula/client/cluster/ClusterPool.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) + * + * 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.cluster; + +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 cluster pool. + * It also offers static XML-RPC call wrappers. + */ +public class ClusterPool extends Pool implements Iterable{ + + private static final String ELEMENT_NAME = "CLUSTER"; + private static final String INFO_METHOD = "clusterpool.info"; + + /** + * Creates a new cluster pool + * @param client XML-RPC Client. + */ + public ClusterPool(Client client) + { + super(ELEMENT_NAME, client, INFO_METHOD); + } + + @Override + public PoolElement factory(Node node) + { + return new Cluster(node, client); + } + + /** + * Retrieves all the clusters 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 cluster pool. + * + * @see ClusterPool#info(Client) + */ + public OneResponse info() + { + return super.info(); + } + + public Iterator iterator() + { + AbstractList ab = new AbstractList() + { + public int size() + { + return getLength(); + } + + public Cluster get(int index) + { + return (Cluster) item(index); + } + }; + + return ab.iterator(); + } + + /** + * Returns the Cluster with the given Id from the pool. If it is not found, + * then returns null. + * + * @param id of the Cluster to retrieve + * @return The Image with the given Id, or null if it was not found. + */ + public Cluster getById(int id) + { + return (Cluster) super.getById(id); + } +} diff --git a/src/oca/java/src/org/opennebula/client/datastore/Datastore.java b/src/oca/java/src/org/opennebula/client/datastore/Datastore.java new file mode 100644 index 0000000000..4604c5d960 --- /dev/null +++ b/src/oca/java/src/org/opennebula/client/datastore/Datastore.java @@ -0,0 +1,357 @@ +/******************************************************************************* + * Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) + * + * 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.datastore; + +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 datastore. + * It also offers static XML-RPC call wrappers. + */ +public class Datastore extends PoolElement +{ + + private static final String METHOD_PREFIX = "datastore."; + 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"; + + /** + * Creates a new Datastore representation. + * @param id The datastore id. + * @param client XML-RPC Client. + */ + public Datastore(int id, Client client) + { + super(id, client); + } + + /** + * @see PoolElement + */ + protected Datastore(Node xmlElement, Client client) + { + super(xmlElement, client); + } + + // ================================= + // Static XML-RPC methods + // ================================= + + /** + * Allocates a new Datastore in OpenNebula. + * + * @param client XML-RPC Client. + * @param description A string containing the template of the datastore. + * @return If successful the message contains the associated + * id generated for this Datastore. + */ + public static OneResponse allocate(Client client, String description) + { + return client.call(ALLOCATE, description); + } + + /** + * Retrieves the information of the given Datastore. + * + * @param client XML-RPC Client. + * @param id The datastore 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 datastore from OpenNebula. + * + * @param client XML-RPC Client. + * @param id The id of the target datastore we want to delete. + * @return A encapsulated response. + */ + public static OneResponse delete(Client client, int id) + { + return client.call(DELETE, id); + } + + /** + * Replaces the datastore contents. + * + * @param client XML-RPC Client. + * @param id The id of the target datastore we want to modify. + * @param new_template New datastore contents. + * @return If successful the message contains the datastore id. + */ + public static OneResponse update(Client client, int id, String new_template) + { + return client.call(UPDATE, id, new_template); + } + + /** + * Publishes or unpublishes a datastore. + * + * @param client XML-RPC Client. + * @param id The id of the target datastore we want to modify. + * @param publish True for publishing, false for unpublishing. + * @return If successful the message contains the datastore id. + */ + public static OneResponse publish(Client client, int id, boolean publish) + { + int group_u = publish ? 1 : 0; + + return chmod(client, id, -1, -1, -1, group_u, -1, -1, -1, -1, -1); + } + + /** + * Changes the owner/group + * + * @param client XML-RPC Client. + * @param id The id of the target datastore 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 datastore permissions + * + * @param client XML-RPC Client. + * @param id The id of the target datastore. + * @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); + } + + // ================================= + // Instanced object XML-RPC methods + // ================================= + + /** + * Retrieves the information of the Datastore. + * + * @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 datastore from OpenNebula. + * + * @return A encapsulated response. + */ + public OneResponse delete() + { + return delete(client, id); + } + + /** + * Replaces the datastore template. + * + * @param new_template New datastore template. + * @return If successful the message contains the datastore id. + */ + public OneResponse update(String new_template) + { + return update(client, id, new_template); + } + + /** + * Publishes or unpublishes the datastore. + * + * @param publish True for publishing, false for unpublishing. + * @return If successful the message contains the datastore id. + */ + public OneResponse publish(boolean publish) + { + return publish(client, id, publish); + } + + /** + * Publishes the datastore. + * + * @return If successful the message contains the datastore id. + */ + public OneResponse publish() + { + return publish(true); + } + + /** + * Unpublishes the datastore. + * + * @return If successful the message contains the datastore id. + */ + public OneResponse unpublish() + { + return publish(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 datastore 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); + } + + // ================================= + // Helpers + // ================================= + + /** + * Returns whether or not the image is part of this datastore + * + * @param id The image ID. + * @return Whether or not the image is part of this datastore. + */ + public boolean contains(int id) + { + String res = xpath("IMAGES/ID[.="+id+"]"); + return res != null && res.equals(""+id); + } +} diff --git a/src/oca/java/src/org/opennebula/client/datastore/DatastorePool.java b/src/oca/java/src/org/opennebula/client/datastore/DatastorePool.java new file mode 100644 index 0000000000..6cdcef7416 --- /dev/null +++ b/src/oca/java/src/org/opennebula/client/datastore/DatastorePool.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) + * + * 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.datastore; + +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 datastore pool. + * It also offers static XML-RPC call wrappers. + */ +public class DatastorePool extends Pool implements Iterable{ + + private static final String ELEMENT_NAME = "DATASTORE"; + private static final String INFO_METHOD = "datastorepool.info"; + + /** + * Creates a new datastore pool + * @param client XML-RPC Client. + */ + public DatastorePool(Client client) + { + super(ELEMENT_NAME, client, INFO_METHOD); + } + + @Override + public PoolElement factory(Node node) + { + return new Datastore(node, client); + } + + /** + * Retrieves all the datastores 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 datastore pool. + * + * @see DatastorePool#info(Client) + */ + public OneResponse info() + { + return super.info(); + } + + public Iterator iterator() + { + AbstractList ab = new AbstractList() + { + public int size() + { + return getLength(); + } + + public Datastore get(int index) + { + return (Datastore) item(index); + } + }; + + return ab.iterator(); + } + + /** + * Returns the Datastore with the given Id from the pool. If it is not found, + * then returns null. + * + * @param id of the Datastore to retrieve + * @return The Image with the given Id, or null if it was not found. + */ + public Datastore getById(int id) + { + return (Datastore) super.getById(id); + } +} 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 13fbe45117..290a28fdd0 100644 --- a/src/oca/java/src/org/opennebula/client/host/Host.java +++ b/src/oca/java/src/org/opennebula/client/host/Host.java @@ -1,12 +1,12 @@ /******************************************************************************* * Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) - * + * * 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. @@ -33,15 +33,15 @@ public class Host extends PoolElement{ private static final String DELETE = METHOD_PREFIX + "delete"; private static final String ENABLE = METHOD_PREFIX + "enable"; private static final String UPDATE = METHOD_PREFIX + "update"; - - private static final String[] HOST_STATES = + + private static final String[] HOST_STATES = {"INIT", "MONITORING", "MONITORED", "ERROR", "DISABLED"}; /** * Creates a new Host representation. - * - * @param id The host id (hid) of the machine. + * + * @param id The host id (hid) of the machine. * @param client XML-RPC Client. */ public Host(int id, Client client) @@ -64,17 +64,20 @@ public class Host extends PoolElement{ /** * Allocates a new host in OpenNebula - * + * * @param client XML-RPC Client. - * @param hostname Hostname of the machine we want to add + * @param hostname Hostname of the machine we want to add * @param im The name of the information manager (im_mad_name), - * this values are taken from the oned.conf with the tag name IM_MAD (name) + * this values are taken from the oned.conf with the tag name IM_MAD (name) * @param vmm The name of the virtual machine manager mad name * (vmm_mad_name), this values are taken from the oned.conf with the * tag name VM_MAD (name) * @param vnm The name of the virtual network manager mad name * (vnm_mad_name), this values are taken from the oned.conf with the * tag name VN_MAD (name) + * @param clusterId The cluster ID. If it is -1, this host won't be + * added to any cluster. + * * @return If successful the message contains the associated * id generated for this host */ @@ -82,16 +85,44 @@ public class Host extends PoolElement{ String hostname, String im, String vmm, - String vnm) + String vnm, + int clusterId) { - return client.call(ALLOCATE, hostname, im, vmm, vnm); + return client.call(ALLOCATE, hostname, im, vmm, vnm, clusterId); + } + + /** + * Allocates a new host in OpenNebula + * + * @param client XML-RPC Client. + * @param hostname Hostname of the machine we want to add + * @param im The name of the information manager (im_mad_name), + * this values are taken from the oned.conf with the tag name IM_MAD (name) + * @param vmm The name of the virtual machine manager mad name + * (vmm_mad_name), this values are taken from the oned.conf with the + * tag name VM_MAD (name) + * @param vnm The name of the virtual network manager mad name + * (vnm_mad_name), this values are taken from the oned.conf with the + * tag name VN_MAD (name) + * + * @return If successful the message contains the associated + * id generated for this host + */ + public static OneResponse allocate( + Client client, + String hostname, + String im, + String vmm, + String vnm) + { + return allocate(client, hostname, im, vmm, vnm, -1); } /** * Retrieves the information of the given host. - * + * * @param client XML-RPC Client. - * @param id The host id (hid) of the target machine. + * @param id The host id (hid) of the target machine. * @return If successful the message contains the string * with the information returned by OpenNebula. */ @@ -102,7 +133,7 @@ public class Host extends PoolElement{ /** * Deletes a host from OpenNebula. - * + * * @param client XML-RPC Client. * @param id The host id (hid) of the target machine. * @return A encapsulated response. @@ -114,7 +145,7 @@ public class Host extends PoolElement{ /** * Enables or disables a given host. - * + * * @param client XML-RPC Client. * @param id The host id (hid) of the target machine. * @param enable If set true OpenNebula will enable the @@ -128,7 +159,7 @@ public class Host extends PoolElement{ /** * Replaces the template contents. - * + * * @param client XML-RPC Client. * @param id The image id of the target host we want to modify. * @param new_template New template contents @@ -146,7 +177,7 @@ public class Host extends PoolElement{ /** * Loads the xml representation of the host. * The info is also stored internally. - * + * * @see Host#info(Client, int) */ public OneResponse info() @@ -158,7 +189,7 @@ public class Host extends PoolElement{ /** * Deletes the host from OpenNebula. - * + * * @see Host#delete(Client, int) */ public OneResponse delete() @@ -168,7 +199,7 @@ public class Host extends PoolElement{ /** * Enables or disables the host. - * + * * @see Host#enable(Client, int, boolean) */ public OneResponse enable(boolean enable) @@ -178,7 +209,7 @@ public class Host extends PoolElement{ /** * Enables the host. - * + * * @return A encapsulated response. */ public OneResponse enable() @@ -188,7 +219,7 @@ public class Host extends PoolElement{ /** * Disables the host - * + * * @return A encapsulated response. */ public OneResponse disable() @@ -198,7 +229,7 @@ public class Host extends PoolElement{ /** * Replaces the template contents. - * + * * @param new_template New template contents * @return If successful the message contains the host id. */ @@ -215,7 +246,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. */ public String stateStr() @@ -228,7 +259,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. */ public String shortStateStr() @@ -246,7 +277,7 @@ public class Host extends PoolElement{ /** * Returns true if the host is enabled. - * + * * @return True if the host is enabled. */ public boolean isEnabled() 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 5d4e3921e7..281af821b3 100644 --- a/src/oca/java/src/org/opennebula/client/image/Image.java +++ b/src/oca/java/src/org/opennebula/client/image/Image.java @@ -1,12 +1,12 @@ /******************************************************************************* * Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) - * + * * 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. @@ -71,6 +71,24 @@ public class Image extends PoolElement // Static XML-RPC methods // ================================= + /** + * Allocates a new Image in OpenNebula. + * + * @param client XML-RPC Client. + * @param description A string containing the template of the image. + * @param clusterId The cluster ID. If it is -1, this image + * won't be added to any cluster. + * + * @return If successful the message contains the associated + * id generated for this Image. + */ + public static OneResponse allocate( + Client client, + String description, + int clusterId) + { + return client.call(ALLOCATE, description, clusterId); + } /** * Allocates a new Image in OpenNebula. @@ -82,7 +100,7 @@ public class Image extends PoolElement */ public static OneResponse allocate(Client client, String description) { - return client.call(ALLOCATE, description); + return allocate(client, description, -1); } /** @@ -100,7 +118,7 @@ public class Image extends PoolElement /** * Deletes an image from OpenNebula. - * + * * @param client XML-RPC Client. * @param id The image id of the target image we want to delete. * @return A encapsulated response. @@ -112,7 +130,7 @@ public class Image extends PoolElement /** * Replaces the template contents. - * + * * @param client XML-RPC Client. * @param id The image id of the target image we want to modify. * @param new_template New template contents @@ -125,7 +143,7 @@ public class Image extends PoolElement /** * Enables or disables an image. - * + * * @param client XML-RPC Client. * @param id The image id of the target image we want to modify. * @param enable True for enabling, false for disabling. @@ -138,7 +156,7 @@ public class Image extends PoolElement /** * Publishes or unpublishes an image. - * + * * @param client XML-RPC Client. * @param id The image id of the target image we want to modify. * @param publish True for publishing, false for unpublishing. @@ -153,7 +171,7 @@ public class Image extends PoolElement /** * Changes the owner/group - * + * * @param client XML-RPC Client. * @param id The image id of the target image we want to modify. * @param uid The new owner user ID. Set it to -1 to leave the current one. @@ -167,7 +185,7 @@ public class Image extends PoolElement /** * Changes the Image permissions - * + * * @param client XML-RPC Client. * @param id The image id of the target image we want to modify. * @param owner_u 1 to allow, 0 deny, -1 do not change @@ -194,7 +212,7 @@ public class Image extends PoolElement /** * Changes the permissions - * + * * @param client XML-RPC Client. * @param id The id of the target object. * @param octet Permissions octed , e.g. 640 @@ -207,7 +225,7 @@ public class Image extends PoolElement /** * Changes the permissions - * + * * @param client XML-RPC Client. * @param id The id of the target object. * @param octet Permissions octed , e.g. 640 @@ -220,7 +238,7 @@ public class Image extends PoolElement /** * Changes the Image type - * + * * @param client XML-RPC Client. * @param id The image id of the target image we want to modify. * @param type The new Image type @@ -250,7 +268,7 @@ public class Image extends PoolElement /** * Deletes the image from OpenNebula. - * + * * @return A encapsulated response. */ public OneResponse delete() @@ -260,7 +278,7 @@ public class Image extends PoolElement /** * Replaces the template contents. - * + * * @param new_template New template contents * @return If successful the message contains the image id. */ @@ -271,7 +289,7 @@ public class Image extends PoolElement /** * Enables or disables the image. - * + * * @param enable True for enabling, false for disabling. * @return If successful the message contains the image id. */ @@ -282,7 +300,7 @@ public class Image extends PoolElement /** * Enables the image. - * + * * @return If successful the message contains the image id. */ public OneResponse enable() @@ -292,7 +310,7 @@ public class Image extends PoolElement /** * Disables the image. - * + * * @return If successful the message contains the image id. */ public OneResponse disable() @@ -302,7 +320,7 @@ public class Image extends PoolElement /** * Publishes or unpublishes the image. - * + * * @param publish True for publishing, false for unpublishing. * @return If successful the message contains the image id. */ @@ -313,7 +331,7 @@ public class Image extends PoolElement /** * Publishes the image. - * + * * @return If successful the message contains the image id. */ public OneResponse publish() @@ -323,7 +341,7 @@ public class Image extends PoolElement /** * Unpublishes the image. - * + * * @return If successful the message contains the image id. */ public OneResponse unpublish() @@ -333,7 +351,7 @@ public class Image extends PoolElement /** * 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. @@ -345,7 +363,7 @@ public class Image extends PoolElement /** * Changes the owner - * + * * @param uid The new owner user ID. * @return If an error occurs the error message contains the reason. */ @@ -356,7 +374,7 @@ public class Image extends PoolElement /** * Changes the group - * + * * @param gid The new group ID. * @return If an error occurs the error message contains the reason. */ @@ -367,7 +385,7 @@ public class Image extends PoolElement /** * Changes the Image 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 @@ -413,7 +431,7 @@ public class Image extends PoolElement /** * Changes the Image type - * + * * @param type The new Image type * @return If an error occurs the error message contains the reason. */ @@ -430,7 +448,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. */ public String stateString() @@ -443,7 +461,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. */ public String shortStateStr() @@ -454,7 +472,7 @@ public class Image extends PoolElement /** * Returns the type of the Image. - * + * * @return The type of the Image. */ public int type() @@ -465,7 +483,7 @@ public class Image extends PoolElement /** * Returns the type of the Image as a String. - * + * * @return The type of the Image as a String. */ public String typeStr() @@ -476,7 +494,7 @@ public class Image extends PoolElement /** * Returns the type of the Image as a short String. - * + * * @return The type of the Image as a short String. */ public String shortTypeStr() @@ -487,7 +505,7 @@ public class Image extends PoolElement /** * Returns true if the image is enabled. - * + * * @return True if the image is enabled. */ public boolean isEnabled() 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 8775559812..9cefefe188 100644 --- a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java +++ b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java @@ -19,7 +19,6 @@ package org.opennebula.client.vm; import org.opennebula.client.Client; import org.opennebula.client.OneResponse; import org.opennebula.client.PoolElement; -import org.opennebula.client.template.Template; import org.w3c.dom.Node; /** @@ -152,7 +151,7 @@ public class VirtualMachine extends PoolElement{ /** * Changes the owner/group - * + * * @param client XML-RPC Client. * @param id The virtual machine id (vid) of the target instance. * @param uid The new owner user ID. Set it to -1 to leave the current one. @@ -166,7 +165,7 @@ public class VirtualMachine extends PoolElement{ /** * Changes the VM permissions - * + * * @param client XML-RPC Client. * @param id The VM id of the target VM. * @param owner_u 1 to allow, 0 deny, -1 do not change @@ -193,7 +192,7 @@ public class VirtualMachine extends PoolElement{ /** * Changes the permissions - * + * * @param client XML-RPC Client. * @param id The id of the target object. * @param octet Permissions octed , e.g. 640 @@ -206,7 +205,7 @@ public class VirtualMachine extends PoolElement{ /** * Changes the permissions - * + * * @param client XML-RPC Client. * @param id The id of the target object. * @param octet Permissions octed , e.g. 640 @@ -317,7 +316,7 @@ public class VirtualMachine extends PoolElement{ /** * 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. @@ -329,7 +328,7 @@ public class VirtualMachine extends PoolElement{ /** * Changes the owner - * + * * @param uid The new owner user ID. * @return If an error occurs the error message contains the reason. */ @@ -340,7 +339,7 @@ public class VirtualMachine extends PoolElement{ /** * Changes the group - * + * * @param gid The new group ID. * @return If an error occurs the error message contains the reason. */ @@ -352,7 +351,7 @@ public class VirtualMachine extends PoolElement{ /** * Changes the VM 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 diff --git a/src/oca/java/src/org/opennebula/client/vnet/VirtualNetwork.java b/src/oca/java/src/org/opennebula/client/vnet/VirtualNetwork.java index f4d739c3e1..112d4adec5 100644 --- a/src/oca/java/src/org/opennebula/client/vnet/VirtualNetwork.java +++ b/src/oca/java/src/org/opennebula/client/vnet/VirtualNetwork.java @@ -1,12 +1,12 @@ /******************************************************************************* * Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) - * + * * 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. @@ -41,7 +41,7 @@ public class VirtualNetwork extends PoolElement{ /** * Creates a new virtual network representation. - * + * * @param id The virtual network id (nid) . * @param client XML-RPC Client. */ @@ -64,24 +64,47 @@ public class VirtualNetwork extends PoolElement{ /** * Allocates a new virtual network in OpenNebula. - * + * * @param client XML-RPC Client. * @param description A string containing the template - * of the virtual network. + * of the virtual network. + * @param clusterId The cluster ID. If it is -1, this virtual network + * won't be added to any cluster. + * * @return If successful the message contains the associated * id generated for this virtual network. */ - public static OneResponse allocate(Client client, String description) + public static OneResponse allocate( + Client client, + String description, + int clusterId) { - return client.call(ALLOCATE, description); + return client.call(ALLOCATE, description, clusterId); + } + + /** + * Allocates a new virtual network in OpenNebula. + * + * @param client XML-RPC Client. + * @param description A string containing the template + * of the virtual network. + * + * @return If successful the message contains the associated + * id generated for this virtual network. + */ + public static OneResponse allocate( + Client client, + String description) + { + return allocate(client, description, -1); } /** * Retrieves the information of the given virtual network - * + * * @param client XML-RPC Client. * @param id the virtual network id (nid) for the network to - * retrieve the information from. + * retrieve the information from. * @return If successful the message contains the string * with the information returned by OpenNebula. */ @@ -92,7 +115,7 @@ public class VirtualNetwork extends PoolElement{ /** * Deletes a network from OpenNebula. - * + * * @param client XML-RPC Client. * @param id The virtual network id (nid) of the target network. * @return A encapsulated response. @@ -104,7 +127,7 @@ public class VirtualNetwork extends PoolElement{ /** * Publishes or unpublishes a virtual network. - * + * * @param client XML-RPC Client. * @param id The virtual network id (nid) of the target network. * @param publish True for publishing, false for unpublishing. @@ -171,7 +194,7 @@ public class VirtualNetwork extends PoolElement{ /** * Changes the owner/group - * + * * @param client XML-RPC Client. * @param id The virtual network id (nid) of the target network. * @param uid The new owner user ID. Set it to -1 to leave the current one. @@ -185,7 +208,7 @@ public class VirtualNetwork extends PoolElement{ /** * Changes the VirtualNetwork permissions - * + * * @param client XML-RPC Client. * @param id The virtual network id (nid) of the target network. * @param owner_u 1 to allow, 0 deny, -1 do not change @@ -212,7 +235,7 @@ public class VirtualNetwork extends PoolElement{ /** * Changes the permissions - * + * * @param client XML-RPC Client. * @param id The id of the target object. * @param octet Permissions octed , e.g. 640 @@ -225,7 +248,7 @@ public class VirtualNetwork extends PoolElement{ /** * Changes the permissions - * + * * @param client XML-RPC Client. * @param id The id of the target object. * @param octet Permissions octed , e.g. 640 @@ -256,7 +279,7 @@ public class VirtualNetwork extends PoolElement{ /** * Loads the xml representation of the virtual network. * The info is also stored internally. - * + * * @see VirtualNetwork#info(Client, int) */ public OneResponse info() @@ -268,7 +291,7 @@ public class VirtualNetwork extends PoolElement{ /** * Deletes the network from OpenNebula. - * + * * @return A encapsulated response. */ public OneResponse delete() @@ -278,7 +301,7 @@ public class VirtualNetwork extends PoolElement{ /** * Publishes or unpublishes the virtual network. - * + * * @param publish True for publishing, false for unpublishing. * @return If successful the message contains the image id. */ @@ -289,7 +312,7 @@ public class VirtualNetwork extends PoolElement{ /** * Publishes the virtual network. - * + * * @return If successful the message contains the image id. */ public OneResponse publish() @@ -299,7 +322,7 @@ public class VirtualNetwork extends PoolElement{ /** * Unpublishes the virtual network. - * + * * @return If successful the message contains the image id. */ public OneResponse unpublish() @@ -379,7 +402,7 @@ public class VirtualNetwork extends PoolElement{ /** * 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. @@ -391,7 +414,7 @@ public class VirtualNetwork extends PoolElement{ /** * Changes the owner - * + * * @param uid The new owner user ID. * @return If an error occurs the error message contains the reason. */ @@ -402,7 +425,7 @@ public class VirtualNetwork extends PoolElement{ /** * Changes the group - * + * * @param gid The new group ID. * @return If an error occurs the error message contains the reason. */ @@ -413,7 +436,7 @@ public class VirtualNetwork extends PoolElement{ /** * Changes the VirtualNetwork 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 diff --git a/src/oca/java/test/HostTest.java b/src/oca/java/test/HostTest.java index 4126a259eb..fc6f824c92 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, "im_dummy", "vmm_dummy", "vnm_dummy"); + res = Host.allocate(client, name, "im_dummy", "vmm_dummy", "dummy"); int hid = !res.isError() ? Integer.parseInt(res.getMessage()) : -1; host = new Host(hid, client); @@ -83,7 +83,7 @@ public class HostTest { String name = "allocate_test"; - res = Host.allocate(client, name, "im_dummy", "vmm_dummy", "vmm_dummy"); + res = Host.allocate(client, name, "im_dummy", "vmm_dummy", "dummy"); assertTrue( !res.isError() ); // assertTrue( res.getMessage().equals("0") ); diff --git a/src/oca/java/test/VirtualMachineTest.java b/src/oca/java/test/VirtualMachineTest.java index eecee6a900..23a404c653 100644 --- a/src/oca/java/test/VirtualMachineTest.java +++ b/src/oca/java/test/VirtualMachineTest.java @@ -22,6 +22,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.opennebula.client.Client; import org.opennebula.client.OneResponse; +import org.opennebula.client.datastore.Datastore; import org.opennebula.client.host.Host; import org.opennebula.client.vm.VirtualMachine; import org.opennebula.client.vm.VirtualMachinePool; @@ -80,12 +81,15 @@ public class VirtualMachineTest res = Host.allocate(client, "host_A", - "im_dummy", "vmm_dummy", "vmm_dummy", "tm_dummy"); + "im_dummy", "vmm_dummy", "dummy"); hid_A = Integer.parseInt( res.getMessage() ); res = Host.allocate(client, "host_B", - "im_dummy", "vmm_dummy", "vmm_dummy", "tm_dummy"); + "im_dummy", "vmm_dummy", "dummy"); hid_B = Integer.parseInt( res.getMessage() ); + + Datastore systemDs = new Datastore(0, client); + systemDs.update("TM_MAD = dummy"); } /** @@ -295,7 +299,8 @@ public class VirtualMachineTest assertTrue( vm.xpath("TEMPLATE/CONTEXT/DNS").equals("192.169.1.4") ); } - @Test +// TODO +// @Test public void savedisk() { String template = "NAME = savedisk_vm\n"+ diff --git a/src/oca/java/test/VirtualNetworkTest.java b/src/oca/java/test/VirtualNetworkTest.java index 6a7dbf3e9b..6064d672eb 100644 --- a/src/oca/java/test/VirtualNetworkTest.java +++ b/src/oca/java/test/VirtualNetworkTest.java @@ -40,7 +40,6 @@ public class VirtualNetworkTest private static String template = "NAME = " + name + "\n"+ "TYPE = RANGED\n" + - "PUBLIC = NO\n" + "BRIDGE = vbr0\n" + "NETWORK_SIZE = C\n" + "NETWORK_ADDRESS = 192.168.0.0\n"; @@ -147,30 +146,7 @@ public class VirtualNetworkTest res = vnet.info(); assertTrue( res.isError() ); } -// TODO -/* - @Test - public void publish() - { - res = vnet.info(); - assertTrue( !res.isError() ); - assertTrue( !vnet.isPublic() ); - // Publish it - res = vnet.publish(); - assertTrue( !res.isError() ); - - res = vnet.info(); - assertTrue( vnet.isPublic() ); - - // Unpublish it - res = vnet.unpublish(); - assertTrue( !res.isError() ); - - res = vnet.info(); - assertTrue( !vnet.isPublic() ); - } -*/ @Test public void addLeases() { @@ -273,4 +249,5 @@ public class VirtualNetworkTest assertTrue( vnet.xpath("TEMPLATE/ATT2").equals( "NEW_VAL" ) ); assertTrue( vnet.xpath("TEMPLATE/ATT3").equals( "VAL3" ) ); } + } diff --git a/src/oca/java/test/oned.conf b/src/oca/java/test/oned.conf index 7e88254166..82fbf924f0 100644 --- a/src/oca/java/test/oned.conf +++ b/src/oca/java/test/oned.conf @@ -6,7 +6,7 @@ # Daemon configuration attributes #------------------------------------------------------------------------------- # MANAGER_TIMER: Time in seconds the core uses to evaluate periodical functions. -# HOST_MONITORING_INTERVAL and VM_POLLING_INTERVAL cannot have smaller values +# HOST_MONITORING_INTERVAL and VM_POLLING_INTERVAL can not have smaller values # than MANAGER_TIMER. # # HOST_MONITORING_INTERVAL: Time in seconds between host monitorization. @@ -16,11 +16,6 @@ # (use 0 to disable VM monitoring). # VM_PER_INTERVAL: Number of VMs monitored in each interval. # -# VM_DIR: Remote path to store the VM images, it should be shared between all -# the cluster nodes to perform live migrations. This variable is the default -# for all the hosts in the cluster. VM_DIR IS ONLY FOR THE NODES AND *NOT* THE -# FRONT-END -# # SCRIPTS_REMOTE_DIR: Remote path to store the monitoring and VM management # scripts. # @@ -49,7 +44,6 @@ HOST_MONITORING_INTERVAL = 600 VM_POLLING_INTERVAL = 600 #VM_PER_INTERVAL = 5 -#VM_DIR=/srv/cloud/one/var SCRIPTS_REMOTE_DIR=/var/tmp/one @@ -84,8 +78,13 @@ NETWORK_SIZE = 254 MAC_PREFIX = "02:00" #******************************************************************************* -# Image Repository Configuration +# DataStore Configuration #******************************************************************************* +# DATASTORE_LOCATION: Path for Datastores in the hosts. It IS the same for all +# the hosts in the cluster. DATASTORE_LOCATION IS ONLY FOR THE HOSTS AND *NOT* +# THE FRONT-END. It defaults to /var/lib/one/datastores (or +# $ONE_LOCATION/var/datastores in self-contained mode) +# # DEFAULT_IMAGE_TYPE: This can take values # OS Image file holding an operating system # CDROM Image file holding a CDROM @@ -97,6 +96,9 @@ MAC_PREFIX = "02:00" # xvd XEN Virtual Disk # vd KVM virtual disk #******************************************************************************* + +#DATASTORE_LOCATION = /var/lib/one/datastores + DEFAULT_IMAGE_TYPE = "OS" DEFAULT_DEVICE_PREFIX = "hd" @@ -199,7 +201,7 @@ IM_MAD = [ name="im_dummy", executable="one_im_dummy"] # KVM 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 +# -l actions executed locally, command can be # overridden for each action. # Valid actions: deploy, shutdown, cancel, save, restore, migrate, poll # An example: "-l migrate,poll=poll_ganglia,save" @@ -216,7 +218,7 @@ VM_MAD = [ # 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 +# -l actions executed locally, command can be # overridden for each action. # Valid actions: deploy, shutdown, cancel, save, restore, migrate, poll # An example: "-l migrate,poll=poll_ganglia,save" @@ -271,75 +273,33 @@ VM_MAD = [ name="vmm_dummy", executable="one_vmm_dummy", type="xml" ] # 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, usually a commands configuration file -# , can be an absolute path or relative to $ONE_LOCATION/etc (or -# /etc/one/ if OpenNebula was installed in /) +# arguments : +# -t: number of threads, i.e. number of transfers made at the same time +# -d: list of transfer drivers separated by commas, if not defined all the +# drivers available will be enabled #******************************************************************************* -#------------------------------------------------------------------------------- -# SHARED Transfer Manager Driver Configuration -#------------------------------------------------------------------------------- TM_MAD = [ - name = "tm_shared", executable = "one_tm", - arguments = "tm_shared/tm_shared.conf" ] -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# SSH Transfer Manager Driver Configuration -#------------------------------------------------------------------------------- -#TM_MAD = [ -# name = "tm_ssh", -# executable = "one_tm", -# arguments = "tm_ssh/tm_ssh.conf" ] -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# Dummy Transfer Manager Driver Configuration -#------------------------------------------------------------------------------- -TM_MAD = [ - name = "tm_dummy", - executable = "one_tm", - arguments = "tm_dummy/tm_dummy.conf" ] -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# LVM Transfer Manager Driver Configuration -#------------------------------------------------------------------------------- -#TM_MAD = [ -# name = "tm_lvm", -# executable = "one_tm", -# arguments = "tm_lvm/tm_lvm.conf" ] -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# VMware DataStore Transfer Manager Driver Configuration -#------------------------------------------------------------------------------- -#TM_MAD = [ -# name = "tm_vmware", -# executable = "one_tm", -# arguments = "tm_vmware/tm_vmware.conf" ] -#------------------------------------------------------------------------------- + arguments = "-t 15 -d dummy,lvm,shared,qcow2,ssh,vmware,iscsi" ] #******************************************************************************* -# Image Manager Driver Configuration +# Datastore Driver Configuration #******************************************************************************* -# Drivers to manage the image repository, specialized for the storage backend +# Drivers to manage the datastores, 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 +# -d datastore mads separated by commas #******************************************************************************* -#------------------------------------------------------------------------------- -# FS based Image Manager Driver Configuration -# -t number of threads, i.e. number of repo operations at the same time -#------------------------------------------------------------------------------- -IMAGE_MAD = [ - executable = "one_image", - arguments = "fs -t 15" ] -#------------------------------------------------------------------------------- + +DATASTORE_MAD = [ + executable = "one_datastore", + arguments = "-t 15 -d fs,vmware,iscsi,dummy" +] #******************************************************************************* # Hook Manager Configuration @@ -376,7 +336,6 @@ IMAGE_MAD = [ # allocated # - NO, The hook is executed in the OpenNebula server (default) # -# # Host Hooks (HOST_HOOK) defined by: # name : for the hook, useful to track the hook (OPTIONAL) # on : when the hook should be executed, @@ -395,10 +354,8 @@ IMAGE_MAD = [ # - YES, The hook is executed in the host # - NO, The hook is executed in the OpenNebula server (default) #------------------------------------------------------------------------------- - HM_MAD = [ executable = "one_hm" ] - #------------------------------------------------------------------------------- #******************************************************************************* @@ -455,8 +412,12 @@ HM_MAD = [ # --authz: authorization module # # SESSION_EXPIRATION_TIME: Time in seconds to keep an authenticated token as -# valid. During this time, the driver is not used. Use 0 to disable session +# valid. During this time, the driver is not used. Use 0 to disable session # caching +# +# ENABLE_OTHER_PERMISSIONS: Whether or not to enable the permissions for +# 'other'. Users in the oneadmin group will still be able to change +# these permissions. Values: YES or NO #******************************************************************************* AUTH_MAD = [ @@ -467,3 +428,19 @@ AUTH_MAD = [ SESSION_EXPIRATION_TIME = 900 +#ENABLE_OTHER_PERMISSIONS = "YES" + + +#******************************************************************************* +# Restricted Attributes Configuration +#******************************************************************************* +# The following attributes are restricted to users outside the oneadmin group +#******************************************************************************* + +VM_RESTRICTED_ATTR = "CONTEXT/FILES" +VM_RESTRICTED_ATTR = "DISK/SOURCE" +VM_RESTRICTED_ATTR = "NIC/MAC" +VM_RESTRICTED_ATTR = "NIC/VLAN_ID" +VM_RESTRICTED_ATTR = "RANK" + +IMAGE_RESTRICTED_ATTR = "SOURCE" diff --git a/src/oca/ruby/OpenNebula/Datastore.rb b/src/oca/ruby/OpenNebula/Datastore.rb index 6dbb10b1f4..355d252c9a 100644 --- a/src/oca/ruby/OpenNebula/Datastore.rb +++ b/src/oca/ruby/OpenNebula/Datastore.rb @@ -129,7 +129,7 @@ module OpenNebula #This doesn't work in ruby 1.8.5 #return self["DATASTORE/ID[.=#{uid}]"] != nil - id_array = retrieve_elements('DATASTORE/ID') + id_array = retrieve_elements('IMAGES/ID') return id_array != nil && id_array.include?(uid.to_s) end diff --git a/src/onedb/3.3.0_to_3.3.80.rb b/src/onedb/3.3.0_to_3.3.80.rb index 3fd8ee4631..b162249390 100644 --- a/src/onedb/3.3.0_to_3.3.80.rb +++ b/src/onedb/3.3.0_to_3.3.80.rb @@ -234,6 +234,11 @@ module Migrator # Update SOURCE doc.root.each_element("SOURCE") { |e| previous_source = e.text + + if previous_source.nil? + next + end + hash = previous_source.split('/')[-1] if ( hash.length == 32 && hash =~ /^[0-9A-F]+$/i ) @@ -275,7 +280,7 @@ module Migrator " 1" << " 0" << " 0" << - " 0" << + " 1" << " 0" << " 0" << " " << @@ -299,7 +304,7 @@ module Migrator :gid => 0, :owner_u => 1, :group_u => 1, - :other_u => 0) + :other_u => 1) return true end diff --git a/src/ozones/Server/lib/OZones.rb b/src/ozones/Server/lib/OZones.rb index ef23523154..cd44f87203 100644 --- a/src/ozones/Server/lib/OZones.rb +++ b/src/ozones/Server/lib/OZones.rb @@ -26,6 +26,8 @@ require 'OZones/AggregatedVirtualMachines' require 'OZones/AggregatedVirtualNetworks' require 'OZones/AggregatedImages' require 'OZones/AggregatedUsers' +require 'OZones/AggregatedClusters' +require 'OZones/AggregatedDatastores' require 'OZones/AggregatedTemplates' require 'openssl' @@ -71,4 +73,4 @@ module OZones def self.str_to_json(str) return JSON.pretty_generate({:message => str}) end -end \ No newline at end of file +end diff --git a/src/ozones/Server/lib/OZones/Zones.rb b/src/ozones/Server/lib/OZones/Zones.rb index 4ec6fac7bd..95300c0d0d 100644 --- a/src/ozones/Server/lib/OZones/Zones.rb +++ b/src/ozones/Server/lib/OZones/Zones.rb @@ -219,9 +219,9 @@ module OZones when "template","vmtemplate" then OZones::AggregatedTemplates.new when "cluster" then - OZones::AggregatedCluster.new + OZones::AggregatedClusters.new when "datastore" then - OZones::AggregatedDatastore.new + OZones::AggregatedDatastores.new else error = OZones::Error.new("Error: Pool #{pool_kind} not" \ " supported for aggregated zone view") diff --git a/src/ozones/Server/public/js/ozones.js b/src/ozones/Server/public/js/ozones.js index b306ac74a2..414e4e687a 100644 --- a/src/ozones/Server/public/js/ozones.js +++ b/src/ozones/Server/public/js/ozones.js @@ -223,7 +223,7 @@ var oZones = { }); }, - "delete": function(params,resource){ + "del": function(params,resource){ var callback = params.success; var callback_error = params.error; var id = params.data.id; @@ -381,8 +381,8 @@ var oZones = { "create": function(params){ oZones.Action.create(params,oZones.Zone.resource); }, - "delete" : function(params){ - oZones.Action.delete(params,oZones.Zone.resource); + "del" : function(params){ + oZones.Action.del(params,oZones.Zone.resource); }, "list": function(params){ oZones.Action.list(params,oZones.Zone.resource); @@ -446,8 +446,8 @@ var oZones = { "update": function(params){ oZones.Action.update(params,oZones.VDC.resource); }, - "delete": function(params){ - oZones.Action.delete(params,oZones.VDC.resource); + "del": function(params){ + oZones.Action.del(params,oZones.VDC.resource); }, "list": function(params){ oZones.Action.list(params,oZones.VDC.resource); diff --git a/src/ozones/Server/public/js/plugins/vdcs-tab.js b/src/ozones/Server/public/js/plugins/vdcs-tab.js index 4a4f8cbb1f..dd25dd8b27 100644 --- a/src/ozones/Server/public/js/plugins/vdcs-tab.js +++ b/src/ozones/Server/public/js/plugins/vdcs-tab.js @@ -155,7 +155,7 @@ var vdc_actions = { "VDC.delete" : { type: "multiple", - call: oZones.VDC.delete, + call: oZones.VDC.del, callback: deleteVDCElement, elements: vdcSelectedNodes, error: onError, diff --git a/src/ozones/Server/public/js/plugins/zones-tab.js b/src/ozones/Server/public/js/plugins/zones-tab.js index d7430e75ad..00ab69e0c7 100644 --- a/src/ozones/Server/public/js/plugins/zones-tab.js +++ b/src/ozones/Server/public/js/plugins/zones-tab.js @@ -118,7 +118,7 @@ var zone_actions = { "Zone.delete" : { type: "multiple", - call: oZones.Zone.delete, + call: oZones.Zone.del, callback: deleteZoneElement, elements: zoneSelectedNodes, error: onError, diff --git a/src/ozones/Server/templates/index.html b/src/ozones/Server/templates/index.html index f6d034a4cf..94797a67f8 100644 --- a/src/ozones/Server/templates/index.html +++ b/src/ozones/Server/templates/index.html @@ -60,7 +60,7 @@ diff --git a/src/pool/PoolSQL.cc b/src/pool/PoolSQL.cc index 0d167e2d4f..12835f7cc6 100644 --- a/src/pool/PoolSQL.cc +++ b/src/pool/PoolSQL.cc @@ -187,6 +187,7 @@ PoolObjectSQL * PoolSQL::get( if ( objectsql->isValid() == false ) { + objectsql->unlock(); objectsql = 0; } } @@ -276,7 +277,6 @@ PoolObjectSQL * PoolSQL::get(const string& name, int ouid, bool olock) if ( objectsql->isValid() == false ) { objectsql->unlock(); - objectsql = 0; } } diff --git a/src/sunstone/etc/sunstone-plugins.yaml b/src/sunstone/etc/sunstone-plugins.yaml index bc724898ba..edde7af592 100644 --- a/src/sunstone/etc/sunstone-plugins.yaml +++ b/src/sunstone/etc/sunstone-plugins.yaml @@ -53,11 +53,15 @@ :ALL: true :user: :group: -- plugins/hosts-tab.js: +- plugins/clusters-tab.js: :ALL: false :user: :group: oneadmin: true +- plugins/hosts-tab.js: + :ALL: true + :user: + :group: - plugins/datastores-tab.js: :ALL: true :user: @@ -66,8 +70,3 @@ :ALL: true :user: :group: -- plugins/clusters-tab.js: - :ALL: false - :user: - :group: - oneadmin: true diff --git a/src/sunstone/etc/sunstone-server.conf b/src/sunstone/etc/sunstone-server.conf index cddab640a1..64915b50c0 100644 --- a/src/sunstone/etc/sunstone-server.conf +++ b/src/sunstone/etc/sunstone-server.conf @@ -1,16 +1,47 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) # +# # +# 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. # +#--------------------------------------------------------------------------- # + +############################################################# +# Server Configuration +############################################################# + # OpenNebula sever contact information :one_xmlrpc: http://localhost:2633/RPC2 -# 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG -:debug_level: 3 - # Server Configuration :host: 127.0.0.1 :port: 9869 +############################################################# +# Log +############################################################# + +# Log debug level +# 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG +:debug_level: 3 + +############################################################# +# Auth +############################################################# + # Authentication driver for incomming requests # sunstone, for OpenNebula's user-password scheme # x509, for x509 certificates based authentication +# opennebula, the authentication will be done by the opennebula core using the driver +# defined for the user :auth: sunstone # Authentication driver to communicate with OpenNebula core @@ -18,6 +49,10 @@ # x509, for x509 certificate encryption of tokens :core_auth: cipher +############################################################# +# UI Settings +############################################################# + # VNC Configuration # base_port: base_port + vnc_port of the VM is the port where the # proxy will listen for VNC session connections to that VM. diff --git a/src/sunstone/models/SunstoneServer.rb b/src/sunstone/models/SunstoneServer.rb index 2739d9b2b4..ce5f2ad644 100644 --- a/src/sunstone/models/SunstoneServer.rb +++ b/src/sunstone/models/SunstoneServer.rb @@ -198,7 +198,7 @@ class SunstoneServer < CloudServer end ############################################################################ - # + # Unused ############################################################################ def get_vm_log(id) resource = retrieve_resource("vm", id) diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index eb4f149d30..a69f0e9809 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -46,21 +46,24 @@ var OpenNebula = { { switch(type) { - case "HOST","host": + case "HOST": + case "host": return ["INIT", "MONITORING", "MONITORED", "ERROR", "DISABLED"][value]; break; - case "HOST_SIMPLE","host_simple": + case "HOST_SIMPLE": + case "host_simple": return ["ON", "ON", "ON", "ERROR", "OFF"][value]; break; - case "VM","vm": + case "VM": + case "vm": return ["INIT", "PENDING", "HOLD", @@ -70,7 +73,8 @@ var OpenNebula = { "DONE", "FAILED"][value]; break; - case "VM_LCM","vm_lcm": + case "VM_LCM": + case "vm_lcm": return ["LCM_INIT", "PROLOG", "BOOT", @@ -89,7 +93,8 @@ var OpenNebula = { "CLEANUP", "UNKNOWN"][value]; break; - case "IMAGE","image": + case "IMAGE": + case "image": return ["INIT", "READY", "USED", @@ -97,6 +102,14 @@ var OpenNebula = { "LOCKED", "ERROR"][value]; break; + case "VM_MIGRATE_REASON": + case "vm_migrate_reason": + return ["NONE", + "ERROR", + "STOP_RESUME", + "USER", + "CANCEL"][value]; + break; default: return; } @@ -203,7 +216,7 @@ var OpenNebula = { }); }, - "delete": function(params,resource){ + "del": function(params,resource){ var callback = params.success; var callback_error = params.error; var id = params.data.id; @@ -437,8 +450,8 @@ var OpenNebula = { "create": function(params){ OpenNebula.Action.create(params,OpenNebula.Host.resource); }, - "delete": function(params){ - OpenNebula.Action.delete(params,OpenNebula.Host.resource); + "del": function(params){ + OpenNebula.Action.del(params,OpenNebula.Host.resource); }, "list": function(params){ OpenNebula.Action.list(params,OpenNebula.Host.resource); @@ -476,8 +489,8 @@ var OpenNebula = { "create": function(params){ OpenNebula.Action.create(params,OpenNebula.Network.resource); }, - "delete": function(params){ - OpenNebula.Action.delete(params,OpenNebula.Network.resource); + "del": function(params){ + OpenNebula.Action.del(params,OpenNebula.Network.resource); }, "list": function(params){ OpenNebula.Action.list(params,OpenNebula.Network.resource); @@ -550,8 +563,8 @@ var OpenNebula = { "create": function(params){ OpenNebula.Action.create(params,OpenNebula.VM.resource); }, - "delete": function(params){ - OpenNebula.Action.delete(params,OpenNebula.VM.resource); + "del": function(params){ + OpenNebula.Action.del(params,OpenNebula.VM.resource); }, "list": function(params){ OpenNebula.Action.list(params,OpenNebula.VM.resource); @@ -668,8 +681,8 @@ var OpenNebula = { "create": function(params){ OpenNebula.Action.create(params,OpenNebula.Group.resource); }, - "delete": function(params){ - OpenNebula.Action.delete(params,OpenNebula.Group.resource); + "del": function(params){ + OpenNebula.Action.del(params,OpenNebula.Group.resource); }, "list": function(params){ OpenNebula.Action.list(params,OpenNebula.Group.resource); @@ -682,8 +695,8 @@ var OpenNebula = { "create": function(params){ OpenNebula.Action.create(params,OpenNebula.User.resource); }, - "delete": function(params){ - OpenNebula.Action.delete(params,OpenNebula.User.resource); + "del": function(params){ + OpenNebula.Action.del(params,OpenNebula.User.resource); }, "list": function(params){ OpenNebula.Action.list(params,OpenNebula.User.resource); @@ -734,8 +747,8 @@ var OpenNebula = { "create": function(params){ OpenNebula.Action.create(params,OpenNebula.Image.resource); }, - "delete": function(params){ - OpenNebula.Action.delete(params,OpenNebula.Image.resource); + "del": function(params){ + OpenNebula.Action.del(params,OpenNebula.Image.resource); }, "list": function(params){ OpenNebula.Action.list(params,OpenNebula.Image.resource); @@ -793,8 +806,8 @@ var OpenNebula = { "create" : function(params){ OpenNebula.Action.create(params,OpenNebula.Template.resource); }, - "delete" : function(params){ - OpenNebula.Action.delete(params,OpenNebula.Template.resource); + "del" : function(params){ + OpenNebula.Action.del(params,OpenNebula.Template.resource); }, "list" : function(params){ OpenNebula.Action.list(params,OpenNebula.Template.resource); @@ -846,8 +859,8 @@ var OpenNebula = { "create" : function(params){ OpenNebula.Action.create(params,OpenNebula.Acl.resource); }, - "delete" : function(params){ - OpenNebula.Action.delete(params,OpenNebula.Acl.resource); + "del" : function(params){ + OpenNebula.Action.del(params,OpenNebula.Acl.resource); }, "list" : function(params){ OpenNebula.Action.list(params,OpenNebula.Acl.resource); @@ -860,8 +873,8 @@ var OpenNebula = { "create" : function(params){ OpenNebula.Action.create(params,OpenNebula.Cluster.resource); }, - "delete" : function(params){ - OpenNebula.Action.delete(params,OpenNebula.Cluster.resource); + "del" : function(params){ + OpenNebula.Action.del(params,OpenNebula.Cluster.resource); }, "list" : function(params){ OpenNebula.Action.list(params,OpenNebula.Cluster.resource); @@ -906,8 +919,8 @@ var OpenNebula = { "create" : function(params){ OpenNebula.Action.create(params,OpenNebula.Datastore.resource); }, - "delete" : function(params){ - OpenNebula.Action.delete(params,OpenNebula.Datastore.resource); + "del" : function(params){ + OpenNebula.Action.del(params,OpenNebula.Datastore.resource); }, "list" : function(params){ OpenNebula.Action.list(params,OpenNebula.Datastore.resource); diff --git a/src/sunstone/public/js/plugins/acls-tab.js b/src/sunstone/public/js/plugins/acls-tab.js index 6a78b08d4f..98045c0e7c 100644 --- a/src/sunstone/public/js/plugins/acls-tab.js +++ b/src/sunstone/public/js/plugins/acls-tab.js @@ -129,7 +129,7 @@ var acl_actions = { "Acl.delete" : { type: "multiple", - call: OpenNebula.Acl.delete, + call: OpenNebula.Acl.del, callback: deleteAclElement, elements: aclElements, error: onError, diff --git a/src/sunstone/public/js/plugins/clusters-tab.js b/src/sunstone/public/js/plugins/clusters-tab.js index b0cccd6aaa..7cb41a21cd 100644 --- a/src/sunstone/public/js/plugins/clusters-tab.js +++ b/src/sunstone/public/js/plugins/clusters-tab.js @@ -166,7 +166,7 @@ var cluster_actions = { "Cluster.delete" : { type: "multiple", - call : OpenNebula.Cluster.delete, + call : OpenNebula.Cluster.del, callback : deleteClusterElement, elements: clusterElements, error : onError, @@ -366,7 +366,82 @@ function clusterTabContent(cluster_json) { vnets_list = '
  • '+cluster.VNETS.ID+' - '+getVNetName(cluster.VNETS.ID)+'
  • '; */ + //special case for cluster none, simplified dashboard + if (cluster.ID == "-"){ + var html_code = '\ +\ +\ +\ +\ +
    \ +\ + \ + \ + \ + \ + \ + \ +
    \ +
    \ +

    ' + tr("Cluster information") + '

    \ +
    \ +\ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
    ' + tr("ID") + ''+cluster.ID+'
    ' + tr("Name") + ''+cluster.NAME+'
    \ +\ +
    \ +
    \ +
    \ +
    \ +

    ' + tr("Hosts") + '

    \ + \ +
    \ +
    \ +\ + \ + \ + \ + \ + \ + \ +
    \ +
    \ +

    ' + tr("Datastores") + '

    \ + \ +
    \ +
    \ +
    \ +

    ' + tr("Virtual Networks") + '

    \ + \ +
    \ +
    \ +
    \ +'; + return html_code; + }; + //end cluster none special html var html_code = '\ \ @@ -453,7 +528,7 @@ function removeClusterMenus(){ // Sunstone.removeMainTab('cluster_vnets_tab_n',true); // Sunstone.removeMainTab('cluster_datastores_tab_n',true); // Sunstone.removeMainTab('cluster_hosts_tab_n',true); - Sunstone.removeMainTab('cluster_tab_n',true); + Sunstone.removeMainTab('cluster_tab_-',true); for (var i=0; i < data.length; i++){ var id = data[i][1]; diff --git a/src/sunstone/public/js/plugins/datastores-tab.js b/src/sunstone/public/js/plugins/datastores-tab.js index 854bbba145..adf2ac61dc 100644 --- a/src/sunstone/public/js/plugins/datastores-tab.js +++ b/src/sunstone/public/js/plugins/datastores-tab.js @@ -207,7 +207,7 @@ var datastore_actions = { "Datastore.delete" : { type: "multiple", - call : OpenNebula.Datastore.delete, + call : OpenNebula.Datastore.del, callback : deleteDatastoreElement, elements: datastoreElements, error : onError, @@ -271,7 +271,8 @@ var datastore_buttons = { "Datastore.update_dialog" : { type: "action", text: tr("Update properties"), - alwaysActive: true + alwaysActive: true, + condition: mustBeAdmin, }, "Datastore.addtocluster" : { type: "confirm_with_select", @@ -296,7 +297,8 @@ var datastore_buttons = { }, "Datastore.delete" : { type: "confirm", - text: tr("Delete") + text: tr("Delete"), + condition: mustBeAdmin } } @@ -443,7 +445,7 @@ function updateDatastoreInfo(request,ds){ \ \ \ - \ + \ \ \ \ diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js index bd267b42e7..b1b112a309 100644 --- a/src/sunstone/public/js/plugins/groups-tab.js +++ b/src/sunstone/public/js/plugins/groups-tab.js @@ -97,7 +97,7 @@ var group_actions = { "Group.delete" : { type: "multiple", - call : OpenNebula.Group.delete, + call : OpenNebula.Group.del, callback : deleteGroupElement, error : onError, elements: groupElements, diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js index 0abc980a5b..7dd75732b5 100644 --- a/src/sunstone/public/js/plugins/hosts-tab.js +++ b/src/sunstone/public/js/plugins/hosts-tab.js @@ -189,7 +189,7 @@ var host_actions = { "Host.delete" : { type: "multiple", - call : OpenNebula.Host.delete, + call : OpenNebula.Host.del, callback : deleteHostElement, elements: hostElements, error : onError, @@ -271,30 +271,36 @@ var host_buttons = { }, "Host.create_dialog" : { type: "create_dialog", - text: tr("+ New") + text: tr("+ New"), + condition: mustBeAdmin }, "Host.update_dialog" : { type: "action", text: tr("Update a template"), - alwaysActive: true + alwaysActive: true, + condition: mustBeAdmin }, "Host.addtocluster" : { type: "confirm_with_select", text: tr("Select cluster"), select: clusters_sel, tip: tr("Select the destination cluster:"), + condition: mustBeAdmin }, "Host.enable" : { type: "action", - text: tr("Enable") + text: tr("Enable"), + condition: mustBeAdmin }, "Host.disable" : { type: "action", - text: tr("Disable") + text: tr("Disable"), + condition: mustBeAdmin }, "Host.delete" : { type: "confirm", - text: tr("Delete host") + text: tr("Delete host"), + condition: mustBeAdmin } }; @@ -475,7 +481,7 @@ function updateHostInfo(request,host){ \ \ \ - \ + \ \ \ \ @@ -493,10 +499,6 @@ function updateHostInfo(request,host){ \ \ \ - \ - \ - \ - \ \
    '+tr("Cluster")+''+(element.CLUSTER.length ? element.CLUSTER : "-")+''+(info.CLUSTER.length ? info.CLUSTER : "-")+'
    '+tr("DS Mad")+'
    ' + tr("Cluster") + ''+(host.CLUSTER.length ? host.CLUSTER : "-")+''+(host_info.CLUSTER.length ? host_info.CLUSTER : "-")+'
    ' + tr("State") + ''+ tr("VN MAD") +''+host_info.VN_MAD+'
    '+ tr("TM MAD") +''+host_info.TM_MAD+'
    \ \ diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index 52af42ef20..8ba9bc5005 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -374,7 +374,7 @@ var image_actions = { "Image.delete" : { type: "multiple", - call: OpenNebula.Image.delete, + call: OpenNebula.Image.del, callback: deleteImageElement, elements: imageElements, error: onError, diff --git a/src/sunstone/public/js/plugins/infra-tab.js b/src/sunstone/public/js/plugins/infra-tab.js index 49e3782ed7..0b52418572 100644 --- a/src/sunstone/public/js/plugins/infra-tab.js +++ b/src/sunstone/public/js/plugins/infra-tab.js @@ -15,7 +15,7 @@ /* -------------------------------------------------------------------------- */ var infra_tab_content = -'
    \ +'
    \ \ \ \
    \ \ @@ -26,7 +26,7 @@ var infra_tab_content =
    \ \
    \ - \ + \ \ \ \ @@ -54,7 +54,7 @@ var infra_tab_content =

    ' + tr("Quickstart") + '

    \
    \


    \ - '+tr("Create new Cluster")+'
    \ + '+tr("Create new Cluster")+'
    \ '+tr("Create new Host")+'
    \ '+tr("Create new Datastore")+'
    \ '+tr("Create new Virtual Network")+'
    \ @@ -72,7 +72,7 @@ var infra_tab_content =

    \

    ' + tr("Infrastructure resources") + '

    \
    \ -

    '+tr("The Infrastructure menu allows management of Hosts, Datastores, Virtual Networks and the Clusters they are placed in. The Clusters node can be expanded, and resources can be managed for each cluster.")+'

    \ +

    '+tr("The Infrastructure menu allows management of Hosts, Datastores, Virtual Networks. Users in the oneadmin group can manage clusters as well.")+'

    \

    '+tr("You can find further information on the following links:")+'

    \
      \
    • Host subsystem
    • \ @@ -117,5 +117,6 @@ function updateInfraDashboard(what,json_info){ }; $(document).ready(function(){ - + if (!mustBeAdmin()) + $('table#infra_dashboard .cluster_related', main_tabs_context).hide(); }); \ No newline at end of file diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index f7496b0892..e56070b9c9 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -186,7 +186,7 @@ var create_template_tmpl = '
      \

      '+tr("Add disks/images")+'

      \
      \
      '+tr("Disks")+'\ -
      \ +
    \ \ \ + \ \ \ \ @@ -353,7 +354,7 @@ var vm_actions = { "VM.delete" : { type: "multiple", - call: OpenNebula.VM.delete, + call: OpenNebula.VM.del, callback: deleteVMachineElement, elements: vmElements, error: onError, @@ -592,6 +593,10 @@ var vm_info_panel = { "vm_log_tab" : { title: tr("VM log"), content: "" + }, + "vm_history_tab" : { + title: tr("History information"), + content: "", } } @@ -619,7 +624,21 @@ function vmShow(req) { // Returns a human readable running time for a VM function str_start_time(vm){ return pretty_time(vm.STIME); -} +}; + +function ip_str(vm){ + var nic = vm.TEMPLATE.NIC; + var ip = '--'; + if ($.isArray(nic)) { + ip = ''; + $.each(nic, function(index,value){ + ip += value.IP+'
    '; + }); + } else if (nic && nic.IP) { + ip = nic.IP; + }; + return ip; +}; // Returns an array formed by the information contained in the vm_json // and ready to be introduced in a dataTable @@ -650,10 +669,11 @@ function vMachineElementArray(vm_json){ vm.CPU, humanize_size(vm.MEMORY), hostname, + ip_str(vm), str_start_time(vm), vncIcon(vm) ]; -} +}; //Creates a listener for the TDs of the VM table @@ -703,7 +723,69 @@ function updateVMachinesView(request, vmachine_list){ updateView(vmachine_list_array,dataTable_vMachines); updateDashboard("vms",vmachine_list); updateVResDashboard("vms",vmachine_list); -} +}; + +function generateHistoryTable(vm){ + var html = '
    '+tr("CPU")+''+tr("Memory")+''+tr("Hostname")+''+tr("IPs")+''+tr("Start Time")+''+tr("VNC Access")+'
    \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + '; + + var history = []; + + if ($.isArray(vm.HISTORY_RECORDS.HISTORY)) + history = vm.HISTORY_RECORDS.HISTORY; + else if (vm.HISTORY_RECORDS.HISTORY.SEQ) + history = [vm.HISTORY_RECORDS.HISTORY]; + + var now = Math.round(new Date().getTime() / 1000); + + for (var i=0; i < history.length; i++){ + // :TIME time calculations copied from onevm_helper.rb + var stime = parseInt(history[i].STIME, 10); + + var etime = parseInt(history[i].ETIME, 10) + etime = etime == 0 ? now : etime; + + var dtime = etime - stime; + // end :TIME + + //:PTIME + var stime2 = parseInt(history[i].PSTIME, 10); + var etime2; + var ptime2 = parseInt(history[i].PETIME, 10); + if (stime2 == 0) + etime2 = 0; + else + etime2 = ptime2 == 0 ? now : ptime2; + var dtime2 = etime2 - stime2; + + //end :PTIME + + + html += ' \ + \ + \ + \ + \ + \ + \ + \ + ' + }; + html += '\ +
    '+tr("Sequence")+''+tr("Hostname")+''+tr("Reason")+''+tr("State change time")+''+tr("Total time")+''+tr("Prolog time")+'
    '+history[i].SEQ+''+history[i].HOSTNAME+''+OpenNebula.Helper.resource_state("VM_MIGRATE_REASON",parseInt(history[i].REASON, 10))+''+pretty_time(history[i].STIME)+''+pretty_time_runtime(dtime)+''+pretty_time_runtime(dtime2)+'
    '; + return html; + +}; // Refreshes the information panel for a VM @@ -805,7 +887,7 @@ function updateVMInfo(request,vm){
    ' - } + }; var template_tab = { title: tr("VM Template"), @@ -814,21 +896,27 @@ function updateVMInfo(request,vm){ '+tr("VM template")+''+ prettyPrintJSON(vm_info.TEMPLATE)+ '' - } + }; var log_tab = { title: tr("VM log"), content: '
    '+spinner+'
    ' - } + }; var monitoring_tab = { title: tr("Monitoring information"), content: generateMonitoringDivs(vm_graphs,"vm_monitor_") - } + }; + + var history_tab = { + title: tr("History information"), + content: generateHistoryTable(vm_info), + }; Sunstone.updateInfoPanelTab("vm_info_panel","vm_info_tab",info_tab); Sunstone.updateInfoPanelTab("vm_info_panel","vm_template_tab",template_tab); Sunstone.updateInfoPanelTab("vm_info_panel","vm_log_tab",log_tab); + Sunstone.updateInfoPanelTab("vm_info_panel","vm_history_tab",history_tab); Sunstone.updateInfoPanelTab("vm_info_panel","vm_monitoring_tab",monitoring_tab); //Pop up the info panel and asynchronously get vm_log and stats @@ -1284,9 +1372,9 @@ $(document).ready(function(){ "aoColumnDefs": [ { "bSortable": false, "aTargets": ["check"] }, { "sWidth": "60px", "aTargets": [0,6,7] }, - { "sWidth": "35px", "aTargets": [1,10] }, - { "sWidth": "150px", "aTargets": [5,9] }, - { "sWidth": "100px", "aTargets": [2,3] } + { "sWidth": "35px", "aTargets": [1,11] }, + { "sWidth": "150px", "aTargets": [5,10] }, + { "sWidth": "100px", "aTargets": [2,3,9] } ], "oLanguage": (datatable_lang != "") ? { @@ -1297,7 +1385,7 @@ $(document).ready(function(){ dataTable_vMachines.fnClearTable(); addElement([ spinner, - '','','','','','','','','',''],dataTable_vMachines); + '','','','','','','','','','',''],dataTable_vMachines); Sunstone.runAction("VM.list"); setupCreateVMDialog(); diff --git a/src/sunstone/public/js/plugins/vnets-tab.js b/src/sunstone/public/js/plugins/vnets-tab.js index d65f672ebe..f5047ebd87 100644 --- a/src/sunstone/public/js/plugins/vnets-tab.js +++ b/src/sunstone/public/js/plugins/vnets-tab.js @@ -283,7 +283,7 @@ var vnet_actions = { "Network.delete" : { type: "multiple", - call: OpenNebula.Network.delete, + call: OpenNebula.Network.del, callback: deleteVNetworkElement, elements: vnElements, error: onError, @@ -566,7 +566,7 @@ function updateVNetworkInfo(request,vn){ \ \ '+tr("Cluster")+'\ - '+(network.CLUSTER.length ? network.CLUSTER : "-")+'\ + '+(vn_info.CLUSTER.length ? vn_info.CLUSTER : "-")+'\ \ \ '+tr("Owner")+'\ diff --git a/src/sunstone/public/js/sunstone-util.js b/src/sunstone/public/js/sunstone-util.js index 22064569de..7877635b51 100644 --- a/src/sunstone/public/js/sunstone-util.js +++ b/src/sunstone/public/js/sunstone-util.js @@ -60,6 +60,20 @@ function pretty_time_axis(time){ return hour + ":" + mins + ":" + secs;// + " " + month + "/" + day; } +function pretty_time_runtime(time){ + var d = new Date(); + d.setTime(time*1000); + + var secs = pad(d.getUTCSeconds(),2); + var hour = pad(d.getUTCHours(),2); + var mins = pad(d.getUTCMinutes(),2); + var day = d.getUTCDate()-1; + var month = pad(d.getUTCMonth()+1,2); //getMonths returns 0-11 + var year = d.getUTCFullYear(); + + return day + "d " + hour + ":" + mins;// + ":" + secs;// + " " + month + "/" + day; +} + //returns a human readable size in Kilo, Mega, Giga or Tera bytes function humanize_size(value) { if (typeof(value) === "undefined") { diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index df9659a96c..20e82c3909 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -465,7 +465,19 @@ function insertTab(tab_name){ $('div#'+tab_name,main_tabs_context).html(tab_info.content); - $('div#menu ul#navigation').append('
  • '+tab_info.title+'
  • '); + var li_item = '
  • '+tab_info.title+'
  • '; + + //if this is a submenu... + if (parent.length) { + var children = $('div#menu ul#navigation li.'+parent); + //if there are other submenus, insert after last of them + if (children.length) + $(children[children.length-1]).after(li_item); + else //instert after parent menu + $('div#menu ul#navigation li#li_'+parent).after(li_item); + } else { //not a submenu, instert in the end + $('div#menu ul#navigation').append(li_item); + }; if (parent){ //this is a subtab $('div#menu li#li_'+tab_name).hide();//hide by default diff --git a/src/sunstone/views/index.erb b/src/sunstone/views/index.erb index a2ad30582d..b481adc66f 100644 --- a/src/sunstone/views/index.erb +++ b/src/sunstone/views/index.erb @@ -85,7 +85,7 @@ diff --git a/src/tm_mad/shared/mvds b/src/tm_mad/shared/mvds index b44d724c41..94a8214662 100755 --- a/src/tm_mad/shared/mvds +++ b/src/tm_mad/shared/mvds @@ -53,11 +53,10 @@ umask 0007 SRC_READLN=\$($READLINK -f $SRC_PATH) DST_READLN=\$($READLINK -f $DST_PATH) -if [ \( -L $SRC \) -a \( "\$SRC_READLN" = "\$DST_READLN" \) ] ; then +if [ \( -L $SRC_PATH \) -a \( "\$SRC_READLN" = "\$DST_READLN" \) ] ; then echo "Not moving files to image repo, they are the same" else - qemu-img convert $SRC_PATH -O qcow2 $DST_PATH - rm $SRC_PATH + mv -f $SRC_PATH $DST_PATH fi EOF )