1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

Merge branch 'master' of git.opennebula.org:one

This commit is contained in:
Daniel Molina 2011-09-14 17:13:11 +02:00
commit 204261d66b
64 changed files with 2477 additions and 4136 deletions

View File

@ -31,6 +31,11 @@ class User : public PoolObjectSQL
{
public:
/**
* Characters that can not be in a password
*/
static const string INVALID_CHARS;
/**
* Function to print the User object into a string in XML format
* @param xml the resulting XML string
@ -73,11 +78,56 @@ public:
};
/**
* Sets user password
* Checks if a name or password is valid, i.e. it is not empty and does not
* contain invalid characters.
* @param str Name or password to be checked
* @param error_str Returns the error reason, if any
* @return true if the string is valid
*/
void set_password(string _password)
static bool is_valid(const string& str, string& error_str)
{
password = _password;
if ( str.empty() )
{
error_str = "cannot be empty";
return false;
}
size_t pos = str.find_first_of(INVALID_CHARS);
if ( pos != string::npos )
{
ostringstream oss;
oss << "character '" << str.at(pos) << "' is not allowed";
error_str = oss.str();
return false;
}
return true;
}
/**
* Sets user password. It checks that the new password does not contain
* forbidden chars.
* @param _password the new pass
* @param error_str Returns the error reason, if any
* @returns -1 if the password is not valid
*/
int set_password(const string& passwd, string& error_str)
{
int rc = 0;
if (is_valid(passwd, error_str))
{
password = passwd;
}
else
{
error_str = string("Invalid password: ").append(error_str);
rc = -1;
}
return rc;
};
/**

View File

@ -191,6 +191,7 @@ ETC_DIRS="$ETC_LOCATION/im_kvm \
$ETC_LOCATION/tm_lvm \
$ETC_LOCATION/hm \
$ETC_LOCATION/auth \
$ETC_LOCATION/auth/certificates \
$ETC_LOCATION/ec2query_templates \
$ETC_LOCATION/occi_templates \
$ETC_LOCATION/cli"
@ -1032,7 +1033,7 @@ OZONES_ETC_FILES="src/ozones/Server/etc/ozones-server.conf"
OZONES_MODELS_FILES="src/ozones/Server/models/OzonesServer.rb \
src/ozones/Server/models/Auth.rb \
src/ozones/Server/models/OCAInteraction.rb \
src/ozones/Server/models/JSONUtils.rb"
src/sunstone/models/OpenNebulaJSON/JSONUtils.rb"
OZONES_TEMPLATE_FILES="src/ozones/Server/templates/index.html \
src/ozones/Server/templates/login.html"

View File

@ -23,7 +23,7 @@ digraph OpenNebula {
subgraph { rank = same; prolog; prolog_resume; prolog_migrate;
color="white" }
subgraph { rank = max; suspended; done; cancel; failure;
subgraph { rank = max; suspended; done; failure;
stopped;color="white" }
# create
@ -64,7 +64,7 @@ digraph OpenNebula {
# cancel
running -> cancel [label="cancel"];
cancel -> done [style="dashed"];
cancel -> epilog [style="dashed"];
# suspend
running -> save_suspend [label="suspend"];

View File

@ -34,8 +34,8 @@ digraph OpenNebula {
# shutdown
running -> shutdown [label="shutdown"];
shutdown -> epilog [label="shutdown", style="dashed"];
epilog -> done [label="shutdown", style="dashed"];
shutdown -> epilog [style="dashed"];
epilog -> done [style="dashed"];
# livemigrate
running -> migrate [label="livemigrate"];
@ -59,7 +59,6 @@ digraph OpenNebula {
# cancel
running -> shutdown [label="cancel"];
shutdown -> done [label="cancel", style="dashed"];
# suspend
running -> save [label="suspend"];

View File

@ -538,17 +538,22 @@ HM_MAD = [
#*******************************************************************************
# Auth Manager Configuration
#*******************************************************************************
# The Driver (AUTHM_MAD) that will be used to authenticate and authorize
# OpenNebula requests. If not defined OpenNebula will use the built-in auth
# policies
# The Driver (AUTH_MAD) that will be used to authenticate (authn) and
# authorize (authz) OpenNebula requests. If defined OpenNebula will use the
# built-in auth policies.
#
# executable: path of the auth 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, can be an absolute path or relative
# to $ONE_LOCATION/etc (or /etc/one/ if OpenNebula was installed
# in /)
# arguments :
# --authn: list of authentication modules separated by commas, if not
# defined all the modules available will be enabled
# --authz: authorization module
#-------------------------------------------------------------------------------
#AUTH_MAD = [
# executable = "one_auth_mad" ]
# executable = "one_auth_mad",
# arguments = "--authz quota --authn plain,ssh,x509"
#]

View File

@ -36,11 +36,14 @@ DISTRIBUTIONS={
SQLITE => ['gcc', 'libsqlite3-dev'],
'mysql' => ['gcc', 'libmysqlclient-dev'],
'curb' => ['gcc', 'libcurl4-openssl-dev'],
'nokogiri' => ['gcc', 'libexpat1-dev'],
'xmlparser' => %w{gcc rake libxml2-dev libxslt1-dev},
'nokogiri' => %w{gcc rake libxml2-dev libxslt1-dev},
'xmlparser' => ['gcc', 'libexpat1-dev'],
'thin' => ['g++']
},
:install_command => 'apt-get install'
:install_command => 'apt-get install',
:gem_env => {
'rake' => '/usr/bin/rake'
}
},
:redhat => {
:id => ['CentOS', /^RedHat/],
@ -48,8 +51,8 @@ DISTRIBUTIONS={
SQLITE => ['gcc', 'sqlite-devel'],
'mysql' => ['gcc', 'mysql-devel'],
'curb' => ['gcc', 'curl-devel'],
'nokogiri' => ['gcc', 'expat-devel'],
'xmlparser' => %w{gcc rubygem-rake libxml2-devel libxslt-devel},
'nokogiri' => %w{gcc rubygem-rake libxml2-devel libxslt-devel},
'xmlparser' => ['gcc', 'expat-devel'],
'thin' => ['gcc-c++']
},
:install_command => 'yum install'
@ -60,8 +63,8 @@ DISTRIBUTIONS={
SQLITE => ['gcc', 'sqlite3-devel'],
'mysql' => ['gcc', 'libmysqlclient-devel'],
'curb' => ['gcc', 'libcurl-devel'],
'nokogiri' => ['gcc', 'libexpat-devel'],
'xmlparser' => %w{rubygem-rake gcc rubygem-rake libxml2-devel libxslt-devel},
'nokogiri' => %w{rubygem-rake gcc rubygem-rake libxml2-devel libxslt-devel},
'xmlparser' => ['gcc', 'libexpat-devel'],
'thin' => ['rubygem-rake', 'gcc-c++']
},
:install_command => 'zypper install'
@ -235,8 +238,15 @@ install_dependencies(gems_list, dist)
packages_string=gems_list.join(' ')
prefix=""
command_string = "gem install --no-ri --no-rdoc"
if dist.last[:gem_env]
prefix=dist.last[:gem_env].collect do |name, value|
"#{name}=\"#{value}\""
end.join(' ')+' '
end
command_string = "#{prefix}gem install --no-ri --no-rdoc"
install_warning(packages)

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "ONEACL" "1" "July 2011" "" "oneacl(1) -- manages OpenNebula ACLs"
.TH "ONEACL" "1" "September 2011" "" "oneacl(1) -- manages OpenNebula ACLs"
.
.SH "NAME"
\fBoneacl\fR
@ -23,14 +23,13 @@
.SH "COMMANDS"
.
.IP "\(bu" 4
list
create \fIuser|rulestr\fR [\fIresource\fR] [\fIrights\fR]
.
.IP "" 4
.
.nf
Lists the ACL rule set
valid options: xml
Adds a new ACL rule
.
.fi
.
@ -52,13 +51,14 @@ Deletes an existing ACL rule
.
.IP "\(bu" 4
create \fIuser|rulestr\fR [\fIresource\fR] [\fIrights\fR]
list
.
.IP "" 4
.
.nf
Adds a new ACL rule
Lists the ACL rule set
valid options: xml
.
.fi
.
@ -70,21 +70,65 @@ Adds a new ACL rule
.SH "ARGUMENT FORMATS"
.
.IP "\(bu" 4
text
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
file
text
.
.IP "" 4
.
.nf
String
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
aclid_list
.
.IP "" 4
.
.nf
Comma\-separated list of OpenNebula ACL names or ids
.
.fi
.
.IP "" 0
.
.IP "" 0
.
.SH "LICENSE"
OpenNebula 2\.9\.80 Copyright 2002\-2011, OpenNebula Project Leads (OpenNebula\.org)
OpenNebula 2\.9\.85 Copyright 2002\-2011, 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

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "ONEDB" "1" "July 2011" "" "onedb(1) -- OpenNebula database migration tool"
.TH "ONEDB" "1" "September 2011" "" "onedb(1) -- OpenNebula database migration tool"
.
.SH "NAME"
\fBonedb\fR
@ -27,26 +27,25 @@ This command enables the user to manage the OpenNebula database\. It provides in
\-v, \-\-verbose Verbose mode
\-h, \-\-help Show this message
\-V, \-\-version Show version and copyright information
\-s file, \-\-sqlite file SQLite DB file
\-S host, \-\-server host MySQL server hostname or IP\. Defaults to localhost
\-P port, \-\-port port MySQL server port\. Defaults to 3306
\-u user, \-\-username user MySQL username
\-p pass, \-\-password pass MySQL password\. Leave unset to be prompted for it
\-d dbname, \-\-dbname dbname MySQL DB name for OpenNebula
\-s, \-\-sqlite file SQLite DB file
\-S, \-\-server host MySQL server hostname or IP\. Defaults to localhost
\-P, \-\-port port MySQL server port\. Defaults to 3306
\-u, \-\-username user MySQL username
\-p, \-\-password pass MySQL password\. Leave unset to be prompted for it
\-d, \-\-dbname dbname MySQL DB name for OpenNebula
.
.fi
.
.SH "COMMANDS"
.
.IP "\(bu" 4
restore [\fIbackup_file\fR]
backup [\fIoutput_file\fR]
.
.IP "" 4
.
.nf
Restores the DB from a backup file\. Only restores backups generated
from the same backend (SQLite or MySQL)
Dumps the DB to a file specified in the argument
valid options: force
.
.fi
@ -68,6 +67,36 @@ Use \-v flag to see also OpenNebula version
.
.IP "" 0
.
.IP "\(bu" 4
history
.
.IP "" 4
.
.nf
Prints the upgrades history
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
restore [\fIbackup_file\fR]
.
.IP "" 4
.
.nf
Restores the DB from a backup file\. Only restores backups generated
from the same backend (SQLite or MySQL)
valid options: force
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
upgrade [\fIversion\fR]
@ -85,48 +114,52 @@ valid options: force, backup
.
.IP "" 0
.
.IP "\(bu" 4
backup [\fIoutput_file\fR]
.
.IP "" 4
.
.nf
Dumps the DB to a file specified in the argument
valid options: force
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
history
.
.IP "" 4
.
.nf
Prints the upgrades history
.
.fi
.
.IP "" 0
.
.IP "" 0
.
.SH "ARGUMENT FORMATS"
.
.IP "\(bu" 4
text
.
.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 "" 0

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "ONEGROUP" "1" "July 2011" "" "onegroup(1) -- manages OpenNebula groups"
.TH "ONEGROUP" "1" "September 2011" "" "onegroup(1) -- manages OpenNebula groups"
.
.SH "NAME"
\fBonegroup\fR
@ -38,6 +38,20 @@ Creates a new Group
.
.IP "" 0
.
.IP "\(bu" 4
delete \fIrange|groupid_list\fR
.
.IP "" 4
.
.nf
Deletes the given Group
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
list
@ -55,21 +69,7 @@ valid options: list, delay, xml, numeric
.
.IP "\(bu" 4
delete \fIrange|groupid_list\fR
.
.IP "" 4
.
.nf
Deletes the given Group
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
show \fIgroupid\fR
show [\fIgroupid\fR]
.
.IP "" 4
.
@ -88,24 +88,79 @@ valid options: xml
.SH "ARGUMENT FORMATS"
.
.IP "\(bu" 4
groupid_list
.
.IP "\(bu" 4
text
.
.IP "\(bu" 4
groupid
.
.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
groupid
.
.IP "" 4
.
.nf
OpenNebula GROUP name or id
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
groupid_list
.
.IP "" 4
.
.nf
Comma\-separated list of OpenNebula GROUP names or ids
.
.fi
.
.IP "" 0
.
.IP "" 0
.
.SH "LICENSE"
OpenNebula 2\.9\.80 Copyright 2002\-2011, OpenNebula Project Leads (OpenNebula\.org)
OpenNebula 2\.9\.85 Copyright 2002\-2011, 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

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "ONEHOST" "1" "July 2011" "" "onehost(1) -- manages OpenNebula hosts"
.TH "ONEHOST" "1" "September 2011" "" "onehost(1) -- manages OpenNebula hosts"
.
.SH "NAME"
\fBonehost\fR
@ -27,13 +27,13 @@
.SH "COMMANDS"
.
.IP "\(bu" 4
enable \fIrange|hostid_list\fR
create \fIhostname\fR \fIim_mad\fR \fIvmm_mad\fR \fItm_mad\fR
.
.IP "" 4
.
.nf
Enables the given Host
Creates a new Host
.
.fi
.
@ -41,13 +41,27 @@ Enables the given Host
.
.IP "\(bu" 4
update \fIhostid\fR
delete \fIrange|hostid_list\fR
.
.IP "" 4
.
.nf
Launches the system editor to modify and update the template contents
Deletes the given Host
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
enable \fIrange|hostid_list\fR
.
.IP "" 4
.
.nf
Enables the given Host
.
.fi
.
@ -69,28 +83,13 @@ Disables the given Host
.
.IP "\(bu" 4
top
update \fIhostid\fR
.
.IP "" 4
.
.nf
Lists Hosts continuously
valid options: list, delay, xml, numeric, kilobytes
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
create \fIhostname\fR \fIim_mad\fR \fIvmm_mad\fR \fItm_mad\fR
.
.IP "" 4
.
.nf
Creates a new Host
Launches the system editor to modify and update the template contents
.
.fi
.
@ -112,21 +111,6 @@ The copy is performed the next time the Host is monitored
.
.IP "" 0
.
.IP "\(bu" 4
show \fIhostid\fR
.
.IP "" 4
.
.nf
Shows information for the given Host
valid options: xml
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
list
@ -144,13 +128,29 @@ valid options: list, delay, xml, numeric, kilobytes
.
.IP "\(bu" 4
delete \fIrange|hostid_list\fR
show \fIhostid\fR
.
.IP "" 4
.
.nf
Deletes the given Host
Shows information for the given Host
valid options: xml
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
top
.
.IP "" 4
.
.nf
Lists Hosts continuously
valid options: list, delay, xml, numeric, kilobytes
.
.fi
.
@ -162,24 +162,79 @@ Deletes the given Host
.SH "ARGUMENT FORMATS"
.
.IP "\(bu" 4
hostid_list
.
.IP "\(bu" 4
file
.
.IP "\(bu" 4
text
.IP "" 4
.
.IP "\(bu" 4
hostid
.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
hostid
.
.IP "" 4
.
.nf
OpenNebula HOST name or id
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
hostid_list
.
.IP "" 4
.
.nf
Comma\-separated list of OpenNebula HOST names or ids
.
.fi
.
.IP "" 0
.
.IP "" 0
.
.SH "LICENSE"
OpenNebula 2\.9\.80 Copyright 2002\-2011, OpenNebula Project Leads (OpenNebula\.org)
OpenNebula 2\.9\.85 Copyright 2002\-2011, 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

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "ONEIMAGE" "1" "July 2011" "" "oneimage(1) -- manages OpenNebula images"
.TH "ONEIMAGE" "1" "September 2011" "" "oneimage(1) -- manages OpenNebula images"
.
.SH "NAME"
\fBoneimage\fR
@ -13,9 +13,9 @@
.
.nf
\-x, \-\-xml Show the resource in xml format
\-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
@ -24,92 +24,6 @@
.fi
.
.SH "COMMANDS"
.
.IP "\(bu" 4
enable \fIrange|imageid_list\fR
.
.IP "" 4
.
.nf
Enables the given Image
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
update \fIimageid\fR
.
.IP "" 4
.
.nf
Launches the system editor to modify and update the template contents
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
disable \fIrange|imageid_list\fR
.
.IP "" 4
.
.nf
Disables the given Image
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
unpublish \fIrange|imageid_list\fR
.
.IP "" 4
.
.nf
Unpublishes the given Image\. A private Image can\'t be used by any other
User
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
show \fIimageid\fR
.
.IP "" 4
.
.nf
Shows information for the given Image
valid options: xml
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
chgrp \fIrange|imageid_list\fR \fIgroupid\fR
.
.IP "" 4
.
.nf
Changes the Image group
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
create \fIfile\fR
@ -126,14 +40,43 @@ Creates a new Image from the given template file
.
.IP "\(bu" 4
list [\fIfilterflag\fR]
delete \fIrange|imageid_list\fR
.
.IP "" 4
.
.nf
Lists Images in the pool
valid options: list, delay, xml, numeric
Deletes the given Image
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
publish \fIrange|imageid_list\fR
.
.IP "" 4
.
.nf
Publishes the given Image\. A public Image can be seen and used by other
Users in the Image\'s group
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
unpublish \fIrange|imageid_list\fR
.
.IP "" 4
.
.nf
Unpublishes the given Image\. A private Image can\'t be used by any other
User
.
.fi
.
@ -158,13 +101,13 @@ one VM instance at a time\.
.
.IP "\(bu" 4
delete \fIrange|imageid_list\fR
nonpersistent \fIrange|imageid_list\fR
.
.IP "" 4
.
.nf
Deletes the given Image
Makes the given Image non persistent\. See \'oneimage persistent\'
.
.fi
.
@ -172,14 +115,55 @@ Deletes the given Image
.
.IP "\(bu" 4
top [\fIfilterflag\fR]
update \fIimageid\fR
.
.IP "" 4
.
.nf
Lists Images continuously
valid options: list, delay, xml, numeric
Launches the system editor to modify and update the template contents
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
enable \fIrange|imageid_list\fR
.
.IP "" 4
.
.nf
Enables the given Image
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
disable \fIrange|imageid_list\fR
.
.IP "" 4
.
.nf
Disables the given Image
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
chgrp \fIrange|imageid_list\fR \fIgroupid\fR
.
.IP "" 4
.
.nf
Changes the Image group
.
.fi
.
@ -201,14 +185,14 @@ Changes the Image owner and group
.
.IP "\(bu" 4
publish \fIrange|imageid_list\fR
list [\fIfilterflag\fR]
.
.IP "" 4
.
.nf
Publishes the given Image\. A public Image can be seen and used by other
Users in the Image\'s group
Lists Images in the pool
valid options: list, delay, xml, numeric
.
.fi
.
@ -216,13 +200,29 @@ Users in the Image\'s group
.
.IP "\(bu" 4
nonpersistent \fIrange|imageid_list\fR
show \fIimageid\fR
.
.IP "" 4
.
.nf
Makes the given Image non persistent\. See \'oneimage persistent\'
Shows information for the given Image
valid options: xml
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
top [\fIfilterflag\fR]
.
.IP "" 4
.
.nf
Lists Images continuously
valid options: list, delay, xml, numeric
.
.fi
.
@ -234,33 +234,126 @@ Makes the given Image non persistent\. See \'oneimage persistent\'
.SH "ARGUMENT FORMATS"
.
.IP "\(bu" 4
userid
file
.
.IP "\(bu" 4
imageid
.IP "" 4
.
.IP "\(bu" 4
filterflag
.nf
Path to a file
.
.IP "\(bu" 4
groupid
.fi
.
.IP "" 0
.
.IP "\(bu" 4
range
.
.IP "\(bu" 4
file
.IP "" 4
.
.IP "\(bu" 4
imageid_list
.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
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 "\(bu" 4
imageid
.
.IP "" 4
.
.nf
OpenNebula IMAGE name or id
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
imageid_list
.
.IP "" 4
.
.nf
Comma\-separated list of OpenNebula IMAGE names or ids
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
filterflag
.
.IP "" 4
.
.nf
a, all all the known IMAGEs
m, mine the IMAGE belonging to the user in ONE_AUTH
g, group \'mine\' plus the IMAGE belonging to the groups
the user is member of
uid IMAGE of the user identified by this uid
user IMAGE of the user identified by the username
.
.fi
.
.IP "" 0
.
.IP "" 0
.
.SH "LICENSE"
OpenNebula 2\.9\.80 Copyright 2002\-2011, OpenNebula Project Leads (OpenNebula\.org)
OpenNebula 2\.9\.85 Copyright 2002\-2011, 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

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "ONETEMPLATE" "1" "July 2011" "" "onetemplate(1) -- manages OpenNebula templates"
.TH "ONETEMPLATE" "1" "September 2011" "" "onetemplate(1) -- manages OpenNebula templates"
.
.SH "NAME"
\fBonetemplate\fR
@ -13,9 +13,11 @@
.
.nf
\-x, \-\-xml Show the resource in xml format
\-n, \-\-name vm_name Name of the new Virtual Machine
\-m, \-\-multiple x Instance multiple VMs
\-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
@ -24,50 +26,6 @@
.fi
.
.SH "COMMANDS"
.
.IP "\(bu" 4
show \fItemplateid\fR
.
.IP "" 4
.
.nf
Shows information for the given Template
valid options: xml
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
update \fItemplateid\fR
.
.IP "" 4
.
.nf
Launches the system editor to modify and update the template contents
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
unpublish \fIrange|templateid_list\fR
.
.IP "" 4
.
.nf
Unpublishes the given Template\. A private Template can\'t be
instantiated by any other User
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
create \fIfile\fR
@ -82,50 +40,6 @@ Creates a new Template from the given template file
.
.IP "" 0
.
.IP "\(bu" 4
chgrp \fIrange|templateid_list\fR \fIgroupid\fR
.
.IP "" 4
.
.nf
Changes the Template group
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
list [\fIfilterflag\fR]
.
.IP "" 4
.
.nf
Lists Templates in the pool
valid options: list, delay, xml, numeric
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
top [\fIfilterflag\fR]
.
.IP "" 4
.
.nf
Lists Templates continuously
valid options: list, delay, xml, numeric
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
delete \fIrange|templateid_list\fR
@ -140,6 +54,22 @@ Deletes the given Image
.
.IP "" 0
.
.IP "\(bu" 4
instantiate \fItemplateid\fR
.
.IP "" 4
.
.nf
Creates a new VM instance from the given Template\. This VM can be
managed with the \'onevm\' command
valid options: vm_name, multiple
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
publish \fIrange|templateid_list\fR
@ -155,6 +85,35 @@ instantiated by other Users in the Template\'s group
.
.IP "" 0
.
.IP "\(bu" 4
unpublish \fIrange|templateid_list\fR
.
.IP "" 4
.
.nf
Unpublishes the given Template\. A private Template can\'t be
instantiated by any other User
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
chgrp \fIrange|templateid_list\fR \fIgroupid\fR
.
.IP "" 4
.
.nf
Changes the Template group
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
chown \fIrange|templateid_list\fR \fIuserid\fR [\fIgroupid\fR]
@ -171,14 +130,58 @@ Changes the Template owner and group
.
.IP "\(bu" 4
instantiate \fIrange|templateid_list\fR
update \fItemplateid\fR
.
.IP "" 4
.
.nf
Creates a new VM instance from the given Template\. This VM can be
managed with the \'onevm\' command
Launches the system editor to modify and update the template contents
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
list [\fIfilterflag\fR]
.
.IP "" 4
.
.nf
Lists Templates in the pool
valid options: list, delay, xml, numeric
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
show \fItemplateid\fR
.
.IP "" 4
.
.nf
Shows information for the given Template
valid options: xml
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
top [\fIfilterflag\fR]
.
.IP "" 4
.
.nf
Lists Templates continuously
valid options: list, delay, xml, numeric
.
.fi
.
@ -190,33 +193,126 @@ managed with the \'onevm\' command
.SH "ARGUMENT FORMATS"
.
.IP "\(bu" 4
userid
file
.
.IP "\(bu" 4
templateid
.IP "" 4
.
.IP "\(bu" 4
filterflag
.nf
Path to a file
.
.IP "\(bu" 4
groupid
.fi
.
.IP "" 0
.
.IP "\(bu" 4
range
.
.IP "\(bu" 4
file
.IP "" 4
.
.IP "\(bu" 4
templateid_list
.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
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 "\(bu" 4
templateid
.
.IP "" 4
.
.nf
OpenNebula VMTEMPLATE name or id
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
templateid_list
.
.IP "" 4
.
.nf
Comma\-separated list of OpenNebula VMTEMPLATE names or ids
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
filterflag
.
.IP "" 4
.
.nf
a, all all the known VMTEMPLATEs
m, mine the VMTEMPLATE belonging to the user in ONE_AUTH
g, group \'mine\' plus the VMTEMPLATE belonging to the groups
the user is member of
uid VMTEMPLATE of the user identified by this uid
user VMTEMPLATE of the user identified by the username
.
.fi
.
.IP "" 0
.
.IP "" 0
.
.SH "LICENSE"
OpenNebula 2\.9\.80 Copyright 2002\-2011, OpenNebula Project Leads (OpenNebula\.org)
OpenNebula 2\.9\.85 Copyright 2002\-2011, 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

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "ONEUSER" "1" "July 2011" "" "oneuser(1) -- manages OpenNebula users"
.TH "ONEUSER" "1" "September 2011" "" "oneuser(1) -- manages OpenNebula users"
.
.SH "NAME"
\fBoneuser\fR
@ -13,11 +13,18 @@
.
.nf
\-x, \-\-xml Show the resource in xml format
\-r, \-\-read\-file Read password from file
\-p, \-\-plain Store plain password
\-\-ssh SSH Auth system
\-\-x509 x509 Auth system for x509 certificates
\-k, \-\-key path_to_private_key_pem Path to the Private Key of the User
\-c, \-\-cert path_to_user_cert_pem Path to the Certificate of the User
\-\-x509_proxy x509 Auth system based on x509 proxy certificates
\-\-proxy path_to_user_proxy_pem Path to the user proxy certificate
\-\-time x Token duration in seconds, defaults to 3600 (1 h)
\-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
@ -28,14 +35,84 @@
.SH "COMMANDS"
.
.IP "\(bu" 4
show [\fIuserid\fR]
create \fIusername\fR [\fIpassword\fR]
.
.IP "" 4
.
.nf
Shows information for the given User
valid options: xml
Creates a new User
Examples:
oneuser create my_user my_password
oneuser create my_user /tmp/mypass \-r
oneuser create my_user \-\-ssh \-\-key /tmp/id_rsa
oneuser create my_user \-\-ssh \-r /tmp/public_key
oneuser create my_user \-\-x509 \-\-cert /tmp/my_cert\.pem
valid options: read_file, plain, ssh, x509, key, cert
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
login \fIusername\fR
.
.IP "" 4
.
.nf
Creates the Login token for authentication
Examples:
oneuser login my_user \-\-ssh \-\-key /tmp/id_rsa \-\-time 72000
oneuser login my_user \-\-x509 \-\-cert /tmp/my_cert\.pem \-\-key /tmp/my_key\.pk \-\-time 72000
oneuser login my_user \-\-x509_proxy \-\-proxy /tmp/my_cert\.pem \-\-time 72000
valid options: ssh, x509, x509_proxy, key, cert, proxy, time
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
key
.
.IP "" 4
.
.nf
Shows a public key from a private SSH key\. Use it as password
for the SSH authentication mechanism\.
valid options: key
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
delete \fIrange|userid_list\fR
.
.IP "" 4
.
.nf
Deletes the given User
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
passwd \fIuserid\fR [\fIpassword\fR]
.
.IP "" 4
.
.nf
Changes the given User\'s password
valid options: read_file, plain, ssh, x509, key, cert
.
.fi
.
@ -55,21 +132,6 @@ Changes the User\'s main group
.
.IP "" 0
.
.IP "\(bu" 4
create \fIusername\fR \fIpassword\fR
.
.IP "" 4
.
.nf
Creates a new User
valid options: read_file, plain
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
list
@ -87,27 +149,14 @@ valid options: list, delay, xml, numeric
.
.IP "\(bu" 4
delete \fIrange|userid_list\fR
show [\fIuserid\fR]
.
.IP "" 4
.
.nf
Deletes the given User
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
passwd \fIuserid\fR \fIpassword\fR
.
.IP "" 4
.
.nf
Changes the given User\'s password
Shows information for the given User
valid options: xml
.
.fi
.
@ -119,30 +168,107 @@ Changes the given User\'s password
.SH "ARGUMENT FORMATS"
.
.IP "\(bu" 4
userid
file
.
.IP "\(bu" 4
password
.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 "\(bu" 4
file
.IP "" 4
.
.nf
String
.
.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 "\(bu" 4
userid_list
.
.IP "" 4
.
.nf
Comma\-separated list of OpenNebula USER names or ids
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
password
.
.IP "" 4
.
.nf
User password
.
.fi
.
.IP "" 0
.
.IP "" 0
.
.SH "LICENSE"
OpenNebula 2\.9\.80 Copyright 2002\-2011, OpenNebula Project Leads (OpenNebula\.org)
OpenNebula 2\.9\.85 Copyright 2002\-2011, 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

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "ONEVDC" "1" "July 2011" "" "onevdc(1) -- manages OpenNebula Virtual DataCenters"
.TH "ONEVDC" "1" "September 2011" "" "onevdc(1) -- manages OpenNebula Virtual DataCenters"
.
.SH "NAME"
\fBonevdc\fR
@ -27,7 +27,21 @@
.SH "COMMANDS"
.
.IP "\(bu" 4
show \fItext\fR
create \fIfile\fR
.
.IP "" 4
.
.nf
Create a new VDC
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
show \fIvdcid\fR
.
.IP "" 4
.
@ -68,38 +82,71 @@ Deletes a VDC
.
.IP "" 0
.
.IP "" 0
.
.SH "ARGUMENT FORMATS"
.
.IP "\(bu" 4
create \fIfile\fR
file
.
.IP "" 4
.
.nf
Create a new VDC
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
vdcid
.
.IP "" 4
.
.nf
VDC ID
.
.fi
.
.IP "" 0
.
.IP "" 0
.
.SH "ARGUMENT FORMATS"
.
.IP "\(bu" 4
file
.
.IP "\(bu" 4
text
.
.IP "\(bu" 4
range
.
.IP "" 0
.
.SH "LICENSE"
OpenNebula 2\.9\.80 Copyright 2002\-2011, OpenNebula Project Leads (OpenNebula\.org)
OpenNebula 2\.9\.85 Copyright 2002\-2011, 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

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "ONEVM" "1" "July 2011" "" "onevm(1) -- manages OpenNebula virtual machines"
.TH "ONEVM" "1" "September 2011" "" "onevm(1) -- manages OpenNebula virtual machines"
.
.SH "NAME"
\fBonevm\fR
@ -13,12 +13,12 @@
.
.nf
\-m, \-\-multiple x Instance multiple VMs
\-x, \-\-xml Show the resource in xml format
\-l, \-\-list x,y,z Selects columns to display with list command
\-d, \-\-delay x Sets the delay in seconds for top command
\-n, \-\-numeric Do not translate user and group IDs
\-k, \-\-kilobytes Show units in kilobytes
\-m, \-\-multiple x Instance multiple VMs
\-l, \-\-list x,y,z Selects columns to display with list command
\-d, \-\-delay x Sets the delay in seconds for top command
\-v, \-\-verbose Verbose mode
\-h, \-\-help Show this message
\-V, \-\-version Show version and copyright information
@ -28,13 +28,16 @@
.SH "COMMANDS"
.
.IP "\(bu" 4
chgrp \fIrange|vmid_list\fR \fIgroupid\fR
create \fIfile\fR
.
.IP "" 4
.
.nf
Changes the VM group
Creates a new VM from the given template file\. This command bypasses
the Template pool, which is the preferred way to instantiate new VMs\.
See \'onetemplate create\' and \'onetemplate instantiate\'
valid options: multiple, xml, numeric, kilobytes
.
.fi
.
@ -42,15 +45,48 @@ Changes the VM group
.
.IP "\(bu" 4
restart \fIrange|vmid_list\fR
delete \fIrange|vmid_list\fR
.
.IP "" 4
.
.nf
Forces a re\-deployment of the given VM, issuing a boot action\.
Deletes the given VM
States: UNKNOWN, BOOT
States: ANY
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
hold \fIrange|vmid_list\fR
.
.IP "" 4
.
.nf
Sets the given VM on hold\. A VM on hold is not scheduled until it is
released\. It can be, however, deployed manually; see \'onevm deploy\'
States: PENDING
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
release \fIrange|vmid_list\fR
.
.IP "" 4
.
.nf
Releases a VM on hold\. See \'onevm hold\'
States: HOLD
.
.fi
.
@ -77,14 +113,33 @@ States: ANY
.
.IP "\(bu" 4
show \fIvmid\fR
shutdown \fIrange|vmid_list\fR
.
.IP "" 4
.
.nf
Shows information for the given VM
valid options: xml
Shuts down the given VM\.
States: RUNNING
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
deploy \fIrange|vmid_list\fR \fIhostid\fR
.
.IP "" 4
.
.nf
Deploys the given VM in the specified Host\. This command forces the
deployment, in a standard installation the Scheduler is in charge
of this decision
States: PENDING
.
.fi
.
@ -108,13 +163,82 @@ States: RUNNING
.
.IP "\(bu" 4
shutdown \fIrange|vmid_list\fR
migrate \fIrange|vmid_list\fR \fIhostid\fR
.
.IP "" 4
.
.nf
Shuts down the given VM\.
Saves the given running VM and starts it again in the specified Host
States: RUNNING
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
restart \fIrange|vmid_list\fR
.
.IP "" 4
.
.nf
Forces a re\-deployment of the given VM, issuing a boot action\.
States: UNKNOWN, BOOT
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
resubmit \fIrange|vmid_list\fR
.
.IP "" 4
.
.nf
Resubmits the VM to PENDING state\. This is intented for VMs stuck in a
transient state\. To re\-deploy a fresh copy of the same VM, create a
Template and instantiante it, see \'onetemplate instantiate\'
States: ANY, except SUSPENDED or DONE
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
cancel \fIrange|vmid_list\fR
.
.IP "" 4
.
.nf
Cancels the given VM\. The process is checked by OpenNebula, so
if the process fails the VM remains in running state\. If the action
succeeds the VMDIR in the remote machine is not deleted
States: RUNNING
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
stop \fIrange|vmid_list\fR
.
.IP "" 4
.
.nf
Stops a running VM\. The VM state is saved and transferred back to the
front\-end along with the disk files
States: RUNNING
.
@ -143,16 +267,15 @@ States: RUNNING
.
.IP "\(bu" 4
hold \fIrange|vmid_list\fR
resume \fIrange|vmid_list\fR
.
.IP "" 4
.
.nf
Sets the given VM on hold\. A VM on hold is not scheduled until it is
released\. It can be, however, deployed manually; see \'onevm deploy\'
Resumes the execution of the a saved VM
States: PENDING
States: STOPPED, SUSPENDED
.
.fi
.
@ -160,17 +283,27 @@ States: PENDING
.
.IP "\(bu" 4
resubmit \fIrange|vmid_list\fR
chgrp \fIrange|vmid_list\fR \fIgroupid\fR
.
.IP "" 4
.
.nf
Resubmits the VM to PENDING state\. This is intented for VMs stuck in a
transient state\. To re\-deploy a fresh copy of the same VM, create a
Template and instantiante it, see \'onetemplate instantiate\'
Changes the VM group
.
.fi
.
.IP "" 0
States: ANY, except SUSPENDED or DONE
.
.IP "\(bu" 4
chown \fIrange|vmid_list\fR \fIuserid\fR [\fIgroupid\fR]
.
.IP "" 4
.
.nf
Changes the Image owner and group
.
.fi
.
@ -193,147 +326,14 @@ valid options: list, delay, xml, numeric, kilobytes
.
.IP "\(bu" 4
stop \fIrange|vmid_list\fR
show \fIvmid\fR
.
.IP "" 4
.
.nf
Stops a running VM\. The VM state is saved and transferred back to the
front\-end along with the disk files
States: RUNNING
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
deploy \fIrange|vmid_list\fR \fIhostid\fR
.
.IP "" 4
.
.nf
Deploys the given VM in the specified Host\. This command forces the
deployment, in a standard installation the Scheduler is in charge
of this decision
States: PENDING
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
delete \fIrange|vmid_list\fR
.
.IP "" 4
.
.nf
Deletes the given VM
States: ANY
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
resume \fIrange|vmid_list\fR
.
.IP "" 4
.
.nf
Resumes the execution of the a saved VM
States: STOPPED, SUSPENDED
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
migrate \fIrange|vmid_list\fR \fIhostid\fR
.
.IP "" 4
.
.nf
Saves the given running VM and starts it again in the specified Host
States: RUNNING
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
release \fIrange|vmid_list\fR
.
.IP "" 4
.
.nf
Releases a VM on hold\. See \'onevm hold\'
States: HOLD
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
chown \fIrange|vmid_list\fR \fIuserid\fR [\fIgroupid\fR]
.
.IP "" 4
.
.nf
Changes the Image owner and group
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
cancel \fIrange|vmid_list\fR
.
.IP "" 4
.
.nf
Cancels the given VM\. The process is checked by OpenNebula, so
if the process fails the VM remains in running state\. If the action
succeeds the VMDIR in the remote machine is not deleted
States: RUNNING
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
create \fIfile\fR
.
.IP "" 4
.
.nf
Creates a new VM from the given template file\. This command bypasses
the Template pool, which is the preferred way to instantiate new VMs\.
See \'onetemplate create\' and \'onetemplate instantiate\'
valid options: multiple, xml, numeric, kilobytes
Shows information for the given VM
valid options: xml
.
.fi
.
@ -360,36 +360,140 @@ valid options: list, delay, xml, numeric, kilobytes
.SH "ARGUMENT FORMATS"
.
.IP "\(bu" 4
text
.
.IP "\(bu" 4
vmid_list
.
.IP "\(bu" 4
groupid
.
.IP "\(bu" 4
file
.
.IP "\(bu" 4
userid
.IP "" 4
.
.IP "\(bu" 4
hostid
.nf
Path to a file
.
.IP "\(bu" 4
vmid
.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
hostid
.
.IP "" 4
.
.nf
OpenNebula HOST 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 "\(bu" 4
vmid
.
.IP "" 4
.
.nf
OpenNebula VM name or id
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
vmid_list
.
.IP "" 4
.
.nf
Comma\-separated list of OpenNebula VM names or ids
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
filterflag
.
.IP "" 4
.
.nf
a, all all the known VMs
m, mine the VM belonging to the user in ONE_AUTH
g, group \'mine\' plus the VM belonging to the groups
the user is member of
uid VM of the user identified by this uid
user VM of the user identified by the username
.
.fi
.
.IP "" 0
.
.IP "" 0
.
.SH "LICENSE"
OpenNebula 2\.9\.80 Copyright 2002\-2011, OpenNebula Project Leads (OpenNebula\.org)
OpenNebula 2\.9\.85 Copyright 2002\-2011, 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

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "ONEVNET" "1" "July 2011" "" "onevnet(1) -- manages OpenNebula networks"
.TH "ONEVNET" "1" "September 2011" "" "onevnet(1) -- manages OpenNebula networks"
.
.SH "NAME"
\fBonevnet\fR
@ -13,9 +13,9 @@
.
.nf
\-x, \-\-xml Show the resource in xml format
\-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
\-k, \-\-kilobytes Show units in kilobytes
\-v, \-\-verbose Verbose mode
@ -27,13 +27,13 @@
.SH "COMMANDS"
.
.IP "\(bu" 4
rmleases \fIvnetid\fR \fIip\fR
create \fIfile\fR
.
.IP "" 4
.
.nf
Removes a lease from the Virtual Network
Creates a new Virtual Network from the given template file
.
.fi
.
@ -41,13 +41,13 @@ Removes a lease from the Virtual Network
.
.IP "\(bu" 4
chgrp \fIrange|vnid_list\fR \fIgroupid\fR
delete \fIrange|vnetid_list\fR
.
.IP "" 4
.
.nf
Changes the Virtual Network group
Deletes the given Virtual Network
.
.fi
.
@ -69,14 +69,13 @@ Adds a lease to the Virtual Network
.
.IP "\(bu" 4
show \fIvnetid\fR
rmleases \fIvnetid\fR \fIip\fR
.
.IP "" 4
.
.nf
Shows information for the given Virtual Network
valid options: xml
Removes a lease from the Virtual Network
.
.fi
.
@ -97,49 +96,6 @@ seen and used by other Users in the Virtual Network\'s group
.
.IP "" 0
.
.IP "\(bu" 4
list [\fIfilterflag\fR]
.
.IP "" 4
.
.nf
Lists Virtual Networks in the pool
valid options: list, delay, xml, numeric, kilobytes
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
delete \fIrange|vnetid_list\fR
.
.IP "" 4
.
.nf
Deletes the given Virtual Network
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
create \fIfile\fR
.
.IP "" 4
.
.nf
Creates a new Virtual Network from the given template file
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
unpublish \fIrange|vnetid_list\fR
@ -155,6 +111,20 @@ can\'t be used by any other User
.
.IP "" 0
.
.IP "\(bu" 4
chgrp \fIrange|vnid_list\fR \fIgroupid\fR
.
.IP "" 4
.
.nf
Changes the Virtual Network group
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
chown \fIrange|vnid_list\fR \fIuserid\fR [\fIgroupid\fR]
@ -169,39 +139,162 @@ Changes the Virtual Network owner and group
.
.IP "" 0
.
.IP "\(bu" 4
list [\fIfilterflag\fR]
.
.IP "" 4
.
.nf
Lists Virtual Networks in the pool
valid options: list, delay, xml, numeric, kilobytes
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
show \fIvnetid\fR
.
.IP "" 4
.
.nf
Shows information for the given Virtual Network
valid options: xml
.
.fi
.
.IP "" 0
.
.IP "" 0
.
.SH "ARGUMENT FORMATS"
.
.IP "\(bu" 4
vnetid_list
.
.IP "\(bu" 4
userid
.
.IP "\(bu" 4
file
.
.IP "\(bu" 4
vnetid
.IP "" 4
.
.IP "\(bu" 4
filterflag
.nf
Path to a file
.
.IP "\(bu" 4
groupid
.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
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 "\(bu" 4
vnetid
.
.IP "" 4
.
.nf
OpenNebula VNET name or id
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
vnetid_list
.
.IP "" 4
.
.nf
Comma\-separated list of OpenNebula VNET names or ids
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
filterflag
.
.IP "" 4
.
.nf
a, all all the known VNETs
m, mine the VNET belonging to the user in ONE_AUTH
g, group \'mine\' plus the VNET belonging to the groups
the user is member of
uid VNET of the user identified by this uid
user VNET of the user identified by the username
.
.fi
.
.IP "" 0
.
.IP "" 0
.
.SH "LICENSE"
OpenNebula 2\.9\.80 Copyright 2002\-2011, OpenNebula Project Leads (OpenNebula\.org)
OpenNebula 2\.9\.85 Copyright 2002\-2011, 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

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "ONEZONE" "1" "July 2011" "" "onezone(1) -- manages OpenNebula zones"
.TH "ONEZONE" "1" "September 2011" "" "onezone(1) -- manages OpenNebula zones"
.
.SH "NAME"
\fBonezone\fR
@ -27,13 +27,31 @@
.SH "COMMANDS"
.
.IP "\(bu" 4
show \fItext\fR [\fItext\fR]
create \fIfile\fR
.
.IP "" 4
.
.nf
Create a new Zone
.
.fi
.
.IP "" 0
.
.IP "\(bu" 4
show \fIzoneid\fR [\fIresource\fR]
.
.IP "" 4
.
.nf
Show information of a particular Zone
Available resources: host, vm, image, vn, template, user
Examples:
onezone show 4
onezone show 4 host
.
.fi
.
@ -68,38 +86,71 @@ Deletes a Zone
.
.IP "" 0
.
.IP "" 0
.
.SH "ARGUMENT FORMATS"
.
.IP "\(bu" 4
create \fIfile\fR
file
.
.IP "" 4
.
.nf
Create a new Zone
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
zoneid
.
.IP "" 4
.
.nf
Zone ID
.
.fi
.
.IP "" 0
.
.IP "" 0
.
.SH "ARGUMENT FORMATS"
.
.IP "\(bu" 4
file
.
.IP "\(bu" 4
text
.
.IP "\(bu" 4
range
.
.IP "" 0
.
.SH "LICENSE"
OpenNebula 2\.9\.80 Copyright 2002\-2011, OpenNebula Project Leads (OpenNebula\.org)
OpenNebula 2\.9\.85 Copyright 2002\-2011, 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

View File

@ -442,16 +442,12 @@ void AuthManager::notify_request(int auth_id,bool result,const string& message)
if ( message != "-" )
{
ostringstream oss;
if ( !ar->message.empty() )
{
oss << ar->message << "; ";
ar->message.append("; ");
}
oss << message;
ar->message = oss.str();
ar->message.append(message);
}
ar->notify();

View File

@ -220,14 +220,14 @@ public:
cout << endl << "ar.result: " << ar.result << endl;
}
if ( ar.message != astr )
if ( ar.message.find(astr) == ar.message.npos )
{
cout << endl << "ar.message: " << ar.message;
cout << endl << "expected: " << astr << endl;
}
//*/
CPPUNIT_ASSERT(ar.result==false);
CPPUNIT_ASSERT(ar.message==astr);
CPPUNIT_ASSERT(ar.message.find(astr) != ar.message.npos);
AuthRequest ar1(2, 2);
@ -248,14 +248,14 @@ public:
cout << endl << "ar.result: " << ar1.result << endl;
}
if ( ar1.message != astr1 )
if ( ar1.message.find(astr1) == ar1.message.npos )
{
cout << endl << "ar.message: " << ar1.message;
cout << endl << "expected: " << astr1 << endl;
}
//*/
CPPUNIT_ASSERT(ar1.result==false);
CPPUNIT_ASSERT(ar1.message==astr1);
CPPUNIT_ASSERT(ar1.message.find(astr1) != ar1.message.npos);
AuthRequest ar2(2, 2);

View File

@ -109,7 +109,7 @@ class AuthDriver < OpenNebulaDriver
ACTION[:authN],
RESULT[:failure],
request_id,
"Authentication rotocol '#{protocol}' not available")
"Authentication protocol '#{protocol}' not available")
end
#build path for the auth action

View File

@ -17,8 +17,9 @@
#--------------------------------------------------------------------------- #
# $1 = username
# $2 = password
echo $*
# $2 = "-" if user is not registered in opennebula
# $3 = password
echo $1 $3

View File

@ -1,4 +1,5 @@
# Path to the certificate used by the OpenNebula Services
# Certificates must be in PEM format
:one_cert: "/etc/one/auth/cert.pem"
:one_key: "/etc/one/auth/pk.pem"
#:one_cert: "/etc/one/auth/cert.pem"
#:one_key: "/etc/one/auth/pk.pem"

View File

@ -63,7 +63,7 @@ class ServerAuth < X509Auth
token_txt = "#{user}:#{user_pass}:#{expires}"
token = encrypt(token_txt)
token64 = Base64::encode64(token).strip.delete("\n")
token64 = Base64::encode64(token).strip.delete("\n")
login_out = "#{user}:server:#{token64}"
@ -76,7 +76,7 @@ class ServerAuth < X509Auth
# auth method for auth_mad
def authenticate(user, pass, signed_text)
begin
# Decryption demonstrates that the user posessed the private key.
# Decryption demonstrates that the user posessed the private key.
_user, user_pass, expires = decrypt(signed_text).split(':')
return "User name missmatch" if user != _user
@ -85,7 +85,7 @@ class ServerAuth < X509Auth
# Check that the signed password matches one for the user.
if !pass.split('|').include?(user_pass)
return "User password missmatch"
return "User password missmatch"
end
return true

View File

@ -1,3 +1,4 @@
# Path to the trusted CA directory. It should contain the trusted CA's for
# the server, each CA certificate shoud be name CA_hash.0
:ca_dir: "/etc/one/auth/certificates"
#:ca_dir: "/etc/one/auth/certificates"

View File

@ -81,7 +81,7 @@ class X509Auth
# Returns the dn of the user certificate
def dn
@cert_chain[0].subject.to_s
@cert_chain[0].subject.to_s.delete("\s")
end
# Generates a login token in the form:
@ -91,17 +91,17 @@ class X509Auth
def login_token(user, expire)
if expire != 0
expires = Time.now.to_i + expire.to_i
else
expires = @cert_chain[0].not_after.to_i
end
else
expires = @cert_chain[0].not_after.to_i
end
text_to_sign = "#{user}:#{expires}"
signed_text = encrypt(text_to_sign)
certs_pem = @cert_chain.collect{|cert| cert.to_pem}.join(":")
token = "#{signed_text}:#{certs_pem}"
token64 = Base64::encode64(token).strip.delete("\n")
token = "#{signed_text}:#{certs_pem}"
token64 = Base64::encode64(token).strip.delete("\n")
login_out = "#{user}:x509:#{token64}"
@ -114,23 +114,25 @@ class X509Auth
# auth method for auth_mad
def authenticate(user, pass, signed_text)
begin
# Decryption demonstrates that the user posessed the private key.
# Decryption demonstrates that the user posessed the private key.
_user, expires = decrypt(signed_text).split(':')
return "User name missmatch" if user != _user
return "x509 proxy expired" if Time.now.to_i >= expires.to_i
# Some DN in the chain must match a DN in the password
dn_ok = @cert_chain.each do |cert|
break true if pass.split('|').include?(cert.subject.to_s.delete("\s"))
# Some DN in the chain must match a DN in the password
dn_ok = @cert_chain.each do |cert|
if pass.split('|').include?(cert.subject.to_s.delete("\s"))
break true
end
end
unless dn_ok == true
return "Certificate subject missmatch"
unless dn_ok == true
return "Certificate subject missmatch"
end
validate
validate
return true
rescue => e
@ -159,9 +161,10 @@ private
# Load class options form a configuration file (yaml syntax)
def load_options(conf_file)
if File.readable?(conf_file)
config = File.read(conf_file)
@options.merge!(YAML::load(config))
conf_txt = File.read(conf_file)
conf_opt = YAML::load(conf_txt)
@options.merge!(conf_opt) if conf_opt != false
end
end
@ -184,7 +187,7 @@ private
# Validate the user certificate
###########################################################################
def validate
now = Time.now
now = Time.now
failed = "Could not validate user credentials: "
# Check start time and end time of certificates
@ -196,10 +199,10 @@ private
end
begin
# Validate the proxy certifcates
# Validate the proxy certifcates
signee = @cert_chain[0]
@cert_chain[1..-1].each do |cert|
@cert_chain[1..-1].each do |cert|
if !((signee.issuer.to_s == cert.subject.to_s) &&
(signee.verify(cert.public_key)))
raise failed + signee.subject.to_s + " with issuer " +
@ -210,7 +213,7 @@ private
end
# Validate the End Entity certificate
if !@options[:ca_dir]
if !@options[:ca_dir]
raise failed + "No certifcate authority directory was specified."
end

View File

@ -278,6 +278,8 @@ EOT
printf cmd_format10, l
puts
}
puts
}
end

View File

@ -37,8 +37,10 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
return -1, "Can not read file: #{arg}"
end
else
if options[:plain] || options[:ssh] || options[:x509]
password = arg.gsub(/\s/, '')
if options[:plain] || options[:ssh]
password = arg
elsif options[:x509]
password = arg.delete("\s")
else
password = Digest::SHA1.hexdigest(arg)
end

View File

@ -135,7 +135,7 @@ int ImagePool::disk_attribute(VectorAttribute * disk,
{
string source;
Image * img = 0;
int rc;
int rc = 0;
ostringstream oss;

View File

@ -53,19 +53,19 @@ const string templates[] =
const string xmls[] =
{
"<IMAGE><ID>0</ID><UID>0</UID><GID>1</GID><UNAME>one</UNAME><GNAME>oneadmin</GNAME><NAME>Image one</NAME><TYPE>0</TYPE><PUBLIC>0</PUBLIC><PERSISTENT>1</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><DESCRIPTION><![CDATA[This is a very long description of an image, and to achieve the longness I will copy this over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over.This is a very long description of an image, and to achieve the longness I will copy this over.]]></DESCRIPTION><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[Image one]]></NAME><PATH><![CDATA[/tmp/image_test]]></PATH></TEMPLATE></IMAGE>",
"<IMAGE><ID>0</ID><UID>0</UID><GID>1</GID><UNAME>one</UNAME><GNAME>oneadmin</GNAME><NAME>Image one</NAME><TYPE>0</TYPE><PUBLIC>0</PUBLIC><PERSISTENT>1</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><SIZE>0</SIZE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><DESCRIPTION><![CDATA[This is a very long description of an image, and to achieve the longness I will copy this over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over.This is a very long description of an image, and to achieve the longness I will copy this over.]]></DESCRIPTION><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[Image one]]></NAME><PATH><![CDATA[/tmp/image_test]]></PATH></TEMPLATE></IMAGE>",
"<IMAGE><ID>1</ID><UID>1</UID><GID>1</GID><UNAME>two</UNAME><GNAME>oneadmin</GNAME><NAME>Second Image</NAME><TYPE>0</TYPE><PUBLIC>1</PUBLIC><PERSISTENT>0</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><DESCRIPTION><![CDATA[This is a rather short description.]]></DESCRIPTION><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[Second Image]]></NAME><PATH><![CDATA[/tmp/image_second_test]]></PATH></TEMPLATE></IMAGE>",
"<IMAGE><ID>1</ID><UID>1</UID><GID>1</GID><UNAME>two</UNAME><GNAME>oneadmin</GNAME><NAME>Second Image</NAME><TYPE>0</TYPE><PUBLIC>1</PUBLIC><PERSISTENT>0</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><SIZE>0</SIZE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><DESCRIPTION><![CDATA[This is a rather short description.]]></DESCRIPTION><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[Second Image]]></NAME><PATH><![CDATA[/tmp/image_second_test]]></PATH></TEMPLATE></IMAGE>",
"<IMAGE><ID>0</ID><UID>2</UID><GID>1</GID><UNAME>three</UNAME><GNAME>users</GNAME><NAME>The third image</NAME><TYPE>0</TYPE><PUBLIC>0</PUBLIC><PERSISTENT>0</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><BUS><![CDATA[SCSI]]></BUS><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[The third image]]></NAME><PATH><![CDATA[/tmp/image_test]]></PATH><PROFILE><![CDATA[STUDENT]]></PROFILE></TEMPLATE></IMAGE>"
"<IMAGE><ID>0</ID><UID>2</UID><GID>1</GID><UNAME>three</UNAME><GNAME>users</GNAME><NAME>The third image</NAME><TYPE>0</TYPE><PUBLIC>0</PUBLIC><PERSISTENT>0</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><SIZE>0</SIZE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><BUS><![CDATA[SCSI]]></BUS><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[The third image]]></NAME><PATH><![CDATA[/tmp/image_test]]></PATH><PROFILE><![CDATA[STUDENT]]></PROFILE></TEMPLATE></IMAGE>"
};
// This xml dump result has the STIMEs modified to 0000000000
const string xml_dump =
"<IMAGE_POOL><IMAGE><ID>0</ID><UID>0</UID><GID>1</GID><UNAME>one</UNAME><GNAME>oneadmin</GNAME><NAME>Image one</NAME><TYPE>0</TYPE><PUBLIC>0</PUBLIC><PERSISTENT>1</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><DESCRIPTION><![CDATA[This is a very long description of an image, and to achieve the longness I will copy this over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over.This is a very long description of an image, and to achieve the longness I will copy this over.]]></DESCRIPTION><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[Image one]]></NAME><PATH><![CDATA[/tmp/image_test]]></PATH></TEMPLATE></IMAGE><IMAGE><ID>1</ID><UID>1</UID><GID>1</GID><UNAME>two</UNAME><GNAME>oneadmin</GNAME><NAME>Second Image</NAME><TYPE>0</TYPE><PUBLIC>1</PUBLIC><PERSISTENT>0</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><DESCRIPTION><![CDATA[This is a rather short description.]]></DESCRIPTION><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[Second Image]]></NAME><PATH><![CDATA[/tmp/image_second_test]]></PATH></TEMPLATE></IMAGE><IMAGE><ID>2</ID><UID>2</UID><GID>1</GID><UNAME>three</UNAME><GNAME>users</GNAME><NAME>The third image</NAME><TYPE>0</TYPE><PUBLIC>0</PUBLIC><PERSISTENT>0</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><BUS><![CDATA[SCSI]]></BUS><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[The third image]]></NAME><PATH><![CDATA[/tmp/image_test]]></PATH><PROFILE><![CDATA[STUDENT]]></PROFILE></TEMPLATE></IMAGE></IMAGE_POOL>";
"<IMAGE_POOL><IMAGE><ID>0</ID><UID>0</UID><GID>1</GID><UNAME>one</UNAME><GNAME>oneadmin</GNAME><NAME>Image one</NAME><TYPE>0</TYPE><PUBLIC>0</PUBLIC><PERSISTENT>1</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><SIZE>0</SIZE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><DESCRIPTION><![CDATA[This is a very long description of an image, and to achieve the longness I will copy this over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over.This is a very long description of an image, and to achieve the longness I will copy this over.]]></DESCRIPTION><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[Image one]]></NAME><PATH><![CDATA[/tmp/image_test]]></PATH></TEMPLATE></IMAGE><IMAGE><ID>1</ID><UID>1</UID><GID>1</GID><UNAME>two</UNAME><GNAME>oneadmin</GNAME><NAME>Second Image</NAME><TYPE>0</TYPE><PUBLIC>1</PUBLIC><PERSISTENT>0</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><SIZE>0</SIZE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><DESCRIPTION><![CDATA[This is a rather short description.]]></DESCRIPTION><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[Second Image]]></NAME><PATH><![CDATA[/tmp/image_second_test]]></PATH></TEMPLATE></IMAGE><IMAGE><ID>2</ID><UID>2</UID><GID>1</GID><UNAME>three</UNAME><GNAME>users</GNAME><NAME>The third image</NAME><TYPE>0</TYPE><PUBLIC>0</PUBLIC><PERSISTENT>0</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><SIZE>0</SIZE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><BUS><![CDATA[SCSI]]></BUS><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[The third image]]></NAME><PATH><![CDATA[/tmp/image_test]]></PATH><PROFILE><![CDATA[STUDENT]]></PROFILE></TEMPLATE></IMAGE></IMAGE_POOL>";
const string xml_dump_where =
"<IMAGE_POOL><IMAGE><ID>0</ID><UID>0</UID><GID>1</GID><UNAME>one</UNAME><GNAME>oneadmin</GNAME><NAME>Image one</NAME><TYPE>0</TYPE><PUBLIC>0</PUBLIC><PERSISTENT>1</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><DESCRIPTION><![CDATA[This is a very long description of an image, and to achieve the longness I will copy this over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over.This is a very long description of an image, and to achieve the longness I will copy this over.]]></DESCRIPTION><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[Image one]]></NAME><PATH><![CDATA[/tmp/image_test]]></PATH></TEMPLATE></IMAGE><IMAGE><ID>1</ID><UID>1</UID><GID>1</GID><UNAME>two</UNAME><GNAME>oneadmin</GNAME><NAME>Second Image</NAME><TYPE>0</TYPE><PUBLIC>1</PUBLIC><PERSISTENT>0</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><DESCRIPTION><![CDATA[This is a rather short description.]]></DESCRIPTION><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[Second Image]]></NAME><PATH><![CDATA[/tmp/image_second_test]]></PATH></TEMPLATE></IMAGE></IMAGE_POOL>";
"<IMAGE_POOL><IMAGE><ID>0</ID><UID>0</UID><GID>1</GID><UNAME>one</UNAME><GNAME>oneadmin</GNAME><NAME>Image one</NAME><TYPE>0</TYPE><PUBLIC>0</PUBLIC><PERSISTENT>1</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><SIZE>0</SIZE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><DESCRIPTION><![CDATA[This is a very long description of an image, and to achieve the longness I will copy this over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over.This is a very long description of an image, and to achieve the longness I will copy this over.]]></DESCRIPTION><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[Image one]]></NAME><PATH><![CDATA[/tmp/image_test]]></PATH></TEMPLATE></IMAGE><IMAGE><ID>1</ID><UID>1</UID><GID>1</GID><UNAME>two</UNAME><GNAME>oneadmin</GNAME><NAME>Second Image</NAME><TYPE>0</TYPE><PUBLIC>1</PUBLIC><PERSISTENT>0</PERSISTENT><REGTIME>0000000000</REGTIME><SOURCE>-</SOURCE><SIZE>0</SIZE><STATE>4</STATE><RUNNING_VMS>0</RUNNING_VMS><TEMPLATE><DESCRIPTION><![CDATA[This is a rather short description.]]></DESCRIPTION><DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX><NAME><![CDATA[Second Image]]></NAME><PATH><![CDATA[/tmp/image_second_test]]></PATH></TEMPLATE></IMAGE></IMAGE_POOL>";
/* ************************************************************************* */
/* ************************************************************************* */
@ -146,10 +146,7 @@ class ImagePoolTest : public PoolTest
CPPUNIT_TEST ( bus_source_assignment );
CPPUNIT_TEST ( public_attribute );
CPPUNIT_TEST ( persistence );
// Requires ImageManger, and NebulaTest
// CPPUNIT_TEST ( imagepool_disk_attribute );
CPPUNIT_TEST ( imagepool_disk_attribute );
CPPUNIT_TEST ( dump );
CPPUNIT_TEST ( dump_where );
@ -159,6 +156,7 @@ protected:
NebulaTestImage * tester;
ImagePool * ipool;
ImageManager * imagem;
void bootstrap(SqlDB* db)
{
@ -217,12 +215,23 @@ public:
neb.start();
ipool = neb.get_ipool();
imagem = neb.get_imagem();
pool = ipool;
};
void tearDown()
{
// -----------------------------------------------------------
// Stop the managers & free resources
// -----------------------------------------------------------
imagem->finalize();
pthread_join(imagem->get_thread_id(),0);
//XML Library
xmlCleanupParser();
delete_db();
delete tester;
@ -614,7 +623,7 @@ public:
// Disk using image 0
disk = new VectorAttribute("DISK");
disk->replace("IMAGE", "Image 0");
disk->replace("IMAGE_ID", "0");
((ImagePool*)imp)->disk_attribute(disk, 0, &index, &img_type,0);
@ -622,9 +631,6 @@ public:
value = disk->vector_value("TARGET");
CPPUNIT_ASSERT( value == "hda" );
value = "";
value = disk->vector_value("IMAGE_ID");
CPPUNIT_ASSERT( value == "0" );
delete disk;

View File

@ -598,12 +598,10 @@ void LifeCycleManager::epilog_failure_action(int vid)
void LifeCycleManager::cancel_success_action(int vid)
{
Nebula& nd = Nebula::instance();
TransferManager * tm = nd.get_tm();
VirtualMachine * vm;
time_t the_time = time(0);
int cpu,mem,disk;
Nebula& nd = Nebula::instance();
DispatchManager * dm = nd.get_dm();
vm = vmpool->get(vid,true);
@ -612,20 +610,27 @@ void LifeCycleManager::cancel_success_action(int vid)
return;
}
vm->set_running_etime(the_time);
vm->set_etime(the_time);
//----------------------------------------------------
// EPILOG STATE
//----------------------------------------------------
vm->set_state(VirtualMachine::EPILOG);
vmpool->update(vm);
vm->set_reason(History::CANCEL);
vm->set_epilog_stime(the_time);
vm->set_running_etime(the_time);
vmpool->update_history(vm);
vm->get_requirements(cpu,mem,disk);
hpool->del_capacity(vm->get_hid(),cpu,mem,disk);
vm->log("LCM", Log::INFO, "New VM state is EPILOG");
//----------------------------------------------------
dm->trigger(DispatchManager::DONE,vid);
tm->trigger(TransferManager::EPILOG,vid);
vm->unlock();
}

View File

@ -714,7 +714,7 @@ public:
dm->cancel(vm->get_oid());
wait_assert(vm, VirtualMachine::DONE);
wait_assert(vm, VirtualMachine::ACTIVE, VirtualMachine::EPILOG );
}
/* -------------------------------------------------------------------------- */

View File

@ -127,7 +127,11 @@ module OpenNebula
# Returns whether or not the user with id 'uid' is part of this group
def contains(uid)
return self["USERS/ID[.=#{uid}]"] != nil
# This doesn't work in ruby 1.8.5
# return self["USERS/ID[.=#{uid}]"] != nil
id_array = retrieve_elements('USERS/ID')
return id_array != nil && id_array.include?(uid.to_s)
end
# Returns an array with the numeric user ids

View File

@ -120,7 +120,7 @@ echo "XML output collected. A diff will be performed."
mkdir results/diff_files
diff <(grep -v -e "<LAST_MON_TIME>" -e "<CLUSTER>" -e "NAME>" results/xml_files/host-pool.xml) <(grep -v -e "<LAST_MON_TIME>" -e "<CLUSTER>" -e "NAME>" results/xml_files/host-pool-upgraded.xml) > results/diff_files/host-pool.diff
diff <(grep -v -e "<REGTIME>" -e "<SOURCE>" results/xml_files/image-pool.xml) <(grep -v -e "<REGTIME>" -e "<SOURCE>" results/xml_files/image-pool-upgraded.xml) > results/diff_files/image-pool.diff
diff <(grep -v -e "<REGTIME>" -e "<SOURCE>" -e "<SIZE>" results/xml_files/image-pool.xml) <(grep -v -e "<REGTIME>" -e "<SOURCE>" -e "<SIZE>" results/xml_files/image-pool-upgraded.xml) > results/diff_files/image-pool.diff
diff <(grep -v -e "<LAST_POLL>" -e "TIME>" -e "<SOURCE>" -e "<TEMPLATE_ID>" -e "<VM_DIR>" results/xml_files/vm-pool.xml) <(grep -v -e "<LAST_POLL>" -e "TIME>" -e "<SOURCE>" -e "<TEMPLATE_ID>" -e "<VM_DIR>" results/xml_files/vm-pool-upgraded.xml) > results/diff_files/vm-pool.diff
for obj in vnet acl group user; do
@ -132,7 +132,7 @@ for i in 0 1 2 3 4; do
diff <(cat results/xml_files/vnet-$i.xml) <(cat results/xml_files/vnet-$i-upgraded.xml) > results/diff_files/vnet-$i.diff
diff <(grep -v -e "<REGTIME>" -e "<SOURCE>" results/xml_files/image-$i.xml) <(grep -v -e "<REGTIME>" -e "<SOURCE>" results/xml_files/image-$i-upgraded.xml) > results/diff_files/image-$i.diff
diff <(grep -v -e "<REGTIME>" -e "<SOURCE>" -e "<SIZE>" results/xml_files/image-$i.xml) <(grep -v -e "<REGTIME>" -e "<SOURCE>" -e "<SIZE>" results/xml_files/image-$i-upgraded.xml) > results/diff_files/image-$i.diff
diff <(grep -v -e "<LAST_POLL>" -e "TIME>" -e "<SOURCE>" -e "<TEMPLATE_ID>" -e "<VM_DIR>" -e "<NET_TX>" results/xml_files/vm-$i.xml) <(grep -v -e "<LAST_POLL>" -e "TIME>" -e "<SOURCE>" -e "<TEMPLATE_ID>" -e "<VM_DIR>" -e "<NET_TX>" results/xml_files/vm-$i-upgraded.xml) > results/diff_files/vm-$i.diff

View File

@ -1,87 +0,0 @@
# -------------------------------------------------------------------------- #
# Copyright 2002-2011, 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. #
#--------------------------------------------------------------------------- #
require 'json'
module JSONUtils
def to_json
begin
JSON.pretty_generate self.to_hash
rescue Exception => e
OpenNebula::Error.new(e.message)
end
end
def parse_json(json_str, root_element)
begin
hash = JSON.parse(json_str)
rescue Exception => e
return OpenNebula::Error.new(e.message)
end
if hash.has_key?(root_element)
return hash[root_element]
else
return OpenNebula::Error.new("Error parsing JSON: Wrong resource type")
end
end
def template_to_str(attributes, indent=true)
if indent
ind_enter="\n"
ind_tab=' '
else
ind_enter=''
ind_tab=' '
end
str=attributes.collect do |key, value|
if value
str_line=""
if value.class==Array && !value.empty?
value.each do |value2|
str_line << key.to_s.upcase << "=[" << ind_enter
if value2 && value2.class==Hash
str_line << value2.collect do |key3, value3|
str = ind_tab + key3.to_s.upcase + "="
str += "\"#{value3.to_s}\"" if value3
str
end.compact.join(",\n")
end
str_line << "\n]\n"
end
elsif value.class==Hash && !value.empty?
str_line << key.to_s.upcase << "=[" << ind_enter
str_line << value.collect do |key3, value3|
str = ind_tab + key3.to_s.upcase + "="
str += "\"#{value3.to_s}\"" if value3
str
end.compact.join(",\n")
str_line << "\n]\n"
else
str_line<<key.to_s.upcase << "=" << "\"#{value.to_s}\""
end
str_line
end
end.compact.join("\n")
str
end
end

View File

@ -21,7 +21,7 @@ require 'JSONUtils'
class OzonesServer
include JSONUtils
def initialize
@ocaInt = OCAInteraction.new
end
@ -38,69 +38,69 @@ class OzonesServer
"Error: #{kind} resource not supported")
return [404, error.to_json]
end
return [200, pool.to_json]
end
# Gets an aggreageted pool for a zone or vdc
# ie All the hosts in all the Zones
# ie All the hosts in all the Zones
def get_aggregated_pool(kind, aggkind)
aggpool = case kind
when "zone" then
when "zone" then
case aggkind
when "host" then OZones::AggregatedHosts.new
when "image" then OZones::AggregatedImages.new
when "user" then OZones::AggregatedUsers.new
when "vm" then OZones::AggregatedVirtualMachines.new
when "vn" then OZones::AggregatedVirtualNetworks.new
when "template" then OZones::AggregatedTemplates.new
when "host" then OZones::AggregatedHosts.new
when "image" then OZones::AggregatedImages.new
when "user" then OZones::AggregatedUsers.new
when "vm" then OZones::AggregatedVirtualMachines.new
when "vn","vnet" then OZones::AggregatedVirtualNetworks.new
when "template","vmtemplate" then OZones::AggregatedTemplates.new
end
else
error = OZones::Error.new(
"Error: #{aggkind} aggregated pool for #{kind} not supported")
return [404, error.to_json]
end
return [200, aggpool.to_json]
end
# Gets an aggreageted pool for a zone or vdc in json
# ie All the hosts in all the Zones
# ie All the hosts in all the Zones
def get_full_resource(kind, id, aggkind)
resource = retrieve_resource(kind, id)
if OZones.is_error?(resource)
return [404, resource.to_json]
end
# TODO build the vdc retrieval
if kind == "zone"
client = OpenNebula::Client.new(
resource.onename + ":" + resource.onepass,
resource.endpoint,
false)
false)
simple_pool = case aggkind
when "host" then OpenNebulaJSON::HostPoolJSON.new(client)
when "image" then OpenNebulaJSON::ImagePoolJSON.new(client)
when "user" then OpenNebulaJSON::UserPoolJSON.new(client)
when "vm" then OpenNebulaJSON::VirtualMachinePoolJSON.new(client)
when "vn" then OpenNebulaJSON::VirtualNetworkPoolJSON.new(client)
when "template" then OpenNebulaJSON::TemplatePoolJSON.new(client)
when "host" then OpenNebulaJSON::HostPoolJSON.new(client)
when "image" then OpenNebulaJSON::ImagePoolJSON.new(client)
when "user" then OpenNebulaJSON::UserPoolJSON.new(client)
when "vm" then OpenNebulaJSON::VirtualMachinePoolJSON.new(client)
when "vn","vnet" then OpenNebulaJSON::VirtualNetworkPoolJSON.new(client)
when "template","vmtemplate" then OpenNebulaJSON::TemplatePoolJSON.new(client)
else
error = OZones::Error.new(
"Error: #{aggkind} aggregated pool for #{kind} #{id} not supported")
return [404, error.to_json]
end
simple_pool.info
return [200, simple_pool.to_json]
end
end
# Get a json representation resource with local (DB) info
# Get a json representation resource with local (DB) info
def get_resource(kind, id)
resource = retrieve_resource(kind, id)
if OZones.is_error?(resource)
@ -108,7 +108,7 @@ class OzonesServer
else
return [200, resource.to_json]
end
end
end
# Get hold of a object of a particular kind
def retrieve_resource(kind, id)
@ -119,10 +119,10 @@ class OzonesServer
return OZones::Error.new(
"Error: #{kind} resource not supported")
end
if resource
return resource
else
else
return OZones::Error.new(
"Error: Resource #{kind} with id #{id} not found")
end
@ -134,45 +134,45 @@ class OzonesServer
############################################################################
# Creates a resource of a kind, and updates the Proxy Rules
def create_resource(kind, data, body, pr)
if body.size > 0
if body.size > 0
result = parse_json(body,kind)
data = result if !OpenNebula.is_error?(result)
end
resource = case kind
when "vdc" then
when "vdc" then
vdc_data=Hash.new
data.each{|key,value|
vdc_data[key.downcase.to_sym]=value if key!="pool"
}
# Check parameters
if !vdc_data[:vdcadminname] || !vdc_data[:vdcadminpass] ||
!vdc_data[:zoneid] || !vdc_data[:name] || !vdc_data[:hosts]
!vdc_data[:zoneid] || !vdc_data[:name] || !vdc_data[:hosts]
return [400, OZones::Error.new(
"Error: Couldn't create resource #{kind}. " +
"Error: Couldn't create resource #{kind}. " +
"Not enough information on the template").to_json]
end
# Check if the referenced zone exists
# Check if the referenced zone exists
zone=OZones::Zones.get(vdc_data[:zoneid])
if !zone
error = OZones::Error.new("Error: Zone " +
error = OZones::Error.new("Error: Zone " +
"#{vdc_data[:zoneid]} not found, cannot create Vdc.")
return [404, error.to_json]
end
vdcadminname = vdc_data[:vdcadminname]
vdcadminpass = vdc_data[:vdcadminpass]
vdc_data.delete(:zoneid)
vdc_data.delete(:zoneid)
vdc_data.delete(:vdcadminpass)
vdc = OZones::Vdc.create(vdc_data)
zone.vdcs << vdc
zone.save
if zone.saved? and vdc.saved?
vdcadminpass = Digest::SHA1.hexdigest(vdcadminpass)
rc = @ocaInt.create_vdc_in_zone(zone,
@ -196,26 +196,26 @@ class OzonesServer
" Maybe duplicated name?").to_json]
end
when "zone" then
when "zone" then
zone_data=Hash.new
data.each{|key,value|
zone_data[key.downcase.to_sym]=value if key!="pool"
}
# Check parameters
if !zone_data[:onename] || !zone_data[:onepass] ||
!zone_data[:endpoint] || !zone_data[:name]
!zone_data[:endpoint] || !zone_data[:name]
return [400, OZones::Error.new(
"Error: Couldn't create resource #{kind}. " +
"Error: Couldn't create resource #{kind}. " +
"Not enough information on the template").to_json]
end
# Digest and check credentials
zone_data[:onepass] =
zone_data[:onepass] =
Digest::SHA1.hexdigest(zone_data[:onepass])
rc = @ocaInt.check_oneadmin(zone_data[:onename],
zone_data[:onepass],
rc = @ocaInt.check_oneadmin(zone_data[:onename],
zone_data[:onepass],
zone_data[:endpoint])
if OpenNebula.is_error?(rc)
@ -223,19 +223,19 @@ class OzonesServer
"Error: Couldn't create resource #{kind}. Reason: "+
rc.message).to_json]
end
# Create the zone
zone = OZones::Zones.create(zone_data)
rc = zone.save
if rc
pr.update # Rewrite proxy conf file
return [200, zone.to_json]
else
return [400, OZones::Error.new(
"Error: Couldn't create resource #{kind.upcase}." +
"Error: Couldn't create resource #{kind.upcase}." +
" Maybe duplicated name?").to_json]
end
end
else
error = OZones::Error.new(
"Error: #{kind.upcase} resource not supported")
@ -252,16 +252,16 @@ class OzonesServer
if OZones.is_error?(resource)
return [404, resource.to_json]
end
if kind == "vdc"
rc = @ocaInt.delete_vdc_in_zone(id)
if OpenNebula.is_error?(rc)
return [500, OZones::Error.new(
"Error: Couldn't delete resources from VDC with id #{id}, " +
"Error: Couldn't delete resources from VDC with id #{id}, " +
"aborting VDC deletion. Reason:" + rc.message).to_json]
end
end
if !resource.destroy
return [500, OZones::Error.new(
"Error: Couldn't delete resource #{kind} with id #{id}").to_json]

View File

@ -135,7 +135,7 @@ div#login input#login_btn:hover {
.error_message {
display: none;
position: relative;
top: 150px;
top: 80px;
font-family: Arial, Helvetica, sans-serif;
color:red;
font-size:1.6em;

View File

@ -25,11 +25,11 @@ function auth_error(req, error){
switch (status){
case 401:
$("#one_error").hide();
$("#auth_error").show();
$("#auth_error").fadeIn("slow");
break;
case 500:
$("#auth_error").hide();
$("#one_error").show();
$("#one_error").fadeIn("slow");
break;
}
}
@ -47,25 +47,18 @@ function authenticate(){
});
}
function logout(){
oZones.Auth.logout();
}
$(document).ready(function(){
$("#login_btn").click(function () {
$("#login_form").submit(function (){
authenticate();
return false;
});
$("input").keydown(function (e){
if (e.keyCode == 13) {
authenticate();
}
});
//compact login elements according to screen height
if (screen.height <= 600){
$('div#logo_sunstone').css("top","15px");
$('div#login').css("top","10px");
$('.error_message').css("top","10px");
};
$("#logout_btn").click(function () {
logout();
});
$("input#username.box").get(0).focus();
$("input#username.box").focus();
});

View File

@ -38,14 +38,7 @@ var oZones = {
"is_error": function(obj)
{
if (obj.error)
{
return true;
}
else
{
return false;
}
return obj.error ? true : false;
},
"Helper": {
@ -186,6 +179,99 @@ var oZones = {
}
},
"Action": {
"create": function(params,resource){
var callback = params.success;
var callback_error = params.error;
var data = params.data;
var request = oZones.Helper.request(resource,"create", data);
$.ajax({
url: resource.toLowerCase(),
type: "POST",
dataType: "json",
data: JSON.stringify(data),
success: function(response){
return callback ? callback(request, response) : null;
},
error: function(response){
return callback_error ?
callback_error(request, oZones.Error(response)) : null;
}
});
},
"delete": function(params,resource){
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var request = oZones.Helper.request(resource,"delete", id);
$.ajax({
url: resource.toLowerCase() + "/" + id,
type: "DELETE",
success: function(){
return callback ? callback(request) : null;
},
error: function(response){
return callback_error ?
callback_error(request, oZones.Error(response)) : null;
}
});
},
"list": function(params,resource,subresource){
var callback = params.success;
var callback_error = params.error;
var timeout = params.timeout || false;
var request = oZones.Helper.request(resource,"list");
var url = resource.toLowerCase();
url = subresource ? url + "/" + subresource : url;
$.ajax({
url: url,
type: "GET",
data: {timeout: timeout},
dataType: "json",
success: function(response){
return callback ?
callback(request, oZones.Helper.pool(resource,response)) : null;
},
error: function(response)
{
return callback_error ?
callback_error(request, oZones.Error(response)) : null;
}
});
},
//Subresource examples: "fetch_template", "log"...
"show": function(params,resource,subresource){
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var request = subresource ?
oZones.Helper.request(resource,subresource,id) :
oZones.Helper.request(resource,"show", id);
var url = resource.toLowerCase() + "/" + id;
url = subresource? url + "/" + subresource : url;
$.ajax({
url: url,
type: "GET",
dataType: "json",
success: function(response){
return callback ? callback(request, response) : null;
},
error: function(response){
return callback_error ?
callback_error(request, oZones.Error(response)) : null;
}
});
}
},
"Auth": {
"resource": "AUTH",
@ -209,19 +295,12 @@ var oZones = {
"Basic " + btoa(username + ":" + password)
)
},
success: function(response)
{
if (callback)
{
callback(request, response);
}
success: function(response){
return callback ? callback(request, response) : null;
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
error: function(response){
return callback_error ?
callback_error(request, oZones.Error(response)) : null;
}
});
},
@ -237,19 +316,12 @@ var oZones = {
$.ajax({
url: "logout",
type: "POST",
success: function(response)
{
if (callback)
{
callback(request, response);
}
success: function(response){
return callback ? callback(request, response) : null;
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
error: function(response){
return callback_error ?
callback_error(request, oZones.Error(response)) : null;
}
});
}
@ -270,19 +342,12 @@ var oZones = {
url: "config",
type: "GET",
dataType: "json",
success: function(response)
{
if (callback)
{
callback(request, response);
}
success: function(response){
return callback ? callback(request,response) : null;
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
error: function(response){
return callback_error ?
callback_error(request, oZones.Error(response)) : null;
}
});
}
@ -291,696 +356,121 @@ var oZones = {
"Zone": {
"resource": "ZONE",
"create": function(params)
{
var callback = params.success;
var callback_error = params.error;
var data = params.data;
var resource = oZones.Zone.resource;
var request = oZones.Helper.request(resource,"create", data);
$.ajax({
url: "zone",
type: "POST",
dataType: "json",
data: JSON.stringify(data),
success: function(response)
{
if (callback)
{
callback(request, response);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
"create": function(params){
oZones.Action.create(params,oZones.Zone.resource);
},
"delete" : function(params){
oZones.Action.delete(params,oZones.Zone.resource);
},
"list": function(params){
oZones.Action.list(params,oZones.Zone.resource);
},
"show": function(params){
oZones.Action.show(params,oZones.Zone.resource);
},
"delete": function(params)
{
"subresource" : function(params,subresource){
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var resource = oZones.Zone.resource;
var request = oZones.Helper.request(resource,"delete", id);
$.ajax({
url: "zone/" + id,
type: "DELETE",
success: function()
{
if (callback)
{
callback(request);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
},
"list": function(params)
{
var callback = params.success;
var callback_error = params.error;
var timeout = params.timeout || false;
var resource = oZones.Zone.resource;
var request = oZones.Helper.request(resource,"list");
var request = oZones.Helper.request(resource,subresource, id);
$.ajax({
url: "zone",
type: "GET",
data: {timeout: timeout},
dataType: "json",
success: function(response)
{
if (callback)
{
var zone_pool = oZones.Helper.pool(resource,response);
callback(request, zone_pool);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
},
"show": function(params)
{
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var resource = oZones.Zone.resource;
var request = oZones.Helper.request(resource,"show", id);
$.ajax({
url: "zone/" + id,
url: "zone/" + id + "/" + subresource,
type: "GET",
dataType: "json",
success: function(response)
{
if (callback)
{
callback(request, response);
}
success: function(response){
return callback ?
callback(request, oZones.Helper.pool(subresource.toUpperCase(),response)) : null;
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
error: function(response){
return callback_error ? calback_error(request,oZones.Error(response)) : null;
}
});
},
"host": function(params)
{
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var resource = oZones.Zone.resource;
var request = oZones.Helper.request(resource,"host", id);
$.ajax({
url: "zone/" + id + "/host",
type: "GET",
dataType: "json",
success: function(response)
{
if (callback)
{
var host_pool = oZones.Helper.pool("HOST",response);
callback(request, host_pool);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
"host": function(params){
oZones.Zone.subresource(params,"host");
},
"image": function(params){
oZones.Zone.subresource(params,"image");
},
"vmtemplate": function(params){
oZones.Zone.subresource(params,"vmtemplate");
},
"user": function(params){
oZones.Zone.subresource(params,"user");
},
"vm": function(params){
oZones.Zone.subresource(params,"vm");
},
"vnet": function(params){
oZones.Zone.subresource(params,"vnet");
},
"image": function(params)
{
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var resource = oZones.Zone.resource;
var request = oZones.Helper.request(resource,"image", id);
$.ajax({
url: "zone/" + id + "/image",
type: "GET",
dataType: "json",
success: function(response)
{
if (callback)
{
var pool = oZones.Helper.pool("IMAGE",response);
callback(request, pool);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
},
"template": function(params)
{
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var resource = oZones.Zone.resource;
var request = oZones.Helper.request(resource,"template", id);
$.ajax({
url: "zone/" + id + "/template",
type: "GET",
dataType: "json",
success: function(response)
{
if (callback)
{
var pool = oZones.Helper.pool("VMTEMPLATE",response);
callback(request, pool);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
},
"user": function(params)
{
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var resource = oZones.Zone.resource;
var request = oZones.Helper.request(resource,"user", id);
$.ajax({
url: "zone/" + id + "/user",
type: "GET",
dataType: "json",
success: function(response)
{
if (callback)
{
var pool = oZones.Helper.pool("USER",response);
callback(request, pool);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
},
"vm": function(params)
{
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var resource = oZones.Zone.resource;
var request = oZones.Helper.request(resource,"vm", id);
$.ajax({
url: "zone/" + id + "/vm",
type: "GET",
dataType: "json",
success: function(response)
{
if (callback)
{
var pool = oZones.Helper.pool("VM",response);
callback(request, pool);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
},
"vn": function(params)
{
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var resource = oZones.Zone.resource;
var request = oZones.Helper.request(resource,"vn", id);
$.ajax({
url: "zone/" + id + "/vn",
type: "GET",
dataType: "json",
success: function(response)
{
if (callback)
{
var pool = oZones.Helper.pool("VNET",response);
callback(request, pool);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
},
"group": function(params)
{
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var resource = oZones.Zone.resource;
var request = oZones.Helper.request(resource,"group", id);
$.ajax({
url: "zone/" + id + "/group",
type: "GET",
dataType: "json",
success: function(response)
{
if (callback)
{
var pool = oZones.Helper.pool("GROUP",response);
callback(request, pool);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
"group": function(params){
oZones.Zone.subresource(params,"group");
}
},
"VDC": {
"resource": "VDC",
"create": function(params)
{
var callback = params.success;
var callback_error = params.error;
var data = params.data;
var resource = oZones.VDC.resource;
var request = oZones.Helper.request(resource,"create", data);
$.ajax({
url: "vdc",
type: "POST",
dataType: "json",
data: JSON.stringify(data),
success: function(response)
{
if (callback)
{
callback(request, response);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
"create": function(params){
oZones.Action.create(params,oZones.VDC.resource);
},
"delete": function(params)
{
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var resource = oZones.VDC.resource;
var request = oZones.Helper.request(resource,"delete", id);
$.ajax({
url: "vdc/" + id,
type: "DELETE",
success: function()
{
if (callback)
{
callback(request);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
"delete": function(params){
oZones.Action.delete(params,oZones.VDC.resource);
},
"list": function(params)
{
var callback = params.success;
var callback_error = params.error;
var timeout = params.timeout || false;
var resource = oZones.VDC.resource;
var request = oZones.Helper.request(resource,"list");
$.ajax({
url: "vdc",
type: "GET",
data: {timeout: timeout},
dataType: "json",
success: function(response)
{
if (callback)
{
var vdc_pool = oZones.Helper.pool(resource,response);
callback(request, vdc_pool);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
"list": function(params){
oZones.Action.list(params,oZones.VDC.resource);
},
"show": function(params){
oZones.Action.show(params,oZones.VDC.resource);
},
"show": function(params)
{
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var resource = oZones.VDC.resource;
var request = oZones.Helper.request(resource,"show", id);
$.ajax({
url: "vdc/" + id,
type: "GET",
dataType: "json",
success: function(response)
{
if (callback)
{
callback(request, response);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
}
},
"ZoneHosts": {
"resource": "ZONE",
"list": function(params)
{
var callback = params.success;
var callback_error = params.error;
var timeout = params.timeout || false;
var resource = oZones.ZoneHosts.resource;
var request = oZones.Helper.request(resource,"list");
$.ajax({
url: "zone/host",
type: "GET",
data: {timeout: timeout},
dataType: "json",
success: function(response)
{
if (callback)
{
var zonehosts_pool = oZones.Helper.pool(resource,response);
callback(request, zonehosts_pool);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
"list": function(params){
oZones.Action.list(params,oZones.ZoneHosts.resource,"host");
}
},
"ZoneVMs": {
"resource": "ZONE",
"list": function(params)
{
var callback = params.success;
var callback_error = params.error;
var timeout = params.timeout || false;
var resource = oZones.ZoneVMs.resource;
var request = oZones.Helper.request(resource,"list");
$.ajax({
url: "zone/vm",
type: "GET",
data: {timeout: timeout},
dataType: "json",
success: function(response)
{
if (callback)
{
var zonevms_pool = oZones.Helper.pool(resource,response);
callback(request, zonevms_pool);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
"list": function(params){
oZones.Action.list(params,oZones.ZoneVMs.resource,"vm");
}
},
"ZoneVNs": {
"resource": "ZONE",
"list": function(params)
{
var callback = params.success;
var callback_error = params.error;
var timeout = params.timeout || false;
var resource = oZones.ZoneVMs.resource;
var request = oZones.Helper.request(resource,"list");
$.ajax({
url: "zone/vn",
type: "GET",
data: {timeout: timeout},
dataType: "json",
success: function(response)
{
if (callback)
{
var zonevns_pool = oZones.Helper.pool(resource,response);
callback(request, zonevns_pool);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
"list": function(params){
oZones.Action.list(params,oZones.ZoneVNs.resource,"vnet");
}
},
"ZoneImages": {
"resource": "ZONE",
"list": function(params)
{
var callback = params.success;
var callback_error = params.error;
var timeout = params.timeout || false;
var resource = oZones.ZoneImages.resource;
var request = oZones.Helper.request(resource,"list");
$.ajax({
url: "zone/image",
type: "GET",
data: {timeout: timeout},
dataType: "json",
success: function(response)
{
if (callback)
{
var zoneimages_pool = oZones.Helper.pool(resource,response);
callback(request, zoneimages_pool);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
"list": function(params){
oZones.Action.list(params,oZones.ZoneImages.resource,"image");
}
},
"ZoneUsers": {
"resource": "ZONE",
"list": function(params)
{
var callback = params.success;
var callback_error = params.error;
var timeout = params.timeout || false;
var resource = oZones.ZoneUsers.resource;
var request = oZones.Helper.request(resource,"list");
$.ajax({
url: "zone/user",
type: "GET",
data: {timeout: timeout},
dataType: "json",
success: function(response)
{
if (callback)
{
var zoneusers_pool = oZones.Helper.pool(resource,response);
callback(request, zoneusers_pool);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
"list": function(params){
oZones.Action.list(params,oZones.ZoneImages.resource,"user");
}
},
"ZoneTemplates": {
"resource": "ZONE",
"list": function(params)
{
var callback = params.success;
var callback_error = params.error;
var timeout = params.timeout || false;
var resource = oZones.ZoneTemplates.resource;
var request = oZones.Helper.request(resource,"list");
$.ajax({
url: "zone/template",
type: "GET",
data: {timeout: timeout},
dataType: "json",
success: function(response)
{
if (callback)
{
var zonetemplates_pool = oZones.Helper.pool(resource,response);
callback(request, zonetemplates_pool);
}
},
error: function(response)
{
if (callback_error)
{
callback_error(request, oZones.Error(response));
}
}
});
"list": function(params){
oZones.Action.list(params,oZones.ZoneImages.resource,"vmtemplate");
}
}
}

View File

@ -555,7 +555,8 @@ $(document).ready(function(){
"bAutoWidth":false,
"aoColumnDefs": [
{ "sWidth": "35px", "aTargets": [0,2] },
{ "sWidth": "100px", "aTargets": [1,3,4,5,10] }
{ "sWidth": "60px", "aTargets": [7,8] },
{ "sWidth": "100px", "aTargets": [1,3,4,6,10] }
]
});
@ -579,7 +580,7 @@ $(document).ready(function(){
"aoColumnDefs": [
{ "sWidth": "60px", "aTargets": [10] },
{ "sWidth": "35px", "aTargets": [0,2,8,9,11] },
{ "sWidth": "100px", "aTargets": [1,3,4,5,7] }
{ "sWidth": "100px", "aTargets": [1,3,4,6,7] }
]
});

View File

@ -139,9 +139,6 @@ var dashboard_tab_content =
<div class="panel">\
<h3>\
<a href="#images_tab">Images</a>\
<div class="new-resource">\
<a class="action_button" href="#images_tab" value="Image.create_dialog">+</a>\
</div>\
</h3>\
<div class="panel_info">\
<table class="info_table">\

View File

@ -92,7 +92,7 @@ var vdc_actions = {
type: "custom",
call: function() {
waitingNodes(dataTable_vdcs);
Sunstone.runAction("Zone.list");
Sunstone.runAction("VDC.list");
},
error: onError
},

View File

@ -133,9 +133,9 @@ var zone_actions = {
},
error: onError
},
"Zone.vn" : {
"Zone.vnet" : {
type: "single",
call: oZones.Zone.vn,
call: oZones.Zone.vnet,
callback: function(req, vn_json){
updateVNsList(req,vn_json,'#datatable_zone_vnets');
},
@ -149,9 +149,9 @@ var zone_actions = {
},
error: onError
},
"Zone.template" : {
"Zone.vmtemplate" : {
type: "single",
call: oZones.Zone.template,
call: oZones.Zone.vmtemplate,
callback: function(req,template_json){
updateTemplatesList(req,template_json,'#datatable_zone_templates');
},
@ -463,7 +463,8 @@ function updateZoneInfo(req,zone_json){
"bAutoWidth":false,
"aoColumnDefs": [
{ "sWidth": "35px", "aTargets": [0] },
{ "sWidth": "100px", "aTargets": [1,2,3,4] }
{ "sWidth": "60px", "aTargets": [5,6] },
{ "sWidth": "100px", "aTargets": [1,2,4,8] }
]
});
@ -488,7 +489,7 @@ function updateZoneInfo(req,zone_json){
"aoColumnDefs": [
{ "sWidth": "60px", "aTargets": [8] },
{ "sWidth": "35px", "aTargets": [0,6,7,9] },
{ "sWidth": "100px", "aTargets": [1,2,3,5] }
{ "sWidth": "100px", "aTargets": [1,2,4,5] }
]
});
@ -518,9 +519,9 @@ function updateZoneInfo(req,zone_json){
//Retrieve pools in the meantime
Sunstone.runAction("Zone.host",zone.id);
Sunstone.runAction("Zone.template",zone.id);
Sunstone.runAction("Zone.vmtemplate",zone.id);
Sunstone.runAction("Zone.vms",zone.id);
Sunstone.runAction("Zone.vn",zone.id);
Sunstone.runAction("Zone.vnet",zone.id);
Sunstone.runAction("Zone.image",zone.id);
Sunstone.runAction("Zone.user",zone.id);
}

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>oZones Admin Console</title>
<title>OpenNebula oZones</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<!-- Vendor Libraries -->

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>oZones Admin Console Login</title>
<title>OpenNebula oZones Login</title>
<link rel="stylesheet" type="text/css" href="css/login.css" />
<!-- Vendor Libraries -->
@ -23,6 +23,14 @@
<div id="wrapper">
<div id="logo_sunstone">
</div>
<div id="auth_error" class="error_message">
Invalid username or password
</div>
<div id="one_error" class="error_message">
OpenNebula is not running
</div>
<form id="login_form">
<div class="border" id="login">
<div class="content">
@ -33,18 +41,10 @@
<br />
<input type="checkbox" id="check_remember">
<label id="label_remember" for="check_remember">Remember me</label>
<input type="button" id="login_btn" value="" />
<input type="submit" id="login_btn" value="" />
</div>
</div>
</form>
<div id="auth_error" class="error_message">
Invalid username or password
</div>
<div id="one_error" class="error_message">
OpenNebula is not running
</div>
</div>
</body>
</html>

View File

@ -61,13 +61,16 @@ int UserChangePassword::user_action(User * user,
string new_pass = xmlrpc_c::value_string(paramList.getString(2));
user->set_password(new_pass);
int rc = user->set_password(new_pass, error_str);
pool->update(user);
if ( rc == 0 )
{
pool->update(user);
}
user->unlock();
return 0;
return rc;
}
/* ------------------------------------------------------------------------- */

View File

@ -67,14 +67,14 @@ class SunstoneServer
end
pool = case kind
when "group" then GroupPoolJSON.new(@client)
when "host" then HostPoolJSON.new(@client)
when "image" then ImagePoolJSON.new(@client, user_flag)
when "template" then TemplatePoolJSON.new(@client, user_flag)
when "vm" then VirtualMachinePoolJSON.new(@client, user_flag)
when "vnet" then VirtualNetworkPoolJSON.new(@client, user_flag)
when "user" then UserPoolJSON.new(@client)
when "acl" then AclPoolJSON.new(@client)
when "group" then GroupPoolJSON.new(@client)
when "host" then HostPoolJSON.new(@client)
when "image" then ImagePoolJSON.new(@client, user_flag)
when "vmtemplate" then TemplatePoolJSON.new(@client, user_flag)
when "vm" then VirtualMachinePoolJSON.new(@client, user_flag)
when "vnet" then VirtualNetworkPoolJSON.new(@client, user_flag)
when "user" then UserPoolJSON.new(@client)
when "acl" then AclPoolJSON.new(@client)
else
error = Error.new("Error: #{kind} resource not supported")
return [404, error.to_json]
@ -119,14 +119,14 @@ class SunstoneServer
############################################################################
def create_resource(kind, template)
resource = case kind
when "group" then GroupJSON.new(Group.build_xml, @client)
when "host" then HostJSON.new(Host.build_xml, @client)
when "image" then ImageJSON.new(Image.build_xml, @client)
when "template" then TemplateJSON.new(Template.build_xml, @client)
when "vm" then VirtualMachineJSON.new(VirtualMachine.build_xml,@client)
when "vnet" then VirtualNetworkJSON.new(VirtualNetwork.build_xml, @client)
when "user" then UserJSON.new(User.build_xml, @client)
when "acl" then AclJSON.new(Acl.build_xml, @client)
when "group" then GroupJSON.new(Group.build_xml, @client)
when "host" then HostJSON.new(Host.build_xml, @client)
when "image" then ImageJSON.new(Image.build_xml, @client)
when "vmtemplate" then TemplateJSON.new(Template.build_xml, @client)
when "vm" then VirtualMachineJSON.new(VirtualMachine.build_xml,@client)
when "vnet" then VirtualNetworkJSON.new(VirtualNetwork.build_xml, @client)
when "user" then UserJSON.new(User.build_xml, @client)
when "acl" then AclJSON.new(Acl.build_xml, @client)
else
error = Error.new("Error: #{kind} resource not supported")
return [404, error.to_json]
@ -226,7 +226,7 @@ class SunstoneServer
return [200, "Log for VM #{id} not available"]
end
return [200, log]
return [200, {:vm_log => log}.to_json]
end
end
@ -339,7 +339,7 @@ class SunstoneServer
when "group" then GroupJSON.new_with_id(id, @client)
when "host" then HostJSON.new_with_id(id, @client)
when "image" then ImageJSON.new_with_id(id, @client)
when "template" then TemplateJSON.new_with_id(id, @client)
when "vmtemplate" then TemplateJSON.new_with_id(id, @client)
when "vm" then VirtualMachineJSON.new_with_id(id, @client)
when "vnet" then VirtualNetworkJSON.new_with_id(id, @client)
when "user" then UserJSON.new_with_id(id, @client)

View File

@ -52,8 +52,7 @@ div#logo_sunstone {
top: 80px;
margin-left: auto;
margin-right: auto;
background: url(../images/opennebula-sunstone-big.png) no-repeat center ;
background: url(../images/opennebula-sunstone-big.png) no-repeat center;
vertical-align: center;
}
@ -135,7 +134,7 @@ div#login input#login_btn:hover {
.error_message {
display: none;
position: relative;
top: 150px;
top: 80px;
font-family: Arial, Helvetica, sans-serif;
color:red;
font-size:1.6em;

View File

@ -23,15 +23,15 @@ function auth_error(req, error){
var status = error.error.http_status;
switch (status){
case 401:
$("#one_error").hide();
$("#auth_error").show();
break;
case 500:
$("#auth_error").hide();
$("#one_error").show();
break;
}
case 401:
$("#one_error").hide();
$("#auth_error").fadeIn("slow");
break;
case 500:
$("#auth_error").hide();
$("#one_error").fadeIn("slow");
break;
};
}
function authenticate(){
@ -47,21 +47,18 @@ function authenticate(){
});
}
function logout(){
OpenNebula.Auth.logout();
}
$(document).ready(function(){
$("#login_btn").click(function () {
$("#login_form").submit(function (){
authenticate();
return false;
});
$("input").keydown(function (e){
if (e.keyCode == 13) {
authenticate();
}
});
//compact login elements according to screen height
if (screen.height <= 600){
$('div#logo_sunstone').css("top","15px");
$('div#login').css("top","10px");
$('.error_message').css("top","10px");
};
$("input#username.box").get(0).focus();
$("input#username.box").focus();
});

File diff suppressed because it is too large Load Diff

View File

@ -65,7 +65,7 @@ var create_acl_tmpl =
<label for="belonging_to">Group:</label>\
<select name="belonging_to" id="belonging_to"></select>\
<div class="clear"></div>\
<label style="height:11em;">Allowed operations:</label>\
<label style="height:12em;">Allowed operations:</label>\
<input type="checkbox" name="right_create" class="right_cb" value="CREATE">Create</input><br />\
<input type="checkbox" name="right_delete" class="right_cb" value="DELETE">Delete</input><br />\
<input type="checkbox" name="right_use" class="right_cb" value="USE">Use</input><br />\
@ -312,7 +312,7 @@ function setupCreateAclDialog(){
dialog.dialog({
autoOpen: false,
modal:true,
width: 600,
width: 650,
height: height
});

View File

@ -46,7 +46,7 @@ var dashboard_tab_content =
'<table id="dashboard_table">\
<tr>\
<td style="width:40%">\
<table id="information_table">\
<table id="information_table" style="width:100%">\
<tr>\
<td>\
<div class="panel">\

View File

@ -46,7 +46,7 @@ var dashboard_tab_content =
'<table id="dashboard_table">\
<tr>\
<td style="width:40%">\
<table id="information_table">\
<table id="information_table" style="width:100%;">\
<tr>\
<td>\
<div class="panel">\

View File

@ -594,6 +594,7 @@ $(document).ready(function(){
{ "bSortable": false, "aTargets": ["check"] },
{ "sWidth": "60px", "aTargets": [0,3] },
{ "sWidth": "35px", "aTargets": [1] },
{ "sWidth": "100px", "aTargets": [6] },
{ "sWidth": "200px", "aTargets": [4,5] }
]
});

View File

@ -32,7 +32,7 @@ var images_tab_content =
<th>Registration time</th>\
<th>Public</th>\
<th>Persistent</th>\
<th>State</th>\
<th>Status</th>\
<th>#VMS</th>\
</tr>\
</thead>\
@ -161,9 +161,9 @@ var $create_image_dialog;
var image_actions = {
"Image.register" : {
"Image.create" : {
type: "create",
call: OpenNebula.Image.register,
call: OpenNebula.Image.create,
callback: addImageElement,
error: onError,
notify:true
@ -710,7 +710,7 @@ function setupCreateImageDialog(){
break;
}
var obj = { "image" : img_json };
Sunstone.runAction("Image.register", obj);
Sunstone.runAction("Image.create", obj);
$create_image_dialog.dialog('close');
return false;
@ -718,7 +718,7 @@ function setupCreateImageDialog(){
$('#create_image_form_manual',dialog).submit(function(){
var template=$('#template',this).val();
Sunstone.runAction("Image.register",template);
Sunstone.runAction("Image.create",template);
$create_image_dialog.dialog('close');
return false;
});
@ -750,9 +750,10 @@ $(document).ready(function(){
"sPaginationType": "full_numbers",
"aoColumnDefs": [
{ "bSortable": false, "aTargets": ["check"] },
{ "sWidth": "60px", "aTargets": [0,3] },
{ "sWidth": "35px", "aTargets": [1] },
{ "sWidth": "100px", "aTargets": [2,3,4] }
{ "sWidth": "60px", "aTargets": [0,2,3,5,7,8,9] },
{ "sWidth": "35px", "aTargets": [1,10] },
{ "sWidth": "100px", "aTargets": [9] },
{ "sWidth": "150px", "aTargets": [6] }
]
});

View File

@ -1259,15 +1259,35 @@ function setupCreateTemplateDialog(){
//Toggles the icon when a section is folded/unfolded
var iconToggle = function(){
$('.icon_right',dialog).toggle(
function(e){
$('span',e.currentTarget).removeClass("ui-icon-plusthick");
$('span',e.currentTarget).addClass("ui-icon-minusthick");
},function(e){
$('span',e.currentTarget).removeClass("ui-icon-minusthick");
$('span',e.currentTarget).addClass("ui-icon-plusthick");
$('.icon_left',$create_template_dialog).click(function(e){
if ($('span',e.currentTarget).hasClass("ui-icon-plus")){
$('span',e.currentTarget).removeClass("ui-icon-plus");
$('span',e.currentTarget).addClass("ui-icon-minus");
} else {
$('span',e.currentTarget).removeClass("ui-icon-minus");
$('span',e.currentTarget).addClass("ui-icon-plus");
};
});
};
//Fold/unfold all sections button
var foldUnfoldToggle = function() {
$('#fold_unfold_vm_params',$create_template_dialog).toggle(
function(){
$('.vm_section fieldset',$create_template_dialog).show();
$('.icon_left span',$create_template_dialog).removeClass("ui-icon-plus");
$('.icon_left span',$create_template_dialog).addClass("ui-icon-minus");
return false;
},
function(){
$('.vm_section fieldset',$create_template_dialog).hide();
//Show capacity opts
$('.vm_section fieldset',$create_template_dialog).first().show();
$('.icon_left span',$create_template_dialog).removeClass("ui-icon-minus");
$('.icon_left span',$create_template_dialog).addClass("ui-icon-plus");
return false;
});
}
};
// Set ups the capacity section
var capacity_setup = function(){
@ -1795,18 +1815,7 @@ filled in");
vmTabChange(0,{index : 0}); //enable kvm
//Fold/unfold all sections button
$('#fold_unfold_vm_params',dialog).toggle(
function(){
$('.vm_section fieldset',$create_template_dialog).show();
return false;
},
function(){
$('.vm_section fieldset',$create_template_dialog).hide();
//Show capacity opts
$('.vm_section fieldset',$create_template_dialog).first().show();
return false;
});
foldUnfoldToggle();
//initialise all sections
capacity_setup();
@ -1969,9 +1978,10 @@ $(document).ready(function(){
"sPaginationType": "full_numbers",
"aoColumnDefs": [
{ "bSortable": false, "aTargets": ["check"] },
{ "sWidth": "60px", "aTargets": [0] },
{ "sWidth": "60px", "aTargets": [0,6] },
{ "sWidth": "35px", "aTargets": [1] },
{ "sWidth": "100px", "aTargets": [2,3,4] }
{ "sWidth": "150px", "aTargets": [5] },
{ "sWidth": "100px", "aTargets": [2,3] }
]
});

View File

@ -250,13 +250,10 @@ var vm_actions = {
},
"VM.saveas" : {
type: "custom",
call: function(obj) {
OpenNebula.VM.saveas(
{data:obj,
success: vmShow,
error: onError });
}
type: "single",
call: OpenNebula.VM.saveas,
callback: vmShow,
error:onError
},
"VM.saveas_disks" : {
@ -299,6 +296,7 @@ var vm_actions = {
callback: function(req,res) {
//after calling VM.log we process the answer
//update the tab and pop it up again
res = res['vm_log'];
var log_lines = res.split("\n");
var colored_log = '';
for (var i = 0; i < log_lines.length;i++){
@ -822,13 +820,12 @@ function setupSaveasDialog(){
}
else {
var obj = {
vm_id: id,
disk_id : disk_id,
image_name : image_name
//type: type
};
args.push(id);
Sunstone.runAction("VM.saveas",obj);
Sunstone.runAction("VM.saveas",id,obj);
}
});
if (args.length > 0){
@ -1075,9 +1072,10 @@ $(document).ready(function(){
"bAutoWidth":false,
"aoColumnDefs": [
{ "bSortable": false, "aTargets": ["check"] },
{ "sWidth": "60px", "aTargets": [0] },
{ "sWidth": "35px", "aTargets": [1,9] },
{ "sWidth": "100px", "aTargets": [2,3,4] }
{ "sWidth": "60px", "aTargets": [0,6,7] },
{ "sWidth": "35px", "aTargets": [1,10] },
{ "sWidth": "150px", "aTargets": [5,9] },
{ "sWidth": "100px", "aTargets": [2,3] }
]
});

View File

@ -30,7 +30,7 @@ var vnets_tab_content =
<th>Name</th>\
<th>Type</th>\
<th>Bridge</th>\
<th>Public?</th>\
<th>Public</th>\
<th>Total Leases</th>\
</tr>\
</thead>\

View File

@ -511,9 +511,9 @@ function escapeDoubleQuotes(string){
//of plotting comes, we can put the data in the right place.
function generateMonitoringDivs(graphs, id_prefix){
var str = "";
//42% of the width of the screen minus
//43% of the width of the screen minus
//129px (left menu size)
var width = ($(window).width()-129)*42/100;
var width = ($(window).width()-129)*40/100;
var id_suffix="";
var label="";
var id="";
@ -614,7 +614,7 @@ function setupTemplateUpdateDialog(){
//Put HTML in place
dialog.html(
'<form action="javascript:alert(\'js error!\');">\
<h3 style="margin-bottom:10px;">Update the template here:</h3>\
<h3 style="margin-bottom:10px;">Please, choose and modify the template you want to update:</h3>\
<fieldset style="border-top:none;">\
<label for="template_update_select">Select a template:</label>\
<select id="template_update_select" name="template_update_select"></select>\

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>OpenNebula Admin Console Login</title>
<title>OpenNebula Sunstone Login</title>
<link rel="stylesheet" type="text/css" href="css/login.css" />
<!-- Vendor Libraries -->
@ -24,6 +24,14 @@
<div id="wrapper">
<div id="logo_sunstone">
</div>
<div id="auth_error" class="error_message">
Invalid username or password
</div>
<div id="one_error" class="error_message">
OpenNebula is not running
</div>
<form id="login_form">
<div class="border" id="login">
<div class="content">
@ -32,20 +40,13 @@
Password
<input type="password" size="15" name="password" id="password" class="box"/>
<br />
<input type="checkbox" id="check_remember">
<input type="checkbox" id="check_remember" />
<label id="label_remember" for="check_remember">Remember me</label>
<input type="button" id="login_btn" value="" />
<input type="submit" id="login_btn" value="" />
</div>
</div>
</form>
<div id="auth_error" class="error_message">
Invalid username or password
</div>
<div id="one_error" class="error_message">
OpenNebula is not running
</div>
</div>
</body>
</html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>OpenNebula Admin Console</title>
<title>OpenNebula Sunstone: Cloud Operations Center</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<!-- Vendor Libraries -->

View File

@ -27,6 +27,8 @@
#include "Group.h"
const string User::INVALID_CHARS = " :\t\n\v\f\r";
/* ************************************************************************** */
/* User :: Database Access Functions */
/* ************************************************************************** */

View File

@ -136,7 +136,12 @@ int UserPool::allocate (
ostringstream oss;
if ( uname.empty() )
if ( !User::is_valid(password, error_str) )
{
goto error_pass;
}
if ( !User::is_valid(uname, error_str) )
{
goto error_name;
}
@ -176,8 +181,12 @@ int UserPool::allocate (
return *oid;
error_pass:
oss << "Invalid password, " << error_str << ".";
goto error_common;
error_name:
oss << "NAME cannot be empty.";
oss << "Invalid NAME, " << error_str << ".";
goto error_common;
error_duplicated:
@ -293,7 +302,12 @@ bool UserPool::authenticate(const string& session,
if ( is.good() )
{
is >> mad_name >> ws >> mad_pass;
is >> mad_name >> ws;
}
if ( !is.fail() )
{
getline(is, mad_pass);
}
if ( !is.fail() )
@ -314,7 +328,7 @@ bool UserPool::authenticate(const string& session,
oss << "Can't create user: " << error_str <<
". Driver response: " << ar.message;
ar.message = oss.str();
NebulaLog::log("AuM",Log::ERROR,oss);
}
else
{

View File

@ -27,14 +27,14 @@ using namespace std;
/* ************************************************************************* */
/* ************************************************************************* */
const string usernames[] = { "A user", "B user", "C user", "D user", "E user" };
const string passwords[] = { "A pass", "B pass", "C pass", "D pass", "E pass" };
const string usernames[] = { "A_user", "B_user", "C_user", "D_user", "E_user" };
const string passwords[] = { "A_pass", "B_pass", "C_pass", "D_pass", "E_pass" };
const string dump_result =
"<USER_POOL><USER><ID>0</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>one_user_test</NAME><PASSWORD>5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>1</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a</NAME><PASSWORD>p</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>2</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a name</NAME><PASSWORD>pass</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>3</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a_name</NAME><PASSWORD>password</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>4</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>another name</NAME><PASSWORD>secret</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>5</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>user</NAME><PASSWORD>1234</PASSWORD><ENABLED>1</ENABLED></USER></USER_POOL>";
"<USER_POOL><USER><ID>0</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>one_user_test</NAME><PASSWORD>5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>1</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a</NAME><PASSWORD>p</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>2</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a_name</NAME><PASSWORD>pass</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>3</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a_name_2</NAME><PASSWORD>password</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>4</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>another_name</NAME><PASSWORD>secret</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>5</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>user</NAME><PASSWORD>1234</PASSWORD><ENABLED>1</ENABLED></USER></USER_POOL>";
const string dump_where_result =
"<USER_POOL><USER><ID>1</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a</NAME><PASSWORD>p</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>2</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a name</NAME><PASSWORD>pass</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>3</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a_name</NAME><PASSWORD>password</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>4</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>another name</NAME><PASSWORD>secret</PASSWORD><ENABLED>1</ENABLED></USER></USER_POOL>";
"<USER_POOL><USER><ID>1</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a</NAME><PASSWORD>p</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>2</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a_name</NAME><PASSWORD>pass</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>3</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>a_name_2</NAME><PASSWORD>password</PASSWORD><ENABLED>1</ENABLED></USER><USER><ID>4</ID><GID>0</GID><GNAME>oneadmin</GNAME><NAME>another_name</NAME><PASSWORD>secret</PASSWORD><ENABLED>1</ENABLED></USER></USER_POOL>";
#include "NebulaTest.h"
@ -313,7 +313,7 @@ public:
void dump()
{
string d_names[] = {"a", "a name", "a_name", "another name", "user"};
string d_names[] = {"a", "a_name", "a_name_2", "another_name", "user"};
string d_pass[] = {"p", "pass", "password", "secret", "1234"};
int oid;
@ -340,7 +340,7 @@ public:
void dump_where()
{
string d_names[] = {"a", "a name", "a_name", "another name", "user"};
string d_names[] = {"a", "a_name", "a_name_2", "another_name", "user"};
string d_pass[] = {"p", "pass", "password", "secret", "1234"};
int oid;

View File

@ -138,17 +138,21 @@ private
interfaces=get_interface_names(vmid)
if interfaces && !interfaces.empty?
text=`#{virsh(:domifstat)} #{vmid} #{interfaces.join(' ')}`
values={}
values[:netrx]=0
values[:nettx]=0
text.each_line do |line|
columns=line.split(/\s+/)
case columns[1]
when 'rx_bytes'
values[:netrx]=columns[2]
when 'tx_bytes'
values[:nettx]=columns[2]
interfaces.each do |interface|
text=`#{virsh(:domifstat)} #{vmid} #{interface}`
text.each_line do |line|
columns=line.split(/\s+/)
case columns[1]
when 'rx_bytes'
values[:netrx]+=columns[2].to_i
when 'tx_bytes'
values[:nettx]+=columns[2].to_i
end
end
end