diff --git a/include/History.h b/include/History.h index 942f8068b6..b0253c4548 100644 --- a/include/History.h +++ b/include/History.h @@ -28,13 +28,201 @@ using namespace std; class History:public ObjectSQL, public ObjectXML { public: - enum MigrationReason + enum EndReason { - NONE, /** < Normal termination in host */ - ERROR, /** < The VM was migrated because of an error */ - STOP_RESUME,/** < The VM was migrated because of a stop/resume request*/ - USER, /** < The VM was migrated because of an explicit request */ - CANCEL /** < The VM was migrated because of an explicit cancel */ + NONE, /** < History record is not closed yet */ + ERROR, /** < History record was closed because of an error */ + USER /** < History record was closed because of a user action */ + }; + + enum VMAction + { + NONE_ACTION, + MIGRATE_ACTION, + LIVE_MIGRATE_ACTION, + SHUTDOWN_ACTION, + SHUTDOWN_HARD_ACTION, + UNDEPLOY_ACTION, + UNDEPLOY_HARD_ACTION, + HOLD_ACTION, + RELEASE_ACTION, + STOP_ACTION, + SUSPEND_ACTION, + RESUME_ACTION, + BOOT_ACTION, + DESTROY_ACTION, + DESTROY_RECREATE_ACTION, + REBOOT_ACTION, + REBOOT_HARD_ACTION, + RESCHED_ACTION, + UNRESCHED_ACTION, + POWEROFF_ACTION, + POWEROFF_HARD_ACTION + }; + + static string action_to_str(VMAction action) + { + string st; + + switch (action) + { + case MIGRATE_ACTION: + st = "migrate"; + break; + case LIVE_MIGRATE_ACTION: + st = "live-migrate"; + break; + case SHUTDOWN_ACTION: + st = "shutdown"; + break; + case SHUTDOWN_HARD_ACTION: + st = "shutdown-hard"; + break; + case UNDEPLOY_ACTION: + st = "undeploy"; + break; + case UNDEPLOY_HARD_ACTION: + st = "undeploy-hard"; + break; + case HOLD_ACTION: + st = "hold"; + break; + case RELEASE_ACTION: + st = "release"; + break; + case STOP_ACTION: + st = "stop"; + break; + case SUSPEND_ACTION: + st = "suspend"; + break; + case RESUME_ACTION: + st = "resume"; + break; + case BOOT_ACTION: + st = "boot"; + break; + case DESTROY_ACTION: + st = "destroy"; + break; + case DESTROY_RECREATE_ACTION: + st = "destroy-recreate"; + break; + case REBOOT_ACTION: + st = "reboot"; + break; + case REBOOT_HARD_ACTION: + st = "reboot-hard"; + break; + case RESCHED_ACTION: + st = "resched"; + break; + case UNRESCHED_ACTION: + st = "unresched"; + break; + case POWEROFF_ACTION: + st = "poweroff"; + break; + case POWEROFF_HARD_ACTION: + st = "poweroff-hard"; + break; + case NONE_ACTION: + st = "none"; + break; + } + + return st; + }; + + static int action_from_str(string& st, VMAction& action) + { + if (st == "migrate") + { + action = MIGRATE_ACTION; + } + else if (st == "live-migrate") + { + action = LIVE_MIGRATE_ACTION; + } + else if (st == "shutdown") + { + action = SHUTDOWN_ACTION; + } + else if (st == "shutdown-hard") + { + action = SHUTDOWN_HARD_ACTION; + } + else if (st == "undeploy") + { + action = UNDEPLOY_ACTION; + } + else if (st == "undeploy-hard") + { + action = UNDEPLOY_HARD_ACTION; + } + else if (st == "hold") + { + action = HOLD_ACTION; + } + else if (st == "release") + { + action = RELEASE_ACTION; + } + else if (st == "stop") + { + action = STOP_ACTION; + } + else if (st == "suspend") + { + action = SUSPEND_ACTION; + } + else if (st == "resume") + { + action = RESUME_ACTION; + } + else if (st == "boot") + { + action = BOOT_ACTION; + } + else if (st == "destroy") + { + action = DESTROY_ACTION; + } + else if (st == "destroy-recreate") + { + action = DESTROY_RECREATE_ACTION; + } + else if (st == "reboot") + { + action = REBOOT_ACTION; + } + else if (st == "reboot-hard") + { + action = REBOOT_HARD_ACTION; + } + else if (st == "resched") + { + action = RESCHED_ACTION; + } + else if (st == "unresched") + { + action = UNRESCHED_ACTION; + } + else if (st == "poweroff") + { + action = POWEROFF_ACTION; + } + else if (st == "poweroff-hard") + { + action = POWEROFF_HARD_ACTION; + } + else + { + action = NONE_ACTION; + return -1; + } + + return 0; }; History(int oid, int _seq = -1); @@ -109,7 +297,9 @@ private: time_t epilog_stime; time_t epilog_etime; - MigrationReason reason; + EndReason reason; + + VMAction action; string vm_info; diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index 0a51e86d05..c4d5c47672 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -98,7 +98,8 @@ public: HOTPLUG_SAVEAS_SUSPENDED = 28, SHUTDOWN_UNDEPLOY = 29, EPILOG_UNDEPLOY = 30, - PROLOG_UNDEPLOY = 31 + PROLOG_UNDEPLOY = 31, + BOOT_UNDEPLOY = 32 }; // ------------------------------------------------------------------------- @@ -497,14 +498,23 @@ public: }; /** - * Returns the reason that originated the VM migration in the previous host - * @return the migration reason to leave this host + * Returns the reason that closed the history record in the previous host + * @return the reason to close the history record in the previous host */ - const History::MigrationReason get_previous_reason() const + const History::EndReason get_previous_reason() const { return previous_history->reason; }; + /** + * Returns the action that closed the history record in the previous host + * @return the action that closed the history record in the previous host + */ + const History::VMAction get_previous_action() const + { + return previous_history->action; + }; + /** * Get host id where the VM is or is going to execute. The hasHistory() * function MUST be called before this one. @@ -630,23 +640,41 @@ public: }; /** - * Sets the reason that originated the VM migration - * @param _reason migration reason to leave this host + * Sets the reason that closed the history record + * @param _reason reason to close the history record */ - void set_reason(History::MigrationReason _reason) + void set_reason(History::EndReason _reason) { history->reason=_reason; }; /** - * Sets the reason that originated the VM migration in the previous host - * @param _reason migration reason to leave this host + * Sets the reason that closed the history record in the previous host + * @param _reason reason to close the history record in the previous host */ - void set_previous_reason(History::MigrationReason _reason) + void set_previous_reason(History::EndReason _reason) { previous_history->reason=_reason; }; + /** + * Sets the action that closed the history record + * @param action that closed the history record + */ + void set_action(History::VMAction action) + { + history->action = action; + }; + + /** + * Sets the action that closed the history record in the previous host + * @param action that closed the history record in the previous host + */ + void set_previous_action(History::VMAction action) + { + previous_history->action = action; + }; + // ------------------------------------------------------------------------ // Template // ------------------------------------------------------------------------ diff --git a/install.sh b/install.sh index ed3207a5b5..9b13e86262 100755 --- a/install.sh +++ b/install.sh @@ -1026,6 +1026,7 @@ ONEDB_MIGRATOR_FILES="src/onedb/2.0_to_2.9.80.rb \ src/onedb/3.8.2_to_3.8.3.rb \ src/onedb/3.8.3_to_3.8.4.rb \ src/onedb/3.8.4_to_3.9.80.rb \ + src/onedb/3.9.80_to_4.0.0.rb \ src/onedb/fsck.rb \ src/onedb/onedb.rb \ src/onedb/onedb_backend.rb" diff --git a/share/doc/states/states-complete.dot b/share/doc/states/states-complete.dot index e34c972deb..62835d80e2 100644 --- a/share/doc/states/states-complete.dot +++ b/share/doc/states/states-complete.dot @@ -19,14 +19,13 @@ digraph OpenNebula { "ANY \\ {suspended,poweroff,done}" [ shape="box" ]; subgraph { rank = min; user} - subgraph { rank = same; boot; boot_stopped boot_suspended; boot_unknown; boot_poweroff; unknown; color="white"} + subgraph { rank = same; boot; boot_stopped; boot_undeploy; boot_suspended; boot_unknown; boot_poweroff; unknown; color="white"} subgraph { rank = same; pending; hold; color="white"} subgraph { rank = same; prolog; prolog_resume; prolog_migrate; color="white" } // subgraph { rank = same; prolog; prolog_resume; prolog_migrate; save_migrate; color="white" } subgraph { rank = max; suspended; done; failure; - stopped; poweroff; ANY; color="white" } -// stopped; poweroff; color="white" } + stopped; undeployed; poweroff; ANY; color="white" } # create user -> pending [label="create"]; @@ -35,6 +34,9 @@ digraph OpenNebula { pending -> prolog_resume [label="deploy\n(from stopped)"]; prolog_resume -> boot_stopped [style="dashed"]; + pending -> prolog_undeploy [label="deploy\n(from undeployed)"]; + prolog_undeploy -> boot_undeploy [style="dashed"]; + pending -> prolog [label="deploy"]; prolog -> boot [style="dashed"]; boot -> running [style="dashed"]; @@ -52,7 +54,7 @@ digraph OpenNebula { cancel -> running [style="dotted"]; # poweroff - running -> shutdown_poweroff [label="poweroff"]; + running -> shutdown_poweroff [label="poweroff [--hard]"]; shutdown_poweroff -> poweroff [style="dashed"]; shutdown_poweroff -> running [style="dotted"]; @@ -79,6 +81,12 @@ digraph OpenNebula { save_stop -> running [style="dotted"]; epilog_stop -> stopped [style="dashed"]; +# undeploy + running -> shutdown_undeploy [label="undeploy [--hard]"]; + shutdown_undeploy -> epilog_undeploy [style="dashed"]; + shutdown_undeploy -> running [style="dotted"]; + epilog_undeploy -> undeployed [style="dashed"]; + # suspend running -> save_suspend [label="suspend"]; save_suspend -> suspended [style="dashed"]; @@ -88,9 +96,15 @@ digraph OpenNebula { stopped -> pending [label="resume"]; boot_stopped -> running [style="dashed"]; + undeployed -> pending [label="resume"]; + boot_undeploy -> running [style="dashed"]; + suspended -> boot_suspended [label="resume"]; boot_suspended -> running [style="dashed"]; + poweroff -> boot_poweroff [label="resume"]; + boot_poweroff -> running [style="dashed"]; + # destroy ANY -> done [label="destroy"]; @@ -101,10 +115,8 @@ digraph OpenNebula { boot -> boot [label="boot"]; boot_suspended -> boot_suspended [label="boot"]; boot_stopped -> boot_stopped [label="boot"]; - - poweroff -> boot_poweroff [label="boot"]; boot_poweroff -> boot_poweroff [label="boot"]; - boot_poweroff -> running [style="dashed"]; + boot_undeploy -> boot_undeploy [label="boot"]; unknown -> boot_unknown [label="boot"]; boot_unknown -> boot_unknown [label="boot"]; @@ -138,16 +150,19 @@ digraph OpenNebula { # failures and misc. epilog_stop -> failure [style="dotted"]; epilog -> failure [style="dotted"]; + epilog_undeploy -> failure [style="dotted"]; prolog -> failure [style="dotted"]; prolog_migrate -> failure [style="dotted"]; prolog_resume -> stopped [style="dotted"]; + prolog_undeploy -> undeployed [style="dotted"]; boot -> failure [style="dotted"]; boot_poweroff -> poweroff [style="dotted"]; boot_unknown -> unknown [style="dotted"]; boot_suspended -> suspended [style="dotted"]; boot_stopped -> epilog_stop [style="dotted"]; + boot_undeploy -> epilog_undeploy [style="dotted"]; running -> failure [style="dotted"]; unknown -> failure [style="dotted"]; diff --git a/share/doc/states/states-simple.dot b/share/doc/states/states-simple.dot index f3ac7e7e69..25ba06bf1a 100644 --- a/share/doc/states/states-simple.dot +++ b/share/doc/states/states-simple.dot @@ -19,11 +19,11 @@ digraph OpenNebula { "ANY \\ {suspended,poweroff,done}" [ shape="box" ]; subgraph { rank = min; user} -# subgraph { rank = same; pending; hold; color="white"} - subgraph { rank = same; prolog; boot; color="white" } + subgraph { rank = same; pending; hold; color="white"} +# subgraph { rank = same; prolog; boot; color="white" } subgraph { rank = same; migrate; save; shutdown; unknown; hotplug; snapshot; color="white" } - subgraph { rank = max; suspended; done; failure; stopped; poweroff; color="white" } + subgraph { rank = max; suspended; done; failure; stopped; poweroff; undeployed; color="white" } # create user -> pending [label="create"]; @@ -36,7 +36,7 @@ digraph OpenNebula { # shutdown running -> shutdown [label="shutdown"]; shutdown -> epilog [label="shutdown", style="dashed"]; - epilog -> done [style="dashed"]; + epilog -> done [label="shutdown", style="dashed"]; # poweroff running -> shutdown [label="poweroff"]; @@ -62,13 +62,20 @@ digraph OpenNebula { save -> epilog [label="stop", style="dashed"]; epilog -> stopped [label="stop", style="dashed"]; +# undeploy + running -> shutdown [label="undeploy"]; + shutdown -> epilog [label="undeploy", style="dashed"]; + epilog -> undeployed [label="undeploy", style="dashed"]; + # suspend running -> save [label="suspend"]; save -> suspended [label="suspend", style="dashed"]; # resume stopped -> pending [label="resume"]; + undeployed -> pending [label="resume"]; suspended -> boot [label="resume"]; + poweroff -> boot [label="resume"]; # delete ANY -> done [label="destroy"]; @@ -76,7 +83,6 @@ digraph OpenNebula { # restart unknown -> boot [label="boot"]; boot -> boot [label="boot"]; - poweroff -> boot [label="boot"]; # reboot running -> running [label="reboot"]; diff --git a/share/doc/xsd/acct.xsd b/share/doc/xsd/acct.xsd index f7c7d29381..a34fbebf51 100644 --- a/share/doc/xsd/acct.xsd +++ b/share/doc/xsd/acct.xsd @@ -22,6 +22,7 @@ + @@ -31,14 +32,37 @@ + + + @@ -77,6 +101,7 @@ DONE = 6 FAILED = 7 POWEROFF = 8 + UNDEPLOYED = 9 --> @@ -111,7 +136,11 @@ HOTPLUG_NIC = 25, HOTPLUG_SAVEAS = 26, HOTPLUG_SAVEAS_POWEROFF = 27, - HOTPLUG_SAVEAS_SUSPENDED = 28 + HOTPLUG_SAVEAS_SUSPENDED = 28, + SHUTDOWN_UNDEPLOY = 29, + EPILOG_UNDEPLOY = 30, + PROLOG_UNDEPLOY = 31, + BOOT_UNDEPLOY = 32 --> @@ -131,6 +160,7 @@ + diff --git a/share/doc/xsd/oned.conf b/share/doc/xsd/oned.conf new file mode 100644 index 0000000000..2e22dca0bf --- /dev/null +++ b/share/doc/xsd/oned.conf @@ -0,0 +1,516 @@ +#******************************************************************************* +# OpenNebula Configuration file +#******************************************************************************* + +#******************************************************************************* +# Daemon configuration attributes +#------------------------------------------------------------------------------- +# MANAGER_TIMER: Time in seconds the core uses to evaluate periodical functions. +# MONITORING_INTERVAL cannot have a smaller value than MANAGER_TIMER. +# +# MONITORING_INTERVAL: Time in seconds between host and VM monitorization. +# +# HOST_PER_INTERVAL: Number of hosts monitored in each interval. +# HOST_MONITORING_EXPIRATION_TIME: Time, in seconds, to expire monitoring +# information. Use 0 to disable HOST monitoring recording. +# +# VM_PER_INTERVAL: Number of VMs monitored in each interval. +# VM_MONITORING_EXPIRATION_TIME: Time, in seconds, to expire monitoring +# information. Use 0 to disable VM monitoring recording. +# +# SCRIPTS_REMOTE_DIR: Remote path to store the monitoring and VM management +# scripts. +# +# PORT: Port where oned will listen for xmlrpc calls. +# +# DB: Configuration attributes for the database backend +# backend : can be sqlite or mysql (default is sqlite) +# server : (mysql) host name or an IP address for the MySQL server +# port : (mysql) port for the connection to the server. +# If set to 0, the default port is used. +# user : (mysql) user's MySQL login ID +# passwd : (mysql) the password for user +# db_name : (mysql) the database name +# +# VNC_BASE_PORT: VNC ports for VMs can be automatically set to VNC_BASE_PORT + +# VMID +# +# LOG: Configuration for the logging system +# system: defines the logging system: +# file to log in the oned.log file +# syslog to use the syslog facilities +# debug_level: 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG +# +# VM_SUBMIT_ON_HOLD: Forces VMs to be created on hold state instead of pending. +# Values: YES or NO. +#******************************************************************************* + +LOG = [ + system = "file", + debug_level = 3 +] + +MANAGER_TIMER = 2 + +MONITORING_INTERVAL = 2 + +#HOST_PER_INTERVAL = 15 +#HOST_MONITORING_EXPIRATION_TIME = 86400 + +#VM_PER_INTERVAL = 5 +#VM_MONITORING_EXPIRATION_TIME = 86400 + +SCRIPTS_REMOTE_DIR=/var/tmp/one + +PORT = 2633 + +DB = [ backend = "sqlite" ] + +# Sample configuration for MySQL +# DB = [ backend = "mysql", +# server = "localhost", +# port = 0, +# user = "oneadmin", +# passwd = "oneadmin", +# db_name = "opennebula" ] + +VNC_BASE_PORT = 5900 + +#VM_SUBMIT_ON_HOLD = "NO" + +#******************************************************************************* +# Physical Networks configuration +#******************************************************************************* +# NETWORK_SIZE: Here you can define the default size for the virtual networks +# +# MAC_PREFIX: Default MAC prefix to be used to create the auto-generated MAC +# addresses is defined here (this can be overrided by the Virtual Network +# template) +#******************************************************************************* + +NETWORK_SIZE = 254 + +MAC_PREFIX = "02:00" + +#******************************************************************************* +# DataStore Configuration +#******************************************************************************* +# DATASTORE_LOCATION: *Default* Path for Datastores in the hosts. It IS the +# same for all the hosts in the cluster. DATASTORE_LOCATION IS ONLY FOR THE +# HOSTS AND *NOT* THE FRONT-END. It defaults to /var/lib/one/datastores (or +# $ONE_LOCATION/var/datastores in self-contained mode) +# +# You can define a different DATASTORE_LOCATION in each cluster by updating +# its properties with onecluster update. +# +# DEFAULT_IMAGE_TYPE: This can take values +# OS Image file holding an operating system +# CDROM Image file holding a CDROM +# DATABLOCK Image file holding a datablock, +# always created as an empty block +# DEFAULT_DEVICE_PREFIX: This can be set to +# hd IDE prefix +# sd SCSI +# xvd XEN Virtual Disk +# vd KVM virtual disk +#******************************************************************************* + +#DATASTORE_LOCATION = /var/lib/one/datastores + +DEFAULT_IMAGE_TYPE = "OS" +DEFAULT_DEVICE_PREFIX = "hd" + +#******************************************************************************* +# Information Driver Configuration +#******************************************************************************* +# You can add more information managers with different configurations but make +# sure it has different names. +# +# name : name for this information manager +# +# executable: path of the information driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable, usually a probe configuration file, +# can be an absolute path or relative to $ONE_LOCATION/etc (or +# /etc/one/ if OpenNebula was installed in /) +#******************************************************************************* + +#------------------------------------------------------------------------------- +# KVM Information Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +#------------------------------------------------------------------------------- +IM_MAD = [ + name = "kvm", + executable = "one_im_ssh", + arguments = "-r 0 -t 15 kvm" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# XEN Information Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +#------------------------------------------------------------------------------- +#IM_MAD = [ +# name = "xen", +# executable = "one_im_ssh", +# arguments = "xen" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# VMware Information Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +#------------------------------------------------------------------------------- +#IM_MAD = [ +# name = "vmware", +# executable = "one_im_sh", +# arguments = "-c -t 15 -r 0 vmware" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# EC2 Information Driver Manager Configuration +#------------------------------------------------------------------------------- +#IM_MAD = [ +# name = "ec2", +# executable = "one_im_ec2", +# arguments = "im_ec2/im_ec2.conf" ] +#------------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- +# Ganglia Information Driver Manager Configuration +#----------------------------------------------------------------------------- +#IM_MAD = [ +# name = "ganglia", +# executable = "one_im_sh", +# arguments = "ganglia" ] +#----------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Dummy Information Driver Manager Configuration +#------------------------------------------------------------------------------- +IM_MAD = [ name="dummy", executable="one_im_dummy"] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# Virtualization Driver Configuration +#******************************************************************************* +# You can add more virtualization managers with different configurations but +# make sure it has different names. +# +# name : name of the virtual machine manager driver +# +# executable: path of the virtualization 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 +# +# default : default values and configuration parameters for the driver, can +# be an absolute path or relative to $ONE_LOCATION/etc (or +# /etc/one/ if OpenNebula was installed in /) +# +# type : driver type, supported drivers: xen, kvm, xml +#******************************************************************************* + +#------------------------------------------------------------------------------- +# KVM Virtualization Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +# -l actions executed locally, command can be +# overridden for each action. +# Valid actions: deploy, shutdown, cancel, save, restore, migrate, poll +# An example: "-l migrate,poll=poll_ganglia,save" +#------------------------------------------------------------------------------- +VM_MAD = [ + name = "kvm", + executable = "one_vmm_exec", + arguments = "-t 15 -r 0 kvm", + default = "vmm_exec/vmm_exec_kvm.conf", + type = "kvm" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# XEN Virtualization Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +# -l actions executed locally, command can be +# overridden for each action. +# Valid actions: deploy, shutdown, cancel, save, restore, migrate, poll +# An example: "-l migrate,poll=poll_ganglia,save" +#------------------------------------------------------------------------------- + +# Driver for Xen 3.x +#VM_MAD = [ +# name = "xen", +# executable = "one_vmm_exec", +# arguments = "-t 15 -r 0 xen3", +# default = "vmm_exec/vmm_exec_xen3.conf", +# type = "xen" ] + +# Driver for Xen 4.x +#VM_MAD = [ +# name = "xen", +# executable = "one_vmm_exec", +# arguments = "-t 15 -r 0 xen4", +# default = "vmm_exec/vmm_exec_xen4.conf", +# type = "xen" ] + +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# VMware Virtualization Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +#------------------------------------------------------------------------------- +#VM_MAD = [ +# name = "vmware", +# executable = "one_vmm_sh", +# arguments = "-t 15 -r 0 vmware -s sh", +# default = "vmm_exec/vmm_exec_vmware.conf", +# type = "vmware" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# EC2 Virtualization Driver Manager Configuration +# arguments: default values for the EC2 driver, can be an absolute path or +# relative to $ONE_LOCATION/etc (or /etc/one/ if OpenNebula was +# installed in /). +#------------------------------------------------------------------------------- +#VM_MAD = [ +# name = "ec2", +# executable = "one_vmm_ec2", +# arguments = "vmm_ec2/vmm_ec2.conf", +# type = "xml" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Dummy Virtualization Driver Configuration +#------------------------------------------------------------------------------- +VM_MAD = [ name="dummy", executable="one_vmm_dummy", type="xml" ] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# Transfer Manager Driver Configuration +#******************************************************************************* +# You can add more transfer managers with different configurations but make +# sure it has different names. +# name : name for this transfer driver +# +# executable: path of the transfer driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# arguments : +# -t: number of threads, i.e. number of transfers made at the same time +# -d: list of transfer drivers separated by commas, if not defined all the +# drivers available will be enabled +#******************************************************************************* + +TM_MAD = [ + executable = "one_tm", + arguments = "-t 15 -d dummy,lvm,shared,qcow2,ssh,vmfs,iscsi,ceph" ] + +#******************************************************************************* +# Datastore Driver Configuration +#******************************************************************************* +# Drivers to manage the datastores, specialized for the storage backend +# executable: path of the transfer driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable +# -t number of threads, i.e. number of repo operations at the same time +# -d datastore mads separated by commas +#******************************************************************************* + +DATASTORE_MAD = [ + executable = "one_datastore", + arguments = "-t 15 -d fs,vmware,vmfs,iscsi,lvm,ceph" +] + +#******************************************************************************* +# Hook Manager Configuration +#******************************************************************************* +# The Driver (HM_MAD) +# ----------------------------------------------- +# +# Used to execute the Hooks: +# executable: path of the hook 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 /) +# +# Virtual Machine Hooks (VM_HOOK) +# ------------------------------- +# +# Defined by: +# name : for the hook, useful to track the hook (OPTIONAL) +# on : when the hook should be executed, +# - CREATE, when the VM is created (onevm create) +# - PROLOG, when the VM is in the prolog state +# - RUNNING, after the VM is successfully booted +# - UNKNOWN, when the VM is in the unknown state +# - SHUTDOWN, after the VM is shutdown +# - STOP, after the VM is stopped (including VM image transfers) +# - DONE, after the VM is deleted or shutdown +# - FAILED, when the VM enters the failed state +# command : path is relative to $ONE_LOCATION/var/remotes/hook +# (self-contained) or to /var/lib/one/remotes/hook (system-wide). +# That directory will be copied on the hosts under +# SCRIPTS_REMOTE_DIR. It can be an absolute path that must exist +# on the target host +# arguments : for the hook. You can access to VM information with $ +# - $ID, the ID of the virtual machine +# - $TEMPLATE, the VM template in xml and base64 encoded +# remote : values, +# - YES, The hook is executed in the host where the VM was +# allocated +# - NO, The hook is executed in the OpenNebula server (default) +# +# Host Hooks (HOST_HOOK) +# ------------------------------- +# +# Defined by: +# name : for the hook, useful to track the hook (OPTIONAL) +# on : when the hook should be executed, +# - CREATE, when the Host is created (onehost create) +# - ERROR, when the Host enters the error state +# - DISABLE, when the Host is disabled +# command : path is relative to $ONE_LOCATION/var/remotes/hook +# (self-contained) or to /var/lib/one/remotes/hook (system-wide). +# That directory will be copied on the hosts under +# SCRIPTS_REMOTE_DIR. It can be an absolute path that must exist +# on the target host. +# arguments : for the hook. You can use the following Host information: +# - $ID, the ID of the host +# - $TEMPLATE, the Host template in xml and base64 encoded +# remote : values, +# - YES, The hook is executed in the host +# - NO, The hook is executed in the OpenNebula server (default) +# +# Virtual Network (VNET_HOOK) +# User (USER_HOOK) +# Group (GROUP_HOOK) +# Image (IMAGE_HOOK) +# ------------------------------- +# +# These hooks are executed when one of the referring entities are created or +# removed. Each hook is defined by: +# name : for the hook, useful to track the hook (OPTIONAL) +# on : when the hook should be executed, +# - CREATE, when the vnet is created +# - REMOVE, when the vnet is removed +# command : path is relative to $ONE_LOCATION/var/remotes/hook +# (self-contained) or to /var/lib/one/remotes/hook (system-wide). +# That directory will be copied on the hosts under +# SCRIPTS_REMOTE_DIR. It can be an absolute path that must exist +# on the target host. +# arguments : for the hook. You can use the following Host information: +# - $ID, the ID of the host +# - $TEMPLATE, the vnet template in xml and base64 encoded +#------------------------------------------------------------------------------- +HM_MAD = [ + executable = "one_hm" ] + +#******************************************************************************* +# Fault Tolerance Hooks +#******************************************************************************* +# This hook is used to perform recovery actions when a host fails. +# Script to implement host failure tolerance +# It can be set to +# -r recreate VMs running in the host +# -d delete VMs running in the host +# Additional flags +# -f force resubmission of suspended VMs +# -p avoid resubmission if host comes +# back after n monitoring cycles +#******************************************************************************* +# +#HOST_HOOK = [ +# name = "error", +# on = "ERROR", +# command = "ft/host_error.rb", +# arguments = "$ID -r", +# remote = "no" ] +#------------------------------------------------------------------------------- +# These two hooks can be used to automatically delete or resubmit VMs that reach +# the "failed" state. This way, the administrator doesn't have to interact +# manually to release its resources or retry the deployment. +# +# +# Only one of them should be uncommented. +#------------------------------------------------------------------------------- +# +#VM_HOOK = [ +# name = "on_failure_delete", +# on = "FAILED", +# command = "/usr/bin/env onevm destroy", +# arguments = "$ID" ] +# +#VM_HOOK = [ +# name = "on_failure_recreate", +# on = "FAILED", +# command = "/usr/bin/env onevm destroy --recreate", +# arguments = "$ID" ] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# Auth Manager Configuration +#******************************************************************************* +# AUTH_MAD: The Driver 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 /) +# +# authn : list of authentication modules separated by commas, if not +# defined all the modules available will be enabled +# authz : list of authentication modules separated by commas +# +# SESSION_EXPIRATION_TIME: Time in seconds to keep an authenticated token as +# valid. During this time, the driver is not used. Use 0 to disable session +# caching +# +# ENABLE_OTHER_PERMISSIONS: Whether or not users can set the permissions for +# 'other', so publishing or sharing resources with others. Users in the oneadmin +# group will still be able to change these permissions. Values: YES or NO. +# +# DEFAULT_UMASK: Similar to Unix umask, sets the default resources permissions. +# Its format must be 3 octal digits. For example a umask of 137 will set +# the new object's permissions to 640 "um- u-- ---" +#******************************************************************************* + +AUTH_MAD = [ + executable = "one_auth_mad", + authn = "ssh,x509,ldap,server_cipher,server_x509" +] + +SESSION_EXPIRATION_TIME = 900 + +#ENABLE_OTHER_PERMISSIONS = "YES" + +DEFAULT_UMASK = 177 + +#******************************************************************************* +# Restricted Attributes Configuration +#******************************************************************************* +# The following attributes are restricted to users outside the oneadmin group +#******************************************************************************* + +VM_RESTRICTED_ATTR = "CONTEXT/FILES" +VM_RESTRICTED_ATTR = "NIC/MAC" +VM_RESTRICTED_ATTR = "NIC/VLAN_ID" + +#VM_RESTRICTED_ATTR = "RANK" +#VM_RESTRICTED_ATTR = "SCHED_RANK" +#VM_RESTRICTED_ATTR = "REQUIREMENTS" +#VM_RESTRICTED_ATTR = "SCHED_REQUIREMENTS" + +IMAGE_RESTRICTED_ATTR = "SOURCE" diff --git a/share/doc/xsd/test.sh b/share/doc/xsd/test.sh index ad1622f166..e9bedbd477 100755 --- a/share/doc/xsd/test.sh +++ b/share/doc/xsd/test.sh @@ -25,6 +25,7 @@ mkdir -p samples/vmtemplate samples/vmtemplate_pool mkdir -p samples/user samples/user_pool mkdir -p samples/vm samples/vm_pool mkdir -p samples/vnet samples/vnet_pool +mkdir -p samples/vnet samples/acct @@ -79,7 +80,25 @@ onetemplate list -x > samples/vmtemplate_pool/2.xml # VM -onetemplate instantiate 0 +onetemplate instantiate 0 -m 2 +onetemplate instantiate 1 -m 2 + +for i in `onevm list | tail -n +2 | tr -s ' ' | cut -f2 -d ' '`; do + onevm deploy $i host01 +done + +sleep 5 + +onevm migrate --live 0 0 +onevm destroy 1 +onevm poweroff 2 + +sleep 5 + +onevm suspend 0 +onevm resume 2 + +sleep 5 for i in `onevm list | tail -n +2 | tr -s ' ' | cut -f2 -d ' '`; do onevm show $i -x > samples/vm/$i.xml @@ -144,8 +163,6 @@ done onegroup list -x > samples/group_pool/0.xml - - for i in cluster datastore group host image vmtemplate user vm vnet do POOL_NAME="$i""_pool" @@ -158,4 +175,12 @@ do xmllint --noout --schema $POOL_NAME.xsd samples/$POOL_NAME/* done + +# Accounting +oneacct -x > samples/acct/0.xml + +sed -i "s%%%" samples/acct/*.xml + +xmllint --noout --schema acct.xsd samples/acct/* + exit 0 diff --git a/share/doc/xsd/test/template.1 b/share/doc/xsd/test/template.1 index 464d29f63f..e3f07e3246 100644 --- a/share/doc/xsd/test/template.1 +++ b/share/doc/xsd/test/template.1 @@ -1 +1,4 @@ -NAME = template1 \ No newline at end of file +NAME = template1 +CPU = 0.45 +VCPU = 1 +MEMORY = 512 \ No newline at end of file diff --git a/share/doc/xsd/vm.xsd b/share/doc/xsd/vm.xsd index fa5babf322..072f194288 100644 --- a/share/doc/xsd/vm.xsd +++ b/share/doc/xsd/vm.xsd @@ -39,6 +39,7 @@ DONE = 6 FAILED = 7 POWEROFF = 8 + UNDEPLOYED = 9 --> @@ -73,7 +74,11 @@ HOTPLUG_NIC = 25, HOTPLUG_SAVEAS = 26, HOTPLUG_SAVEAS_POWEROFF = 27, - HOTPLUG_SAVEAS_SUSPENDED = 28 + HOTPLUG_SAVEAS_SUSPENDED = 28, + SHUTDOWN_UNDEPLOY = 29, + EPILOG_UNDEPLOY = 30, + PROLOG_UNDEPLOY = 31, + BOOT_UNDEPLOY = 32 --> @@ -109,6 +114,7 @@ + @@ -118,13 +124,36 @@ + + + diff --git a/share/pkgs/CentOS/opennebula b/share/pkgs/CentOS/opennebula index 65f9a1147c..6727ddbbf9 100755 --- a/share/pkgs/CentOS/opennebula +++ b/share/pkgs/CentOS/opennebula @@ -63,11 +63,41 @@ stop() { return $RETVAL } +start-sched() { + echo -n $"Starting OpenNebula scheduler: " + daemon --user oneadmin $ONE_BIN start-sched + RETVAL=$? + + [ $RETVAL -eq 0 ] && success || failure + echo + [ $RETVAL -eq 0 ] && rm -f $LOCKFILE + + return $RETVAL +} + +stop-sched() { + echo -n $"Stopping OpenNebula scheduler: " + daemon --user oneadmin $ONE_BIN stop-sched + RETVAL=$? + + [ $RETVAL -eq 0 ] && success || failure + echo + [ $RETVAL -eq 0 ] && rm -f $LOCKFILE + + return $RETVAL +} + restart() { stop start } +restart-sched() { + stop-sched + sleep 1 + start-sched +} + case "$1" in start) @@ -79,6 +109,9 @@ stop) restart) restart ;; +restart-sched) + restart-sched + ;; status) status $prog RETVAL=$? diff --git a/share/pkgs/Debian/opennebula b/share/pkgs/Debian/opennebula index 2d98d6ceb8..36a34e56e1 100755 --- a/share/pkgs/Debian/opennebula +++ b/share/pkgs/Debian/opennebula @@ -47,6 +47,16 @@ do_stop() su oneadmin -s /bin/sh -c 'one stop' } +do_start_sched() +{ + su oneadmin -s /bin/sh -c 'one start-sched' +} + +do_stop_sched() +{ + su oneadmin -s /bin/sh -c 'one stop-sched' +} + case "$1" in start) [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" @@ -87,6 +97,22 @@ case "$1" in # Failed to stop log_end_msg 1 ;; + restart-sched) + log_daemon_msg "Restarting scheduler" + do_stop_sched + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; esac ;; *) diff --git a/share/pkgs/Ubuntu/opennebula b/share/pkgs/Ubuntu/opennebula index 2d98d6ceb8..36a34e56e1 100755 --- a/share/pkgs/Ubuntu/opennebula +++ b/share/pkgs/Ubuntu/opennebula @@ -47,6 +47,16 @@ do_stop() su oneadmin -s /bin/sh -c 'one stop' } +do_start_sched() +{ + su oneadmin -s /bin/sh -c 'one start-sched' +} + +do_stop_sched() +{ + su oneadmin -s /bin/sh -c 'one stop-sched' +} + case "$1" in start) [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" @@ -87,6 +97,22 @@ case "$1" in # Failed to stop log_end_msg 1 ;; + restart-sched) + log_daemon_msg "Restarting scheduler" + do_stop_sched + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; esac ;; *) diff --git a/share/scripts/context-packages/base_deb/etc/one-context.d/00-network b/share/scripts/context-packages/base_deb/etc/one-context.d/00-network index 0a5fbd2f5e..92ff47eab3 100755 --- a/share/scripts/context-packages/base_deb/etc/one-context.d/00-network +++ b/share/scripts/context-packages/base_deb/etc/one-context.d/00-network @@ -103,7 +103,6 @@ upcase() { gen_iface_conf() { cat < /etc/sysconfig/network-scripts/ifcfg-${DEV} + IPV6=$(get_iface_var "IPV6") + GATEWAY6=$(get_iface_var "GATEWAY6") + CONTEXT_FORCE_IPV4=$(get_iface_var "CONTEXT_FORCE_IPV4") + + ( + cat < /etc/sysconfig/network-scripts/ifcfg-${DEV} done } diff --git a/share/scripts/context-packages/base_rpm/etc/one-context.d/03-selinux-ssh b/share/scripts/context-packages/base_rpm/etc/one-context.d/03-selinux-ssh new file mode 100755 index 0000000000..164d1c10e0 --- /dev/null +++ b/share/scripts/context-packages/base_rpm/etc/one-context.d/03-selinux-ssh @@ -0,0 +1 @@ +restorecon -R -v /root/.ssh diff --git a/share/scripts/context-packages/generate.sh b/share/scripts/context-packages/generate.sh index 3033859003..4111894bf4 100755 --- a/share/scripts/context-packages/generate.sh +++ b/share/scripts/context-packages/generate.sh @@ -16,7 +16,7 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -VERSION=${VERSION:-3.8.1} +VERSION=${VERSION:-3.9.80} MAINTAINER=${MAINTAINER:-C12G Labs } LICENSE=${LICENSE:-Apache 2.0} PACKAGE_NAME=${PACKAGE_NAME:-one-context} diff --git a/share/scripts/one b/share/scripts/one index 503cec61c6..9625b64a84 100755 --- a/share/scripts/one +++ b/share/scripts/one @@ -74,6 +74,13 @@ setup() # Function that stops the daemons #------------------------------------------------------------------------------ stop() +{ + stop_oned + + stop_sched +} + +stop_oned() { if [ -f $ONE_PID ]; then PID=$(cat $ONE_PID) @@ -91,7 +98,10 @@ stop() rm -f $ONE_PID > /dev/null 2>&1 fi +} +stop_sched() +{ if [ -f $ONE_SCHEDPID ]; then kill `cat $ONE_SCHEDPID` > /dev/null 2>&1 rm -f $ONE_SCHEDPID > /dev/null 2>&1 @@ -130,30 +140,10 @@ start() fi # Start the one daemon - $ONED -f 2>&1 & - - LASTRC=$? - LASTPID=$! - - if [ $LASTRC -ne 0 ]; then - echo "Error executing $ONED" - exit 1 - else - echo $LASTPID > $ONE_PID - fi + start_oned # Start the scheduler - $ONE_SCHEDULER& - - LASTRC=$? - LASTPID=$! - - if [ $LASTRC -ne 0 ]; then - echo "Error executing $ONE_SCHEDULER" - exit 1 - else - echo $LASTPID > $ONE_SCHEDPID - fi + start_sched # Wait for the daemons to warm up sleep 2 @@ -180,6 +170,36 @@ start() fi } +start_oned() +{ + $ONED -f 2>&1 & + + LASTRC=$? + LASTPID=$! + + if [ $LASTRC -ne 0 ]; then + echo "Error executing $ONED" + exit 1 + else + echo $LASTPID > $ONE_PID + fi +} + +start_sched() +{ + $ONE_SCHEDULER& + + LASTRC=$? + LASTPID=$! + + if [ $LASTRC -ne 0 ]; then + echo "Error executing $ONE_SCHEDULER" + exit 1 + else + echo $LASTPID > $ONE_SCHEDPID + fi +} + #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -197,6 +217,17 @@ case "$1" in stop echo "oned and scheduler stopped" ;; + start-sched) + start_sched + ;; + stop-sched) + stop_sched + ;; + restart-sched) + stop_sched + sleep 1 + start_sched + ;; *) echo "Usage: one [-f] {start|stop}" >&2 echo "Options:" >&2 diff --git a/src/cli/etc/oneacct.yaml b/src/cli/etc/oneacct.yaml index 0e79bf3db1..d7e487aa83 100644 --- a/src/cli/etc/oneacct.yaml +++ b/src/cli/etc/oneacct.yaml @@ -12,6 +12,11 @@ :size: 15 :left: true +:ACTION: + :desc: VM state change action + :size: 16 + :left: true + :REASON: :desc: VM state change reason :size: 4 diff --git a/src/cli/one_helper.rb b/src/cli/one_helper.rb index 1ce49a1c73..829cb63207 100644 --- a/src/cli/one_helper.rb +++ b/src/cli/one_helper.rb @@ -608,6 +608,18 @@ EOT end end + def OpenNebulaHelper.short_period_to_str(time, print_seconds=true) + seconds=time.to_i + minutes, seconds=seconds.divmod(60) + hours, minutes=minutes.divmod(60) + + if print_seconds + "%3dh%02dm%02ds" % [hours, minutes, seconds] + else + "%3dh%02dm" % [hours, minutes] + end + end + BinarySufix = ["K", "M", "G", "T" ] def OpenNebulaHelper.unit_to_str(value, options, unit="K") @@ -745,6 +757,9 @@ EOT lines<<"ETH#{index}_MASK = \"$NETWORK[NETWORK_MASK, NETWORK=\\\"#{name}\\\"]\"" lines<<"ETH#{index}_GATEWAY = \"$NETWORK[GATEWAY, NETWORK=\\\"#{name}\\\"]\"" lines<<"ETH#{index}_DNS = \"$NETWORK[DNS, NETWORK=\\\"#{name}\\\"]\"" + lines<<"ETH#{index}_IPV6 = \"$NIC[IP6_GLOBAL, NETWORK=\\\"#{name}\\\"]\"" + lines<<"ETH#{index}_GATEWAY6 = \"$NETWORK[GATEWAY6, NETWORK=\\\"#{name}\\\"]\"" + lines<<"ETH#{index}_CONTEXT_FORCE_IPV4 = \"$NETWORK[CONTEXT_FORCE_IPV4, NETWORK=\\\"#{name}\\\"]\"" end end diff --git a/src/cli/one_helper/oneacct_helper.rb b/src/cli/one_helper/oneacct_helper.rb index 385c1f7921..f5c78b99a6 100644 --- a/src/cli/one_helper/oneacct_helper.rb +++ b/src/cli/one_helper/oneacct_helper.rb @@ -112,6 +112,10 @@ class AcctHelper < OpenNebulaHelper::OneHelper d["HOSTNAME"] end + column :"ACTION", "VM state change action", :left, :size=>16 do |d| + VirtualMachine.get_history_action d["ACTION"] + end + column :REASON, "VM state change reason", :left, :size=>4 do |d| VirtualMachine.get_reason d["REASON"] end @@ -142,7 +146,7 @@ class AcctHelper < OpenNebulaHelper::OneHelper OpenNebulaHelper.unit_to_str(d["VM"]["NET_TX"].to_i / 1024.0, {}) end - default :VID, :HOSTNAME, :REASON, :START_TIME, :END_TIME, :MEMORY, :CPU, :NET_RX, :NET_TX + default :VID, :HOSTNAME, :ACTION, :REASON, :START_TIME, :END_TIME, :MEMORY, :CPU, :NET_RX, :NET_TX end def self.print_start_end_time_header(start_time, end_time) diff --git a/src/cli/one_helper/onevm_helper.rb b/src/cli/one_helper/onevm_helper.rb index db06cedb50..ce5dde0b61 100644 --- a/src/cli/one_helper/onevm_helper.rb +++ b/src/cli/one_helper/onevm_helper.rb @@ -247,7 +247,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper puts str % ["RESCHED", OpenNebulaHelper.boolean_to_str(vm['RESCHED'])] puts str % ["HOST", vm['/VM/HISTORY_RECORDS/HISTORY[last()]/HOSTNAME']] if - %w{ACTIVE SUSPENDED}.include? vm.state_str + %w{ACTIVE SUSPENDED POWEROFF}.include? vm.state_str puts str % ["START TIME", OpenNebulaHelper.time_to_str(vm['/VM/STIME'])] puts str % ["END TIME", @@ -531,15 +531,19 @@ class OneVMHelper < OpenNebulaHelper::OneHelper def format_history(vm) table=CLIHelper::ShowTable.new(nil, self) do - column :SEQ, "Sequence number", :size=>4 do |d| + column :SEQ, "Sequence number", :size=>3 do |d| d["SEQ"] end - column :HOST, "Host name of the VM container", :left, :size=>20 do |d| + column :HOST, "Host name of the VM container", :left, :size=>15 do |d| d["HOSTNAME"] end - column :REASON, "VM state change reason", :left, :size=>6 do |d| + column :"ACTION", "VM state change action", :left, :size=>16 do |d| + VirtualMachine.get_history_action d["ACTION"] + end + + column :REASON, "VM state change reason", :left, :size=>4 do |d| VirtualMachine.get_reason d["REASON"] end @@ -547,14 +551,14 @@ class OneVMHelper < OpenNebulaHelper::OneHelper OpenNebulaHelper.time_to_str(d['STIME']) end - column :TIME, "Total time in this state", :size=>15 do |d| + column :TIME, "Total time in this state", :size=>11 do |d| stime = d["STIME"].to_i etime = d["ETIME"]=="0" ? Time.now.to_i : d["ETIME"].to_i dtime = etime-stime - OpenNebulaHelper.period_to_str(dtime) + OpenNebulaHelper.period_to_str(dtime, false) end - column :PROLOG_TIME, "Prolog time for this state", :size=>15 do |d| + column :PROLOG, "Prolog time for this state", :size=>10 do |d| stime = d["PSTIME"].to_i if d["PSTIME"]=="0" etime=0 @@ -562,10 +566,10 @@ class OneVMHelper < OpenNebulaHelper::OneHelper etime = d["PETIME"]=="0" ? Time.now.to_i: d["PETIME"].to_i end dtime = etime-stime - OpenNebulaHelper.period_to_str(dtime) + OpenNebulaHelper.short_period_to_str(dtime) end - default :SEQ, :HOST, :REASON, :START, :TIME, :PROLOG_TIME + default :SEQ, :HOST, :ACTION, :REASON, :START, :TIME, :PROLOG end vm_hash=vm.to_hash diff --git a/src/cli/onevm b/src/cli/onevm index eb3f0ad6d4..02de1522fb 100755 --- a/src/cli/onevm +++ b/src/cli/onevm @@ -344,7 +344,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do poweroff_desc = <<-EOT.unindent Powers off the given VM. The VM will remain in the poweroff state, and - can be powered on with the 'onevm boot' command. + can be powered on with the 'onevm resume' command. States: RUNNING EOT @@ -432,7 +432,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do boot_desc = <<-EOT.unindent Boots the given VM. - States: UNKNOWN, BOOT, POWEROFF + States: UNKNOWN, BOOT EOT command :boot, boot_desc, [:range,:vmid_list], @@ -487,7 +487,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do resume_desc = <<-EOT.unindent Resumes the execution of the a saved VM - States: STOPPED, SUSPENDED + States: STOPPED, SUSPENDED, UNDEPLOYED, POWEROFF EOT command :resume, resume_desc, [:range,:vmid_list], diff --git a/src/dm/DispatchManagerActions.cc b/src/dm/DispatchManagerActions.cc index 35e2d2a11d..8187b57906 100644 --- a/src/dm/DispatchManagerActions.cc +++ b/src/dm/DispatchManagerActions.cc @@ -572,12 +572,19 @@ int DispatchManager::resume( Nebula& nd = Nebula::instance(); LifeCycleManager * lcm = nd.get_lcm(); - vmpool->update(vm); - vm->log("DiM", Log::INFO, "New VM state is ACTIVE."); lcm->trigger(LifeCycleManager::RESTORE,vid); } + else if (vm->get_state() == VirtualMachine::POWEROFF) + { + Nebula& nd = Nebula::instance(); + LifeCycleManager * lcm = nd.get_lcm(); + + vm->log("DiM", Log::INFO, "New VM state is ACTIVE."); + + lcm->trigger(LifeCycleManager::RESTART,vid); + } else { goto error; @@ -614,14 +621,14 @@ int DispatchManager::restart(int vid) oss << "Restarting VM " << vid; NebulaLog::log("DiM",Log::DEBUG,oss); - if ((vm->get_state() == VirtualMachine::ACTIVE && + if (vm->get_state() == VirtualMachine::ACTIVE && (vm->get_lcm_state() == VirtualMachine::UNKNOWN || vm->get_lcm_state() == VirtualMachine::BOOT || vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN || vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF || vm->get_lcm_state() == VirtualMachine::BOOT_SUSPENDED || - vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED)) - || vm->get_state() == VirtualMachine::POWEROFF ) + vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED || + vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY)) { Nebula& nd = Nebula::instance(); LifeCycleManager * lcm = nd.get_lcm(); @@ -914,7 +921,7 @@ int DispatchManager::resubmit(int vid) { case VirtualMachine::POWEROFF: NebulaLog::log("DiM",Log::ERROR, - "Cannot resubmit a powered off VM. Restart it first"); + "Cannot resubmit a powered off VM. Resume it first"); rc = -2; break; diff --git a/src/lcm/LifeCycleActions.cc b/src/lcm/LifeCycleActions.cc index a247ecec55..cba4ff7dab 100644 --- a/src/lcm/LifeCycleActions.cc +++ b/src/lcm/LifeCycleActions.cc @@ -48,12 +48,13 @@ void LifeCycleManager::deploy_action(int vid) if (vm->hasPreviousHistory()) { - if (vm->get_previous_reason() == History::STOP_RESUME) + if (vm->get_previous_action() == History::STOP_ACTION) { vm_state = VirtualMachine::PROLOG_RESUME; tm_action = TransferManager::PROLOG_RESUME; } - else if (vm->get_previous_reason() == History::NONE) + else if (vm->get_previous_action() == History::UNDEPLOY_ACTION || + vm->get_previous_action() == History::UNDEPLOY_HARD_ACTION) { vm_state = VirtualMachine::PROLOG_UNDEPLOY; tm_action = TransferManager::PROLOG_RESUME; @@ -120,6 +121,10 @@ void LifeCycleManager::suspend_action(int vid) vmpool->update(vm); + vm->set_action(History::SUSPEND_ACTION); + + vmpool->update_history(vm); + vm->log("LCM", Log::INFO, "New VM state is SAVE_SUSPEND"); //---------------------------------------------------- @@ -166,6 +171,10 @@ void LifeCycleManager::stop_action(int vid) vmpool->update(vm); + vm->set_action(History::STOP_ACTION); + + vmpool->update_history(vm); + vm->log("LCM", Log::INFO, "New VM state is SAVE_STOP"); //---------------------------------------------------- @@ -215,6 +224,8 @@ void LifeCycleManager::migrate_action(int vid) vm->set_stime(time(0)); + vm->set_previous_action(History::MIGRATE_ACTION); + vmpool->update_history(vm); vm->get_requirements(cpu,mem,disk); @@ -271,6 +282,8 @@ void LifeCycleManager::live_migrate_action(int vid) vm->set_stime(time(0)); + vm->set_previous_action(History::LIVE_MIGRATE_ACTION); + vmpool->update_history(vm); vm->get_requirements(cpu,mem,disk); @@ -323,6 +336,10 @@ void LifeCycleManager::shutdown_action(int vid) vmpool->update(vm); + vm->set_action(History::SHUTDOWN_ACTION); + + vmpool->update_history(vm); + vm->log("LCM",Log::INFO,"New VM state is SHUTDOWN"); //---------------------------------------------------- @@ -375,12 +392,18 @@ void LifeCycleManager::undeploy_action(int vid, bool hard) if (hard) { + vm->set_action(History::UNDEPLOY_HARD_ACTION); + vmm->trigger(VirtualMachineManager::CANCEL,vid); } else { + vm->set_action(History::UNDEPLOY_ACTION); + vmm->trigger(VirtualMachineManager::SHUTDOWN,vid); } + + vmpool->update_history(vm); } else { @@ -445,12 +468,18 @@ void LifeCycleManager::poweroff_action(int vid, bool hard) if (hard) { + vm->set_action(History::POWEROFF_HARD_ACTION); + vmm->trigger(VirtualMachineManager::CANCEL,vid); } else { + vm->set_action(History::POWEROFF_ACTION); + vmm->trigger(VirtualMachineManager::SHUTDOWN,vid); } + + vmpool->update_history(vm); } else { @@ -548,6 +577,10 @@ void LifeCycleManager::cancel_action(int vid) vmpool->update(vm); + vm->set_action(History::SHUTDOWN_HARD_ACTION); + + vmpool->update_history(vm); + vm->log("LCM", Log::INFO, "New state is CANCEL"); //---------------------------------------------------- @@ -584,7 +617,8 @@ void LifeCycleManager::restart_action(int vid) vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN || vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF || vm->get_lcm_state() == VirtualMachine::BOOT_SUSPENDED || - vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED)) + vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED || + vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY)) ||vm->get_state() == VirtualMachine::POWEROFF) { Nebula& nd = Nebula::instance(); @@ -599,7 +633,8 @@ void LifeCycleManager::restart_action(int vid) vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN || vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF || vm->get_lcm_state() == VirtualMachine::BOOT_SUSPENDED || - vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED)) + vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED || + vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY)) { vm->log("LCM", Log::INFO, "Sending BOOT command to VM again"); } @@ -809,10 +844,12 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm, bool dispose, int& imag if (dispose) { vm->set_state(VirtualMachine::CLEANUP_DELETE); + vm->set_action(History::DESTROY_ACTION); } else { vm->set_state(VirtualMachine::CLEANUP_RESUBMIT); + vm->set_action(History::DESTROY_RECREATE_ACTION); } vm->set_resched(false); @@ -845,6 +882,7 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm, bool dispose, int& imag case VirtualMachine::BOOT_POWEROFF: case VirtualMachine::BOOT_SUSPENDED: case VirtualMachine::BOOT_STOPPED: + case VirtualMachine::BOOT_UNDEPLOY: case VirtualMachine::RUNNING: case VirtualMachine::UNKNOWN: case VirtualMachine::SHUTDOWN: diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index f08d759ec1..e807a3885c 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -93,7 +93,7 @@ void LifeCycleManager::save_success_action(int vid) vm->set_vm_info(); - vm->set_reason(History::STOP_RESUME); + vm->set_reason(History::USER); vmpool->update_history(vm); @@ -121,7 +121,7 @@ void LifeCycleManager::save_success_action(int vid) vm->set_running_etime(the_time); - vm->set_reason(History::STOP_RESUME); + vm->set_reason(History::USER); vmpool->update_history(vm); @@ -222,6 +222,10 @@ void LifeCycleManager::save_failure_action(int vid) vmpool->update(vm); + vm->set_action(History::NONE_ACTION); + + vmpool->update_history(vm); + vm->log("LCM", Log::INFO, "Fail to save VM state." " Assuming that the VM is still RUNNING (will poll VM)."); @@ -290,7 +294,8 @@ void LifeCycleManager::deploy_success_action(int vid) vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF || vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN || vm->get_lcm_state() == VirtualMachine::BOOT_SUSPENDED|| - vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED ) + vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED || + vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY ) { vm->set_state(VirtualMachine::RUNNING); @@ -430,7 +435,7 @@ void LifeCycleManager::deploy_failure_action(int vid) vm->set_running_etime(the_time); - vm->set_reason(History::STOP_RESUME); + vm->set_reason(History::ERROR); vmpool->update_history(vm); @@ -440,6 +445,34 @@ void LifeCycleManager::deploy_failure_action(int vid) tm->trigger(TransferManager::EPILOG_STOP,vid); } + else if (vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY) + { + Nebula& nd = Nebula::instance(); + TransferManager * tm = nd.get_tm(); + time_t the_time = time(0); + + //---------------------------------------------------- + // EPILOG_UNDEPLOY STATE FROM BOOT + //---------------------------------------------------- + + vm->set_state(VirtualMachine::EPILOG_UNDEPLOY); + + vmpool->update(vm); + + vm->set_epilog_stime(the_time); + + vm->set_running_etime(the_time); + + vm->set_reason(History::ERROR); + + vmpool->update_history(vm); + + vm->log("LCM", Log::INFO, "Fail to boot VM. New VM state is EPILOG_UNDEPLOY"); + + //---------------------------------------------------- + + tm->trigger(TransferManager::EPILOG_STOP,vid); + } else { vm->log("LCM",Log::ERROR,"deploy_failure_action, VM in a wrong state"); @@ -506,7 +539,7 @@ void LifeCycleManager::shutdown_success_action(int vid) vm->set_vm_info(); - vm->set_reason(History::STOP_RESUME); + vm->set_reason(History::USER); vmpool->update_history(vm); @@ -530,7 +563,7 @@ void LifeCycleManager::shutdown_success_action(int vid) vm->set_running_etime(the_time); - vm->set_reason(History::NONE); + vm->set_reason(History::USER); vmpool->update_history(vm); @@ -577,6 +610,10 @@ void LifeCycleManager::shutdown_failure_action(int vid) vmpool->update(vm); + vm->set_action(History::NONE_ACTION); + + vmpool->update_history(vm); + vm->log("LCM", Log::INFO, "Fail to shutdown VM." " Assuming that the VM is still RUNNING (will poll VM)."); @@ -641,6 +678,10 @@ void LifeCycleManager::prolog_success_action(int vid) { vm->set_state(VirtualMachine::BOOT_STOPPED); } + else if ( lcm_state == VirtualMachine::PROLOG_UNDEPLOY ) + { + vm->set_state(VirtualMachine::BOOT_UNDEPLOY); + } else // PROLOG || PROLOG_MIGRATE { vm->set_state(VirtualMachine::BOOT); @@ -712,7 +753,7 @@ void LifeCycleManager::prolog_failure_action(int vid) vm->set_vm_info(); - vm->set_reason(History::STOP_RESUME); + vm->set_reason(History::ERROR); vmpool->update_history(vm); @@ -745,7 +786,7 @@ void LifeCycleManager::prolog_failure_action(int vid) vm->set_vm_info(); - vm->set_reason(History::NONE); + vm->set_reason(History::ERROR); vmpool->update_history(vm); @@ -946,7 +987,7 @@ void LifeCycleManager::cancel_success_action(int vid) vmpool->update(vm); - vm->set_reason(History::CANCEL); + vm->set_reason(History::USER); vm->set_epilog_stime(the_time); @@ -976,7 +1017,7 @@ void LifeCycleManager::cancel_success_action(int vid) vm->set_running_etime(the_time); - vm->set_reason(History::NONE); + vm->set_reason(History::USER); vmpool->update_history(vm); @@ -1002,7 +1043,7 @@ void LifeCycleManager::cancel_success_action(int vid) vm->set_vm_info(); - vm->set_reason(History::STOP_RESUME); + vm->set_reason(History::USER); vmpool->update_history(vm); @@ -1047,6 +1088,10 @@ void LifeCycleManager::cancel_failure_action(int vid) vmpool->update(vm); + vm->set_action(History::NONE_ACTION); + + vmpool->update_history(vm); + vm->log("LCM", Log::INFO, "Fail to cancel VM." " Assuming that the VM is still RUNNING (will poll VM)."); @@ -1133,7 +1178,7 @@ void LifeCycleManager::monitor_suspend_action(int vid) vm->set_vm_info(); - vm->set_reason(History::STOP_RESUME); + vm->set_reason(History::ERROR); vmpool->update_history(vm); diff --git a/src/mad/sh/scripts_common.sh b/src/mad/sh/scripts_common.sh index 86efa9a7e8..414285f91f 100644 --- a/src/mad/sh/scripts_common.sh +++ b/src/mad/sh/scripts_common.sh @@ -144,6 +144,28 @@ function exec_and_log fi } +# Like exec_and_log but does not exit on failure. Just sets the variable +# ERROR to the error message. +function exec_and_set_error +{ + message=$2 + + EXEC_LOG_ERR=`$1 2>&1 1>/dev/null` + EXEC_LOG_RC=$? + + export ERROR="" + + if [ $EXEC_LOG_RC -ne 0 ]; then + log_error "Command \"$1\" failed: $EXEC_LOG_ERR" + + if [ -n "$2" ]; then + export ERROR="$2" + else + export ERROR="Error executing $1: $EXEC_LOG_ERR" + fi + fi +} + # Like exec_and_log but the first argument is the number of seconds # before here is timeout and kills the command # diff --git a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java index b8e941b532..6e02efa24e 100644 --- a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java +++ b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java @@ -107,7 +107,8 @@ public class VirtualMachine extends PoolElement{ "HOTPLUG_SAVEAS_SUSPENDED", "SHUTDOWN_UNDEPLOY", "EPILOG_UNDEPLOY", - "PROLOG_UNDEPLOY" }; + "PROLOG_UNDEPLOY", + "BOOT_UNDEPLOY" }; private static final String[] SHORT_LCM_STATES = { @@ -139,7 +140,11 @@ public class VirtualMachine extends PoolElement{ "hotp", "hotp", "hotp", - "hotp" }; + "hotp", + "shut", + "epil", + "prol", + "boot" }; /** * Creates a new VM representation. diff --git a/src/oca/ruby/opennebula/virtual_machine.rb b/src/oca/ruby/opennebula/virtual_machine.rb index 52a98b00f9..3084a7819a 100644 --- a/src/oca/ruby/opennebula/virtual_machine.rb +++ b/src/oca/ruby/opennebula/virtual_machine.rb @@ -54,7 +54,8 @@ module OpenNebula SHUTDOWN CANCEL FAILURE CLEANUP_RESUBMIT UNKNOWN HOTPLUG SHUTDOWN_POWEROFF BOOT_UNKNOWN BOOT_POWEROFF BOOT_SUSPENDED BOOT_STOPPED CLEANUP_DELETE HOTPLUG_SNAPSHOT HOTPLUG_NIC HOTPLUG_SAVEAS HOTPLUG_SAVEAS_POWEROFF - HOTPLUG_SAVEAS_SUSPENDED SHUTDOWN_UNDEPLOY EPILOG_UNDEPLOY PROLOG_UNDEPLOY} + HOTPLUG_SAVEAS_SUSPENDED SHUTDOWN_UNDEPLOY EPILOG_UNDEPLOY + PROLOG_UNDEPLOY BOOT_UNDEPLOY} SHORT_VM_STATES={ "INIT" => "init", @@ -100,19 +101,23 @@ module OpenNebula "HOTPLUG_SAVEAS_SUSPENDED" => "hotp", "SHUTDOWN_UNDEPLOY" => "shut", "EPILOG_UNDEPLOY" => "epil", - "PROLOG_UNDEPLOY" => "prol" + "PROLOG_UNDEPLOY" => "prol", + "BOOT_UNDEPLOY" => "boot" } - MIGRATE_REASON=%w{NONE ERROR STOP_RESUME USER CANCEL} + MIGRATE_REASON=%w{NONE ERROR USER} SHORT_MIGRATE_REASON={ "NONE" => "none", "ERROR" => "erro", - "STOP_RESUME" => "stop", - "USER" => "user", - "CANCEL" => "canc" + "USER" => "user" } + HISTORY_ACTION=%w{none migrate live-migrate shutdown shutdown-hard + undeploy undeploy-hard hold release stop suspend resume boot destroy + destroy-recreate reboot reboot-hard resched unresched poweroff + poweroff-hard} + # Creates a VirtualMachine description with just its identifier # this method should be used to create plain VirtualMachine objects. # +id+ the id of the vm @@ -137,6 +142,10 @@ module OpenNebula reason_str end + def VirtualMachine.get_history_action(action) + return HISTORY_ACTION[action.to_i] + end + # Class constructor def initialize(xml, client) super(xml,client) diff --git a/src/onedb/3.9.80_to_4.0.0.rb b/src/onedb/3.9.80_to_4.0.0.rb new file mode 100644 index 0000000000..5c38ad50d3 --- /dev/null +++ b/src/onedb/3.9.80_to_4.0.0.rb @@ -0,0 +1,99 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs # +# # +# 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 "rexml/document" +include REXML + +module Migrator + def db_version + "4.0.0" + end + + def one_version + "OpenNebula 4.0.0" + end + + def up + + ######################################################################## + # Feature #1631: Add ACTION to history entries + ######################################################################## + + @db.run "ALTER TABLE vm_pool RENAME TO old_vm_pool;" + @db.run "CREATE TABLE vm_pool (oid INTEGER PRIMARY KEY, name VARCHAR(128), body MEDIUMTEXT, uid INTEGER, gid INTEGER, last_poll INTEGER, state INTEGER, lcm_state INTEGER, owner_u INTEGER, group_u INTEGER, other_u INTEGER);" + + @db.fetch("SELECT * FROM old_vm_pool") do |row| + doc = Document.new(row[:body]) + + doc.root.each_element("HISTORY_RECORDS/HISTORY") do |e| + update_history(e) + end + + @db[:vm_pool].insert( + :oid => row[:oid], + :name => row[:name], + :body => doc.root.to_s, + :uid => row[:uid], + :gid => row[:gid], + :last_poll => row[:last_poll], + :state => row[:state], + :lcm_state => row[:lcm_state], + :owner_u => row[:owner_u], + :group_u => row[:group_u], + :other_u => row[:other_u]) + end + + @db.run "DROP TABLE old_vm_pool;" + + @db.run "ALTER TABLE history RENAME TO old_history;" + @db.run "CREATE TABLE history (vid INTEGER, seq INTEGER, body MEDIUMTEXT, stime INTEGER, etime INTEGER,PRIMARY KEY(vid,seq));" + + @db.fetch("SELECT * FROM old_history") do |row| + doc = Document.new(row[:body]) + + doc.root.each_element("/HISTORY") do |e| + update_history(e) + end + + @db[:history].insert( + :vid => row[:vid], + :seq => row[:seq], + :body => doc.root.to_s, + :stime => row[:stime], + :etime => row[:etime]) + end + + @db.run "DROP TABLE old_history;" + + + return true + end + + def update_history(history_elem) + history_elem.add_element("ACTION").text = "0" # NONE_ACTION + + # History reason enum has changed from + # NONE, ERROR, STOP_RESUME, USER, CANCEL to + # NONE, ERROR, USER + history_elem.each_element("REASON") do |reason_e| + reason = reason_e.text.to_i + + if reason > 1 # STOP_RESUME, USER, CANCEL + reason_e.text = "2" # USER + end + end + end +end diff --git a/src/ozones/Server/public/js/ozones.js b/src/ozones/Server/public/js/ozones.js index e8661caccd..ee70bb595c 100644 --- a/src/ozones/Server/public/js/ozones.js +++ b/src/ozones/Server/public/js/ozones.js @@ -125,9 +125,7 @@ var oZones = { case "vm_migrate_reason": state = tr(["NONE", "ERROR", - "STOP_RESUME", - "USER", - "CANCEL"][value]); + "USER"][value]); break; default: return value; diff --git a/src/rm/RequestManagerVirtualMachine.cc b/src/rm/RequestManagerVirtualMachine.cc index e3f7a19c7d..638019728f 100644 --- a/src/rm/RequestManagerVirtualMachine.cc +++ b/src/rm/RequestManagerVirtualMachine.cc @@ -299,10 +299,10 @@ int RequestManagerVirtualMachine::add_history(VirtualMachine * vm, void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList, RequestAttributes& att) { - string action = xmlrpc_c::value_string(paramList.getString(1)); - int id = xmlrpc_c::value_int(paramList.getInt(2)); + string action_st = xmlrpc_c::value_string(paramList.getString(1)); + int id = xmlrpc_c::value_int(paramList.getInt(2)); - int rc = -3; + int rc; Nebula& nd = Nebula::instance(); DispatchManager * dm = nd.get_dm(); @@ -310,8 +310,33 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList, ostringstream oss; AuthRequest::Operation op = auth_op; + History::VMAction action; - if (action == "resched" || action == "unresched") + // Compatibility with 3.8 + if (action_st == "cancel") + { + action_st = "shutdown-hard"; + } + else if (action_st == "restart") + { + action_st = "boot"; + } + else if (action_st == "finalize") + { + action_st = "destroy"; + } + else if (action_st == "resubmit") + { + action_st = "destroy-recreate"; + } + else if (action_st == "reset") + { + action_st = "reboot-hard"; + } + + History::action_from_str(action_st, action); + + if (action == History::RESCHED_ACTION || action == History::UNRESCHED_ACTION) { op = AuthRequest::ADMIN; } @@ -321,77 +346,65 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList, return; } - if (action == "shutdown") + switch (action) { - rc = dm->shutdown(id); - } - else if (action == "hold") - { - rc = dm->hold(id); - } - else if (action == "release") - { - rc = dm->release(id); - } - else if (action == "stop") - { - rc = dm->stop(id); - } - else if (action == "shutdown-hard" || action == "cancel") - { - rc = dm->cancel(id); - } - else if (action == "suspend") - { - rc = dm->suspend(id); - } - else if (action == "resume") - { - rc = dm->resume(id); - } - else if (action == "boot" || action == "restart") - { - rc = dm->restart(id); - } - else if (action == "destroy" || action == "finalize") - { - rc = dm->finalize(id); - } - else if (action == "destroy-recreate" || action == "resubmit") - { - rc = dm->resubmit(id); - } - else if (action == "reboot") - { - rc = dm->reboot(id); - } - else if (action == "resched") - { - rc = dm->resched(id, true); - } - else if (action == "unresched") - { - rc = dm->resched(id, false); - } - else if (action == "reboot-hard" || action == "reset") - { - rc = dm->reset(id); - } - else if (action == "poweroff") - { - rc = dm->poweroff(id, false); - } - else if (action == "poweroff-hard") - { - rc = dm->poweroff(id, true); - } - else if (action == "undeploy") - { - rc = dm->undeploy(id, false); - } - else if (action == "undeploy-hard") - { - rc = dm->undeploy(id, true); + case History::SHUTDOWN_ACTION: + rc = dm->shutdown(id); + break; + case History::HOLD_ACTION: + rc = dm->hold(id); + break; + case History::RELEASE_ACTION: + rc = dm->release(id); + break; + case History::STOP_ACTION: + rc = dm->stop(id); + break; + case History::SHUTDOWN_HARD_ACTION: + rc = dm->cancel(id); + break; + case History::SUSPEND_ACTION: + rc = dm->suspend(id); + break; + case History::RESUME_ACTION: + rc = dm->resume(id); + break; + case History::BOOT_ACTION: + rc = dm->restart(id); + break; + case History::DESTROY_ACTION: + rc = dm->finalize(id); + break; + case History::DESTROY_RECREATE_ACTION: + rc = dm->resubmit(id); + break; + case History::REBOOT_ACTION: + rc = dm->reboot(id); + break; + case History::RESCHED_ACTION: + rc = dm->resched(id, true); + break; + case History::UNRESCHED_ACTION: + rc = dm->resched(id, false); + break; + case History::REBOOT_HARD_ACTION: + rc = dm->reset(id); + break; + case History::POWEROFF_ACTION: + rc = dm->poweroff(id, false); + break; + case History::POWEROFF_HARD_ACTION: + rc = dm->poweroff(id, true); + break; + case History::UNDEPLOY_ACTION: + rc = dm->undeploy(id, false); + break; + case History::UNDEPLOY_HARD_ACTION: + rc = dm->undeploy(id, true); + break; + default: + rc = -3; + break; } switch (rc) @@ -405,14 +418,14 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList, att); break; case -2: - oss << "Wrong state to perform action \"" << action << "\""; + oss << "Wrong state to perform action \"" << action_st << "\""; failure_response(ACTION, request_error(oss.str(),""), att); break; case -3: - oss << "Virtual machine action \"" << action + oss << "Virtual machine action \"" << action_st << "\" is not supported"; failure_response(ACTION, diff --git a/src/sunstone/OpenNebulaVNC.rb b/src/sunstone/OpenNebulaVNC.rb index 051ba191d2..1219c0b46a 100644 --- a/src/sunstone/OpenNebulaVNC.rb +++ b/src/sunstone/OpenNebulaVNC.rb @@ -56,7 +56,8 @@ VNC_STATES = [ 28, #HOTPLUG_SAVEAS_SUSPENDED 29 #SHUTDOWN_UNDEPLOY #30, #EPILOG_UNDEPLOY - #31 #PROLOG_UNDEPLOY + #31, #PROLOG_UNDEPLOY + #32 #BOOT_UNDEPLOY ] class OpenNebulaVNC diff --git a/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb b/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb index f8a6e28aad..cb2ac8ecb0 100644 --- a/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb +++ b/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb @@ -61,7 +61,7 @@ module OpenNebulaJSON when "snapshot_delete" then self.snapshot_delete(action_hash['params']) when "shutdown" then self.shutdown when "reboot" then self.reboot - when "poweroff" then self.poweroff + when "poweroff" then self.poweroff(action_hash['params']) when "resubmit" then self.resubmit when "chown" then self.chown(action_hash['params']) when "chmod" then self.chmod_octet(action_hash['params']) @@ -72,6 +72,7 @@ module OpenNebulaJSON when "detachnic" then self.detachnic(action_hash['params']) when "update" then self.update(action_hash['params']) when "rename" then self.rename(action_hash['params']) + when "undeploy" then self.undeploy(action_hash['params']) else error_msg = "#{action_hash['perform']} action not " << " available for this resource" @@ -87,6 +88,14 @@ module OpenNebulaJSON super(params['host_id']) end + def undeploy(params=Hash.new) + super(params['hard']) + end + + def poweroff(params=Hash.new) + super(params['hard']) + end + def migrate(params=Hash.new, live=false, enforce=false) # TODO add enforce parameter super(params['host_id'], live) diff --git a/src/sunstone/public/css/app.css b/src/sunstone/public/css/app.css index 8ec1dc2f7a..55fd3d7b85 100644 --- a/src/sunstone/public/css/app.css +++ b/src/sunstone/public/css/app.css @@ -6147,12 +6147,11 @@ div.button-bar { /* line 158, ../sass/app.scss */ #logo { font-weight: bold; - margin: 10%; margin-top: 15%; margin-bottom: 10%; } -/* line 165, ../sass/app.scss */ +/* line 164, ../sass/app.scss */ #login-info { text-align: center; overflow: visible; @@ -6169,42 +6168,42 @@ div.button-bar { visibility: visible; } -/* line 186, ../sass/app.scss */ +/* line 185, ../sass/app.scss */ #links { padding-top: 4px; margin-right: 40px; float: right; } -/* line 192, ../sass/app.scss */ +/* line 191, ../sass/app.scss */ #login-info, #login-info a, #links, #links a { color: #555; } -/* line 196, ../sass/app.scss */ +/* line 195, ../sass/app.scss */ #login-info, #login-info a { font-weight: bold; } -/* line 199, ../sass/app.scss */ +/* line 198, ../sass/app.scss */ .sunstone-color { color: #2ba6cb; } -/* line 203, ../sass/app.scss */ +/* line 202, ../sass/app.scss */ #logo-wrapper { float: right; margin-top: 0px; margin-right: 20px; } -/* line 209, ../sass/app.scss */ +/* line 208, ../sass/app.scss */ .menu-nav { height: 70%; overflow: overlay; } -/* line 214, ../sass/app.scss */ +/* line 213, ../sass/app.scss */ #menu { padding-right: 0; padding-left: 0; @@ -6212,29 +6211,29 @@ div.button-bar { overflow: hidden; } -/* line 221, ../sass/app.scss */ +/* line 220, ../sass/app.scss */ #tabs_content { box-shadow: -8px -8px 11px -11px black; z-index: 2 !important; } -/* line 226, ../sass/app.scss */ +/* line 225, ../sass/app.scss */ #navigation { - margin: 8%; + margin: 0 8%; box-shadow: 0 0 1px 0px black; } -/* line 231, ../sass/app.scss */ +/* line 230, ../sass/app.scss */ .tabs.vertical li { border-left: none; } -/* line 235, ../sass/app.scss */ +/* line 234, ../sass/app.scss */ .tabs.vertical li.active { border-top: none; } -/* line 240, ../sass/app.scss */ +/* line 239, ../sass/app.scss */ #navigation > li:not(.subTab).navigation-active-li > a, #navigation > li:not(.subTab).active > a { background: #f2f2f2; @@ -6242,12 +6241,12 @@ div.button-bar { color: #555; } -/* line 250, ../sass/app.scss */ +/* line 249, ../sass/app.scss */ #navigation i { margin-right: 3px; } -/* line 255, ../sass/app.scss */ +/* line 254, ../sass/app.scss */ #navigation li.subTab > a { background: #fdfdfd; color: #555; @@ -6255,33 +6254,43 @@ div.button-bar { padding: 7px 11px 7px 25px; } -/* line 262, ../sass/app.scss */ +/* line 261, ../sass/app.scss */ #navigation li.subsubTab { padding-left: 15px; } -/* line 266, ../sass/app.scss */ +/* line 265, ../sass/app.scss */ #navigation li:not(subTab) { - border-left: 5px solid #f2f2f2 !important; + border-left: 5px solid #f2f2f2; } -/* line 270, ../sass/app.scss */ +/* line 269, ../sass/app.scss */ +#navigation li:not(subTab):hover { + border-left: 5px solid #e2e2e2; +} + +/* line 273, ../sass/app.scss */ #navigation li.subTab:not(.navigation-active-li) { - border-left: 5px solid #fdfdfd !important; + border-left: 5px solid #fdfdfd; } -/* line 274, ../sass/app.scss */ -#navigation li:hover { - font-weight: bold; +/* line 277, ../sass/app.scss */ +#navigation li.subTab:not(.navigation-active-li):hover { + border-left: 5px solid #e2e2e2; } -/* line 278, ../sass/app.scss */ +/* line 281, ../sass/app.scss */ +#navigation a:hover { + background: #e2e2e2 !important; +} + +/* line 285, ../sass/app.scss */ #navigation .navigation-active-li { border-left: 5px solid #555 !important; } /* top menu css */ -/* line 285, ../sass/app.scss */ +/* line 293, ../sass/app.scss */ #menutop_container { margin: 0px 171px; color: #FFFFFF; @@ -6289,14 +6298,14 @@ div.button-bar { font-weight: bold; } -/* line 291, ../sass/app.scss */ +/* line 299, ../sass/app.scss */ #menutop_navbar { float: left; height: 25px; font-size: 13px; } -/* line 296, ../sass/app.scss */ +/* line 304, ../sass/app.scss */ #menutop_navbar ul { float: left; height: 25px; @@ -6305,12 +6314,12 @@ div.button-bar { padding-left: 1px; } -/* line 303, ../sass/app.scss */ +/* line 311, ../sass/app.scss */ #menutop_navbar ul { background-color: #4d4d4d; } -/* line 306, ../sass/app.scss */ +/* line 314, ../sass/app.scss */ #menutop_navbar ul li { float: left; min-width: 72px; @@ -6327,255 +6336,255 @@ div.button-bar { color: white; } -/* line 322, ../sass/app.scss */ +/* line 330, ../sass/app.scss */ #menutop_navbar ul li:hover { background-color: #ffffff; } /* end top menu css */ -/* line 333, ../sass/app.scss */ +/* line 341, ../sass/app.scss */ .ui-layout-pane { border: none; } -/* line 338, ../sass/app.scss */ +/* line 346, ../sass/app.scss */ .button.small { font-size: 12px; box-shadow: none; height: 28px; } -/* line 344, ../sass/app.scss */ +/* line 352, ../sass/app.scss */ .button { box-shadow: none; } -/* line 348, ../sass/app.scss */ +/* line 356, ../sass/app.scss */ .button.tiny { box-shadow: none; } -/* line 352, ../sass/app.scss */ +/* line 360, ../sass/app.scss */ .panel { padding: 0px; background: #f2f2f2; } -/* line 357, ../sass/app.scss */ +/* line 365, ../sass/app.scss */ .tabs.vertical li a { padding: 15px 11px; } -/* line 361, ../sass/app.scss */ +/* line 369, ../sass/app.scss */ input[type="text"] { height: 28px !important; } -/* line 365, ../sass/app.scss */ +/* line 373, ../sass/app.scss */ .right { float: right !important; } -/* line 369, ../sass/app.scss */ +/* line 377, ../sass/app.scss */ .ui-layout-pane { background: #fdfdfd; } -/* line 376, ../sass/app.scss */ +/* line 384, ../sass/app.scss */ tr.odd:hover td { background-color: #2ba6cb !important; cursor: pointer; color: #FFF !important; } -/* line 382, ../sass/app.scss */ +/* line 390, ../sass/app.scss */ tr.even:hover td { background-color: #2ba6cb !important; cursor: pointer; color: #FFF !important; } -/* line 388, ../sass/app.scss */ +/* line 396, ../sass/app.scss */ tr { border-bottom: 1px solid #e6e6e6; } -/* line 394, ../sass/app.scss */ +/* line 402, ../sass/app.scss */ table thead tr th, table tfoot tr td { padding: 5px 10px 5px; line-height: 16px; } -/* line 399, ../sass/app.scss */ +/* line 407, ../sass/app.scss */ table { border-collapse: collapse; border-spacing: 0; } /* Growl */ -/* line 405, ../sass/app.scss */ +/* line 413, ../sass/app.scss */ .jGrowl-notification h1 { font-size: 1.2em; } -/* line 409, ../sass/app.scss */ +/* line 417, ../sass/app.scss */ .jGrowl-notification, .jGrowl-notify-submit { border: 2px #444444 solid; background-color: #f3f3f3 !important; color: #666666; } -/* line 415, ../sass/app.scss */ +/* line 423, ../sass/app.scss */ .jGrowl-notify-error { border: 2px #660000 solid; background-color: #f39999 !important; color: #660000; } -/* line 421, ../sass/app.scss */ +/* line 429, ../sass/app.scss */ .jGrowl-notify-error table td.key_error { text-transform: capitalize; width: 100%; font-weight: bold; } -/* line 427, ../sass/app.scss */ +/* line 435, ../sass/app.scss */ .jGrowl-notify-error table td.key_error:after { content: ":"; } -/* line 434, ../sass/app.scss */ +/* line 442, ../sass/app.scss */ .markrow { background-color: #cdebf5 !important; } -/* line 435, ../sass/app.scss */ +/* line 443, ../sass/app.scss */ .markrowselected { background-color: #2ba6cb !important; color: #FFF; } -/* line 436, ../sass/app.scss */ +/* line 444, ../sass/app.scss */ .markrowchecked { background-color: #cdebf5; } -/* line 439, ../sass/app.scss */ +/* line 447, ../sass/app.scss */ .hidden { display: none; } -/* line 448, ../sass/app.scss */ +/* line 456, ../sass/app.scss */ #navigation li.topTab span.plusIcon, #navigation li.subTab span.plusIcon { display: none; float: right; } -/* line 453, ../sass/app.scss */ +/* line 461, ../sass/app.scss */ span.plusIcon { color: #d0d0d0; } -/* line 457, ../sass/app.scss */ +/* line 465, ../sass/app.scss */ span.plusIcon:hover { color: #555; } -/* line 464, ../sass/app.scss */ +/* line 472, ../sass/app.scss */ table.extended_table tbody tr td { padding: 3px 10px; } -/* line 471, ../sass/app.scss */ +/* line 479, ../sass/app.scss */ .reveal-modal { top: 50px; } -/* line 476, ../sass/app.scss */ +/* line 484, ../sass/app.scss */ .ui-layout-resizer-open-hover, .ui-layout-resizer-dragging { background: #EEE; } -/* line 481, ../sass/app.scss */ +/* line 489, ../sass/app.scss */ .reveal-modal .panel { margin-left: -30px; margin-right: -30px; margin-bottom: 15px; } -/* line 487, ../sass/app.scss */ +/* line 495, ../sass/app.scss */ .reveal-modal.xlarge { padding-top: 0px; width: 80%; margin-left: -40%; } -/* line 493, ../sass/app.scss */ +/* line 501, ../sass/app.scss */ .reveal-modal { padding-top: 0px; } -/* line 497, ../sass/app.scss */ +/* line 505, ../sass/app.scss */ .reveal-modal h3 { margin-left: 30px; margin-bottom: 7px !important; } -/* line 502, ../sass/app.scss */ +/* line 510, ../sass/app.scss */ .reveal-modal .close-reveal-modal:not(.button) { top: 13px; } -/* line 506, ../sass/app.scss */ +/* line 514, ../sass/app.scss */ .reveal-modal .close-reveal-modal:not(.button):hover { color: #222; } -/* line 510, ../sass/app.scss */ +/* line 518, ../sass/app.scss */ fieldset { margin: 0px 10px; } -/* line 516, ../sass/app.scss */ +/* line 524, ../sass/app.scss */ .graph_table table { border: 0px; margin: 0px; } -/* line 521, ../sass/app.scss */ +/* line 529, ../sass/app.scss */ .graph_table table tr { border: 0px; } -/* line 526, ../sass/app.scss */ +/* line 534, ../sass/app.scss */ .ui-layout-pane { padding: 0px; overflow: overlay; } -/* line 531, ../sass/app.scss */ +/* line 539, ../sass/app.scss */ .reveal-modal .columns { padding: 0 8px; } -/* line 535, ../sass/app.scss */ +/* line 543, ../sass/app.scss */ select { width: auto; } -/* line 540, ../sass/app.scss */ +/* line 548, ../sass/app.scss */ form.creation { padding: 5px; } -/* line 544, ../sass/app.scss */ +/* line 552, ../sass/app.scss */ #dialog input { margin: 0px; } -/* line 549, ../sass/app.scss */ +/* line 557, ../sass/app.scss */ .progress-container { position: relative; width: 100%; @@ -6583,7 +6592,7 @@ form.creation { background: #FFF; } -/* line 556, ../sass/app.scss */ +/* line 564, ../sass/app.scss */ .progress { position: absolute; width: 100%; @@ -6591,7 +6600,7 @@ form.creation { background: #FFF; } -/* line 563, ../sass/app.scss */ +/* line 571, ../sass/app.scss */ .progress-text { position: absolute; width: 100%; @@ -6599,53 +6608,53 @@ form.creation { color: #000 !important; } -/* line 570, ../sass/app.scss */ +/* line 578, ../sass/app.scss */ .meter { background: #cdebf5 !important; } -/* line 574, ../sass/app.scss */ +/* line 582, ../sass/app.scss */ .dashboard .subheader { text-align: center; } -/* line 578, ../sass/app.scss */ +/* line 586, ../sass/app.scss */ .dashboard h2.subheader { margin-bottom: 0; margin-top: 0; } -/* line 583, ../sass/app.scss */ +/* line 591, ../sass/app.scss */ .dashboard h6.subheader { margin-top: 0; } -/* line 587, ../sass/app.scss */ +/* line 595, ../sass/app.scss */ .dashboard h3.subheader { margin-top: 0; } -/* line 591, ../sass/app.scss */ +/* line 599, ../sass/app.scss */ ul.button-group { margin-bottom: 0; } -/* line 595, ../sass/app.scss */ +/* line 603, ../sass/app.scss */ .value_td { text-overflow: ellipsis; } -/* line 599, ../sass/app.scss */ +/* line 607, ../sass/app.scss */ small { color: #b6b6b6 !important; } -/* line 603, ../sass/app.scss */ +/* line 611, ../sass/app.scss */ .header-dashboard { margin-top: -5px; } -/* line 607, ../sass/app.scss */ +/* line 615, ../sass/app.scss */ .span-dashboard { background: #fcfcfc; color: #6f6f6f; @@ -6653,42 +6662,43 @@ small { box-shadow: 0 0 2px 0px #6f6f6f; } -/* line 616, ../sass/app.scss */ +/* line 624, ../sass/app.scss */ .button.dropdown.small::after { - border-color: #2f2f2f transparent transparent transparent; + border-color: #9f9f9f transparent transparent transparent; + border-width: 4px; } -/* line 620, ../sass/app.scss */ +/* line 629, ../sass/app.scss */ .footer-opennebula { font-size: 10px; color: #b6b6b6 !important; } -/* line 625, ../sass/app.scss */ +/* line 634, ../sass/app.scss */ a.footer.button { margin: 5px; } -/* line 630, ../sass/app.scss */ +/* line 639, ../sass/app.scss */ .user-login { float: right; } -/* line 634, ../sass/app.scss */ +/* line 643, ../sass/app.scss */ .user-login i.header-icon { color: #6f6f6f; font-weight: 300; font-size: 23px; } -/* line 640, ../sass/app.scss */ +/* line 649, ../sass/app.scss */ .user-login .button { color: #6f6f6f; font-size: 60%; line-height: 0; } -/* line 646, ../sass/app.scss */ +/* line 655, ../sass/app.scss */ .user-login .button.secondary { background: #f2f2f2; border: 0px; @@ -6696,88 +6706,88 @@ a.footer.button { font-weight: 300; } -/* line 654, ../sass/app.scss */ +/* line 663, ../sass/app.scss */ .user-login .button.secondary:hover, .user-login .button.secondary:focus { background-color: #d0d0d0; color: #6f6f6f; } -/* line 659, ../sass/app.scss */ +/* line 668, ../sass/app.scss */ .user-login .button.dropdown.tiny::after { border: solid 5px; border-color: #b6b6b6 transparent transparent transparent; right: 7px; } -/* line 665, ../sass/app.scss */ +/* line 674, ../sass/app.scss */ .header-resource { text-align: center; } -/* line 669, ../sass/app.scss */ +/* line 678, ../sass/app.scss */ .header-resource { float: left; } -/* line 673, ../sass/app.scss */ +/* line 682, ../sass/app.scss */ .header { text-align: center; } -/* line 677, ../sass/app.scss */ +/* line 686, ../sass/app.scss */ .button.dropdown.tiny ul.no-hover.show-dropdown { top: 34px !important; } -/* line 681, ../sass/app.scss */ +/* line 690, ../sass/app.scss */ .graph_legend { text-align: center; } -/* line 685, ../sass/app.scss */ +/* line 694, ../sass/app.scss */ .graph_legend table { background: inherit; border: 0px; width: 100%; } -/* line 691, ../sass/app.scss */ +/* line 700, ../sass/app.scss */ .graph_legend h3 { margin-top: 0px; } -/* line 695, ../sass/app.scss */ +/* line 704, ../sass/app.scss */ .graph_legend .subheader { margin-bottom: 5px; } -/* line 699, ../sass/app.scss */ +/* line 708, ../sass/app.scss */ .dashboard hr { margin: 0; margin-bottom: 8px; } -/* line 704, ../sass/app.scss */ +/* line 713, ../sass/app.scss */ .graph { margin-bottom: 15px !important; } -/* line 708, ../sass/app.scss */ +/* line 717, ../sass/app.scss */ .dashboard-panel { height: 450px; } -/* line 712, ../sass/app.scss */ +/* line 721, ../sass/app.scss */ .vm_log_error { color: #ff8d81; } -/* line 716, ../sass/app.scss */ +/* line 725, ../sass/app.scss */ .noUiSlider { margin: 10px; } -/* line 720, ../sass/app.scss */ +/* line 729, ../sass/app.scss */ .log-tab { background: #6f6f6f; color: #f2f2f2; @@ -6785,20 +6795,40 @@ a.footer.button { padding: 20px; } -/* line 727, ../sass/app.scss */ +/* line 736, ../sass/app.scss */ .reveal-modal ul.tabs-content { margin: 0 0 0px; } -/* line 731, ../sass/app.scss */ +/* line 740, ../sass/app.scss */ .reveal-body { - max-height: 360px; - overflow-y: auto; + height: 80%; + overflow-y: overlay; overflow-x: hidden; - padding: 5px; + padding: 5px 20px; } -/* line 741, ../sass/app.scss */ +/* line 747, ../sass/app.scss */ +.reveal-footer { + position: absolute; + bottom: 20px; + width: 90%; +} + +/* line 753, ../sass/app.scss */ +.max-height { + max-height: 85%; + position: absolute; + height: 100%; +} + +/* line 759, ../sass/app.scss */ +.ui-layout-content { + overflow-y: overlay; + overflow-x: hidden; +} + +/* line 766, ../sass/app.scss */ div.time-picker { position: absolute; height: 191px; @@ -6811,20 +6841,20 @@ div.time-picker { margin: 0; } -/* line 751, ../sass/app.scss */ +/* line 776, ../sass/app.scss */ div.time-picker-12hours { width: 6em; /* needed for IE */ } -/* line 755, ../sass/app.scss */ +/* line 780, ../sass/app.scss */ div.time-picker ul { list-style-type: none; margin: 0; padding: 0; } -/* line 760, ../sass/app.scss */ +/* line 785, ../sass/app.scss */ div.time-picker li { cursor: pointer; height: 20px; @@ -6832,36 +6862,61 @@ div.time-picker li { padding: 4px 3px; } -/* line 766, ../sass/app.scss */ +/* line 791, ../sass/app.scss */ div.time-picker li.selected { background: #0063CE; color: #fff; } -/* line 772, ../sass/app.scss */ +/* line 797, ../sass/app.scss */ .timepicker { float: left; width: 50px !important; } -/* line 777, ../sass/app.scss */ +/* line 802, ../sass/app.scss */ .jdpicker { float: left; width: 90px !important; } -/* line 782, ../sass/app.scss */ +/* line 807, ../sass/app.scss */ .columns { line-height: 2; } -/* line 786, ../sass/app.scss */ +/* line 811, ../sass/app.scss */ .transparent_table, .transparent_table tr { background: none !important; border: 0px !important; } -/* line 791, ../sass/app.scss */ +/* line 816, ../sass/app.scss */ form { margin: 0 !important; } + +/* line 820, ../sass/app.scss */ +#template_create_tabs { + width: 180px; +} + +/* line 825, ../sass/app.scss */ +.dataTables_scrollHead { + height: 30px; +} + +/* line 829, ../sass/app.scss */ +.dataTables_scrollBody { + margin-top: -3px; +} + +/* line 833, ../sass/app.scss */ +.show_hide { + cursor: pointer; +} + +/* line 837, ../sass/app.scss */ +.show_hide:hover > h4 > small { + color: #6f6f6f !important; +} diff --git a/src/sunstone/public/css/login.css b/src/sunstone/public/css/login.css index a91e7d89a5..58e2d30dd1 100644 --- a/src/sunstone/public/css/login.css +++ b/src/sunstone/public/css/login.css @@ -150,16 +150,6 @@ div#login input#login_btn:hover { background: url(../images/login_over.png) no-repeat center ; } -.error_message { - display: none; - position: relative; - width:400px; - margin-left: auto; - margin-right: auto; - top: 80px; - font-size:1.0em; - padding: 2px 15px; -} #login_spinner { left: 22px; @@ -187,3 +177,45 @@ div#login input#login_btn:hover { margin-top: 35px; margin-left:0px; } + +div.alert-box { + display: block; + padding: 6px 7px 7px; + font-size: 14px; + color: white; + background-color: #2ba6cb; + border: 1px solid rgba(0, 0, 0, 0.1); + margin-bottom: 12px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -ms-border-radius: 3px; + -o-border-radius: 3px; + border-radius: 3px; + text-shadow: 0 -1px rgba(0, 0, 0, 0.3); + position: relative; + font-family: Arial, Helvetica, sans-serif; +} + +div.alert-box.alert { + background-color: #c0392b; + color: #fff; + text-shadow: 0 -1px rgba(0, 0, 0, 0.3); +} + +div.alert-box a.close { + color: #333; + position: absolute; + right: 4px; + top: -1px; + font-size: 17px; + opacity: 0.2; + padding: 4px; +} +/* line 34, ../../../../../../../.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/zurb-foundation-3.2.5/scss/foundation/components/modules/_ui.scss */ +div.alert-box a.close:hover, div.alert-box a.close:focus { + opacity: 0.4; +} + +#error_box { + margin-top:70px; +} \ No newline at end of file diff --git a/src/sunstone/public/js/layout.js b/src/sunstone/public/js/layout.js index 3fc6a89edf..e19c0d2393 100644 --- a/src/sunstone/public/js/layout.js +++ b/src/sunstone/public/js/layout.js @@ -36,8 +36,8 @@ function showTab(tabname,highlight_tab){ //we no longer expect #tab_id here, but simply tab_id //So safety check - remove # from #tab_id if present to ensure compatibility - $('tbody input.check_item:checked').click(); - $('td').removeClass('markrowchecked markrowselected'); + //$('tbody input.check_item:checked').click(); + //$('td').removeClass('markrowchecked markrowselected'); last_select_row = null; if (tabname.indexOf('#') == 0) @@ -142,7 +142,7 @@ $(document).ready(function () { applyDefaultStyles: false , center__paneSelector: ".outer-center" , west__paneSelector: ".outer-west" - , west__size: 245 + , west__size: 260 , north__size: 26 , south__size: 26 , spacing_open: 0 // ALL panes @@ -159,7 +159,7 @@ $(document).ready(function () { , west__resizable: false }); - var factor = 0.6; + var factor = 0.5; var dialog_height = Math.floor($(".outer-center").height()*factor); innerLayout = $('div.outer-center').layout({ diff --git a/src/sunstone/public/js/login.js b/src/sunstone/public/js/login.js index 645c6207fe..b681add977 100644 --- a/src/sunstone/public/js/login.js +++ b/src/sunstone/public/js/login.js @@ -24,16 +24,16 @@ function auth_error(req, error){ switch (status){ case 401: - $("#error_box").text("Invalid username or password"); + $("#error_message").text("Invalid username or password"); break; case 500: - $("#error_box").text("OpenNebula is not running or there was a server exception. Please check the server logs."); + $("#error_message").text("OpenNebula is not running or there was a server exception. Please check the server logs."); break; case 0: - $("#error_box").text("No answer from server. Is it running?"); + $("#error_message").text("No answer from server. Is it running?"); break; default: - $("#error_box").text("Unexpected error. Status "+status+". Check the server logs."); + $("#error_message").text("Unexpected error. Status "+status+". Check the server logs."); }; $("#error_box").fadeIn("slow"); $("#login_spinner").hide(); diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index 9b3d5dcb18..9a6da37b2f 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -83,7 +83,8 @@ var OpenNebula = { "SUSPENDED", "DONE", "FAILED", - "POWEROFF"][value]); + "POWEROFF", + "UNDEPLOYED"][value]); break; case "VM_LCM": case "vm_lcm": @@ -92,30 +93,34 @@ var OpenNebula = { "BOOT", "RUNNING", "MIGRATE", - "SAVE_STOP", - "SAVE_SUSPEND", - "SAVE_MIGRATE", - "PROLOG_MIGRATE", - "PROLOG_RESUME", - "EPILOG_STOP", + "SAVE", + "SAVE", + "SAVE", + "MIGRATE", + "PROLOG", + "EPILOG", "EPILOG", "SHUTDOWN", - "CANCEL", + "SHUTDOWN", "FAILURE", - "CLEANUP_RESUBMIT", + "CLEANUP", "UNKNOWN", "HOTPLUG", - "SHUTDOWN_POWEROFF", - "BOOT_UNKNOWN", - "BOOT_POWEROFF", - "BOOT_SUSPENDED", - "BOOT_STOPPED", - "CLEANUP_DELETE", - "HOTPLUG_SNAPSHOT", - "HOTPLUG_NIC", - "HOTPLUG_SAVEAS", - "HOTPLUG_SAVEAS_POWEROFF", - "HOTPLUG_SAVEAS_SUSPENDED"][value]); + "SHUTDOWN", + "BOOT", + "BOOT", + "BOOT", + "BOOT", + "CLEANUP", + "SNAPSHOT", + "HOTPLUG", + "HOTPLUG", + "HOTPLUG", + "HOTPLUG", + "SHUTDOWN", + "EPILOG", + "PROLOG", + "BOOT"][value]); break; case "IMAGE": case "image": @@ -133,9 +138,31 @@ var OpenNebula = { case "vm_migrate_reason": state = tr(["NONE", "ERROR", - "STOP_RESUME", - "USER", - "CANCEL"][value]); + "USER"][value]); + break; + case "VM_MIGRATE_ACTION": + case "vm_migrate_action": + state = tr(["none", + "migrate", + "live-migrate", + "shutdown", + "shutdown-hard", + "undeploy", + "undeploy-hard", + "hold", + "release", + "stop", + "suspend", + "resume", + "boot", + "destroy", + "destroy-recreate", + "reboot", + "reboot-hard", + "resched", + "unresched", + "poweroff", + "poweroff-hard"][value]); break; default: return value; @@ -664,7 +691,20 @@ var OpenNebula = { OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"resubmit"); }, "poweroff" : function(params){ - OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"poweroff"); + var action_obj = {"hard": false}; + OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"poweroff", action_obj); + }, + "poweroff_hard" : function(params){ + var action_obj = {"hard": true}; + OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"poweroff", action_obj); + }, + "undeploy" : function(params){ + var action_obj = {"hard": false}; + OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"undeploy", action_obj); + }, + "undeploy_hard" : function(params){ + var action_obj = {"hard": true}; + OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"undeploy", action_obj); }, "reboot" : function(params){ OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"reboot"); diff --git a/src/sunstone/public/js/plugins/acls-tab.js b/src/sunstone/public/js/plugins/acls-tab.js index d28a4af0c5..c18e8f629c 100644 --- a/src/sunstone/public/js/plugins/acls-tab.js +++ b/src/sunstone/public/js/plugins/acls-tab.js @@ -72,8 +72,8 @@ var create_acl_tmpl = '+tr("Create ACL")+'\ \ \ -
\
\ +\
\
\ \ @@ -149,15 +149,17 @@ var create_acl_tmpl =
\
\
\ -
\ + \ ×\ -
'; +\ + '; var acl_actions = { "Acl.create" : { @@ -430,7 +432,7 @@ function setupCreateAclDialog(){ // width: 650, // height: height //}); - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); //Default selected options $('#res_subgroup_all',dialog).attr('checked','checked'); @@ -611,7 +613,6 @@ function setAclAutorefresh(){ $(document).ready(function(){ //if we are not oneadmin, our tab will not even be in the DOM. dataTable_acls = $("#datatable_acls",main_tabs_context).dataTable({ - "sDom" : "<'H'>t<'row'<'six columns'i><'six columns'p>>", "oColVis": { "aiExclude": [ 0 ] }, @@ -619,11 +620,7 @@ $(document).ready(function(){ { "bSortable": false, "aTargets": ["check"] }, { "sWidth": "35px", "aTargets": [0,1] }, { "bVisible": false, "aTargets": [6]} - ], - "oLanguage": (datatable_lang != "") ? - { - sUrl: "locale/"+lang+"/"+datatable_lang - } : "" + ] }); diff --git a/src/sunstone/public/js/plugins/clusters-tab.js b/src/sunstone/public/js/plugins/clusters-tab.js index a79ad93996..7e37a4d1fd 100644 --- a/src/sunstone/public/js/plugins/clusters-tab.js +++ b/src/sunstone/public/js/plugins/clusters-tab.js @@ -72,15 +72,14 @@ var datastore_datatable_table_tmpl='\ ' -var create_cluster_tmpl ='
\ -
\ +var create_cluster_tmpl ='
\

\ '+tr("Create Cluster")+'\ '+tr("Update Cluster")+'\

\
\
\ -
\ + \
\
\
\ @@ -153,17 +152,17 @@ var create_cluster_tmpl ='
\
\ \ \ -
\ \
\ + '; +
\ + ×'; // Common utils for datatatables // Holds the selected items @@ -184,7 +183,7 @@ function setupCreateClusterDialog(){ dialog.html(create_cluster_tmpl); var height = Math.floor($(window).height()*0.8); //set height to a percentage of the window - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); // ------- Create the dialog datatables ------------ dataTable_cluster_hosts = $("#datatable_cluster_hosts", dialog).dataTable({ @@ -1812,18 +1811,13 @@ $(document).ready(function(){ //prepare host datatable dataTable_clusters = $("#datatable_clusters",main_tabs_context).dataTable({ - "sDom" :"<'H'>t<'row'<'six columns'i><'six columns'p>>", "oColVis": { "aiExclude": [ 0 ] }, "aoColumnDefs": [ { "bSortable": false, "aTargets": ["check"] }, { "sWidth": "35px", "aTargets": [0,1] }, - ], - "oLanguage": (datatable_lang != "") ? - { - sUrl: "locale/"+lang+"/"+datatable_lang - } : "" + ] }); $('#cluster_search').keyup(function(){ diff --git a/src/sunstone/public/js/plugins/config-tab.js b/src/sunstone/public/js/plugins/config-tab.js index e5b9c9377d..59455884ab 100644 --- a/src/sunstone/public/js/plugins/config-tab.js +++ b/src/sunstone/public/js/plugins/config-tab.js @@ -21,7 +21,7 @@ var config_tab_content = '+tr("Configuration")+'\ \
\ -
\ +
\
\
\
\ @@ -57,10 +57,13 @@ var config_tab_content =
\
\
\ +
\ + \ ×'; var config_actions = { @@ -80,7 +83,7 @@ function setupConfigDialog() { var dialog = $config_dialog; dialog.html(config_tab_content); - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); setupTips(dialog); diff --git a/src/sunstone/public/js/plugins/dashboard-tab.js b/src/sunstone/public/js/plugins/dashboard-tab.js index 01812d0a4f..bed8e3bdf3 100644 --- a/src/sunstone/public/js/plugins/dashboard-tab.js +++ b/src/sunstone/public/js/plugins/dashboard-tab.js @@ -79,7 +79,7 @@ var dashboard_tab_content = '\ \ '+tr("VNETS")+' \ \ - '+tr("ADDRESSES")+'\ + '+tr("USED IPs")+'\ \
\
\ diff --git a/src/sunstone/public/js/plugins/datastores-tab.js b/src/sunstone/public/js/plugins/datastores-tab.js index fc49ff969d..197b52a312 100644 --- a/src/sunstone/public/js/plugins/datastores-tab.js +++ b/src/sunstone/public/js/plugins/datastores-tab.js @@ -69,14 +69,13 @@ var datastores_tab_content = '\ '; var create_datastore_tmpl = -'
\ -
\ +'
\

\ '+tr("Create Datastore")+'\

\
\ -
\
\ + \
\
\ \ @@ -265,15 +264,16 @@ var create_datastore_tmpl =
\
\
\ + \ ×\ -
\ -
'; + '; var datastore_image_table_tmpl='\ \ @@ -763,7 +763,7 @@ function setupCreateDatastoreDialog(){ var dialog = $create_datastore_dialog; dialog.html(create_datastore_tmpl); - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); setupTips(dialog); @@ -986,18 +986,13 @@ function setDatastoreAutorefresh(){ $(document).ready(function(){ dataTable_datastores = $("#datatable_datastores",main_tabs_context).dataTable({ - "sDom" : "<'H'>t<'row'<'six columns'i><'six columns'p>>", "oColVis": { "aiExclude": [ 0 ] }, "aoColumnDefs": [ { "sWidth": "35px", "aTargets": [0,1] }, { "bVisible": false, "aTargets": [6,7,8,9] } - ], - "oLanguage": (datatable_lang != "") ? - { - sUrl: "locale/"+lang+"/"+datatable_lang - } : "" + ] }); $('#datastore_search').keyup(function(){ diff --git a/src/sunstone/public/js/plugins/files-tab.js b/src/sunstone/public/js/plugins/files-tab.js index f2d32ea0b7..9807a2c693 100644 --- a/src/sunstone/public/js/plugins/files-tab.js +++ b/src/sunstone/public/js/plugins/files-tab.js @@ -150,7 +150,7 @@ var create_file_tmpl = \
\
\ -

'+tr("Advanced options")+'

\ +

'+tr("Advanced options")+'

\
\
\
\ @@ -319,16 +319,6 @@ var file_actions = { error: onError, notify: true }, - "File.clone_dialog" : { - type: "custom", - call: popUpFileCloneDialog - }, - "File.clone" : { - type: "single", - call: OpenNebula.Image.clone, - error: onError, - notify: true - }, "File.help" : { type: "custom", call: function() { @@ -386,11 +376,6 @@ var file_buttons = { layout: "more_select", text: tr("Disable") }, - "File.clone_dialog" : { - type: "action", - layout: "main", - text: tr("Clone") - }, "File.delete" : { type: "confirm", layout: "del", @@ -546,14 +531,6 @@ function updateFileInfo(request,img){ '+pretty_time(img_info.REGTIME)+'\ \ \ - \ - '+tr("Persistent")+'\ - '+(parseInt(img_info.PERSISTENT) ? tr("yes") : tr("no"))+'\ -
\ - \ -
\ - \ - \ \ '+tr("Filesystem type")+'\ '+(typeof img_info.FSTYPE === "string" ? img_info.FSTYPE : "--")+'\ @@ -633,26 +610,6 @@ function updateFileInfo(request,img){ Sunstone.runAction("File.showinfo", img_info.ID); }); - // Listener for edit link for persistency change - $("#div_edit_persistency").live("click", function() { - var value_str = $(".value_td_persistency").text(); - $(".value_td_persistency").html( - ''); - $('option[value="'+value_str+'"]').replaceWith(''); - }); - - $("#persistency_select").live("change", function() { - var new_value=$("option:selected", this).text(); - - if (new_value=="yes") - Sunstone.runAction("File.persistent",[img_info.ID]); - else - Sunstone.runAction("File.nonpersistent",[img_info.ID]); - - }); Sunstone.updateInfoPanelTab("file_info_panel","file_info_tab",info_tab); Sunstone.popUpInfoPanel("file_info_panel"); @@ -946,103 +903,10 @@ function is_persistent_file(id){ return $(data).is(':checked'); }; -function setupFileCloneDialog(){ - //Append to DOM - dialogs_context.append('
'); - var dialog = $('#file_clone_dialog',dialogs_context); - - //Put HTML in place - - var html = '
\ -

\ - '+tr("Clone File")+'\ -

\ -
\ -
\ -
\ -
\ -
'+tr("Several file are selected, please choose prefix to name the new copies")+':
\ -
\ -
\ -
\ -
\ - \ - \ -
\ -
\ - \ -
\ -
\ -
\ -
\ - \ - \ -
\ -×\ -
\ -'; - - dialog.html(html); - - //Convert into jQuery - //dialog.dialog({ - // autoOpen:false, - // width:375, - // modal:true, - // resizable:false - //}); - dialog.addClass("reveal-modal"); - - //$('button',dialog).button(); - - $('form',dialog).submit(function(){ - var name = $('input', this).val(); - var sel_elems = fileElements(); - if (!name || !sel_elems.length) - notifyError('A name or prefix is needed!'); - if (sel_elems.length > 1){ - for (var i=0; i< sel_elems.length; i++) - //If we are cloning several files we - //use the name as prefix - Sunstone.runAction('Image.clone', - sel_elems[i], - name+getFileName(sel_elems[i])); - } else { - Sunstone.runAction('Image.clone',sel_elems[0],name) - }; - dialog.trigger("reveal:close") - setTimeout(function(){ - Sunstone.runAction('Image.refresh'); - }, 1500); - return false; - }); -} - -function popUpFileCloneDialog(){ - var dialog = $('#file_clone_dialog'); - var sel_elems = fileElements(); - //show different text depending on how many elements are selected - if (sel_elems.length > 1){ - $('.clone_one',dialog).hide(); - $('.clone_several',dialog).show(); - $('input',dialog).val('Copy of '); - } - else { - $('.clone_one',dialog).show(); - $('.clone_several',dialog).hide(); - $('input',dialog).val('Copy of '+getFileName(sel_elems[0])); - }; - - $(dialog).reveal(); -} - //The DOM is ready at this point $(document).ready(function(){ dataTable_files = $("#datatable_files",main_tabs_context).dataTable({ - "sDom" : "<'H'>t<'row'<'six columns'i><'six columns'p>>", "oColVis": { "aiExclude": [ 0 ] }, @@ -1053,11 +917,7 @@ $(document).ready(function(){ { "sWidth": "100px", "aTargets": [5,7] }, { "sWidth": "150px", "aTargets": [8] }, { "bVisible": false, "aTargets": [6,8,9,11,12]} - ], - "oLanguage": (datatable_lang != "") ? - { - sUrl: "locale/"+lang+"/"+datatable_lang - } : "" + ] }); $('#file_search').keyup(function(){ @@ -1071,7 +931,6 @@ $(document).ready(function(){ setupCreateFileDialog(); setupTips($create_file_dialog); - setupFileCloneDialog(); setFileAutorefresh(); initCheckAllBoxes(dataTable_files); diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js index 9eebdf9109..baeb711940 100644 --- a/src/sunstone/public/js/plugins/groups-tab.js +++ b/src/sunstone/public/js/plugins/groups-tab.js @@ -265,14 +265,16 @@ var group_quotas_tmpl = '
\
\
\
\ -
\ + \ ×\ -'; +\ + '; var group_actions = { @@ -793,15 +795,10 @@ function setGroupAutorefresh(){ $(document).ready(function(){ dataTable_groups = $("#datatable_groups",main_tabs_context).dataTable({ - "sDom" : "<'H'>t<'row'<'six columns'i><'six columns'p>>", "aoColumnDefs": [ { "bSortable": false, "aTargets": ["check"] }, { "sWidth": "35px", "aTargets": [0,1] } - ], - "oLanguage": (datatable_lang != "") ? - { - sUrl: "locale/"+lang+"/"+datatable_lang - } : "" + ] }); //addElement([ diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js index 565d79f128..e2c24ef565 100644 --- a/src/sunstone/public/js/plugins/hosts-tab.js +++ b/src/sunstone/public/js/plugins/hosts-tab.js @@ -76,14 +76,13 @@ var hosts_tab_content = '\ '; var create_host_tmpl = -'
\ -
\ +'
\

\ '+tr("Create Host")+'\

\
\ -
\
\ + \
\
\ \ @@ -179,15 +178,17 @@ var create_host_tmpl =
\
\
\ -
\ + \ ×\ -
'; +\ +
'; var hosts_select=""; var dataTable_hosts; @@ -935,7 +936,7 @@ function setupCreateHostDialog(){ // modal: true, // width: 500 //}); - dialog.addClass("reveal-modal"); + dialog.addClass("reveal-modal max-height"); //$('button',dialog).button(); @@ -1037,7 +1038,6 @@ $(document).ready(function(){ //prepare host datatable dataTable_hosts = $("#datatable_hosts",main_tabs_context).dataTable({ - "sDom" : "<'H'>t<'row'<'six columns'i><'six columns'p>>", "oColVis": { //exclude checkbox column "aiExclude": [ 0 ] }, @@ -1045,11 +1045,7 @@ $(document).ready(function(){ //{ "bSortable": false, "aTargets": ["check"] }, { "sWidth": "35px", "aTargets": [0,1,4,9] }, //check, ID, RVMS, Status { "bVisible": false, "aTargets": [5,7,10,11,12]} - ], - "oLanguage": (datatable_lang != "") ? - { - sUrl: "locale/"+lang+"/"+datatable_lang - } : "" + ] }); $('#hosts_search').keyup(function(){ diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index a1feabf057..fee2154e52 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -27,7 +27,7 @@ var images_tab_content = '\ \ \ '+tr("TOTAL")+' \ - '+tr("SIZE")+'\ + '+tr("USED")+'\ \ \ @@ -70,10 +70,10 @@ var images_tab_content = '\ '; var create_image_tmpl = -'
\ -
\ + '
\

'+tr("Create Image")+'

\
\ +
\
\
\
'+tr("Wizard")+'
\ @@ -81,7 +81,6 @@ var create_image_tmpl =
\
    \
  • \ -
    \
    \
    \
    \ @@ -199,7 +198,7 @@ var create_image_tmpl = \
    \
    \ -

    '+tr("Advanced options")+'

    \ +

    '+tr("Advanced options")+'

    \
    \
    \
    \ @@ -254,13 +253,14 @@ var create_image_tmpl =
    \
    \
    \ -
    \ -
    \ + \
  • \
  • \
    \ @@ -270,12 +270,14 @@ var create_image_tmpl = \ \
    \ + \
  • \
\ ×\ @@ -826,7 +828,7 @@ function setupCreateImageDialog(){ // width: 520, // height: height //}); - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); $('.advanced',dialog).hide(); @@ -1251,7 +1253,6 @@ function popUpImageCloneDialog(){ $(document).ready(function(){ dataTable_images = $("#datatable_images",main_tabs_context).dataTable({ - "sDom" : "<'H'>t<'row'<'six columns'i><'six columns'p>>", "oColVis": { "aiExclude": [ 0 ] }, @@ -1262,11 +1263,7 @@ $(document).ready(function(){ { "sWidth": "100px", "aTargets": [5,7] }, { "sWidth": "150px", "aTargets": [8] }, { "bVisible": false, "aTargets": [6,8,12]} - ], - "oLanguage": (datatable_lang != "") ? - { - sUrl: "locale/"+lang+"/"+datatable_lang - } : "" + ] }); $('#image_search').keyup(function(){ diff --git a/src/sunstone/public/js/plugins/marketplace-tab.js b/src/sunstone/public/js/plugins/marketplace-tab.js index 2afcd1ced2..33cb596b2a 100644 --- a/src/sunstone/public/js/plugins/marketplace-tab.js +++ b/src/sunstone/public/js/plugins/marketplace-tab.js @@ -285,7 +285,6 @@ function onlyOneCheckboxListener(dataTable) { $(document).ready(function(){ dataTable_marketplace = $("#datatable_marketplace", main_tabs_context).dataTable({ "bSortClasses": true, - "sDom" : "<'H'>t<'row'<'six columns'i><'six columns'p>>", "aoColumns": [ { "bSortable": false, "mData": function ( o, val, data ) { @@ -304,11 +303,7 @@ $(document).ready(function(){ { "mDataProp": "files.0.os-arch", "sWidth" : "100px"}, { "mDataProp": "files.0.format", "sWidth" : "100px"}, { "mDataProp": "tags", "bVisible": false} - ], - "oLanguage": (datatable_lang != "") ? - { - sUrl: "locale/"+lang+"/"+datatable_lang - } : "" + ] }); diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index 9436f989b3..7b7a5c8ff1 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -69,9 +69,9 @@ var templates_tab_content = '\ var create_template_tmpl = '
'+ '

'+tr("Create VM Template")+'

'+ '
'+ + '
'+ ''+ - '
'+ - '
'+ + '
'+ '
'+ '
'+ '
'+ @@ -81,8 +81,7 @@ var create_template_tmpl = '
'+ ''+ '
'+ '
'+ - '
'+ - '
'+ + ''; var update_template_tmpl = @@ -554,7 +554,7 @@ function generate_capacity_tab_content() { '
'+ '
'+ '
'+ - '

'+tr("Advanced options")+'

'+ + '

'+tr("Advanced options")+'

'+ '
'+ '
'+ '
'+ @@ -789,7 +789,7 @@ function generate_disk_tab_content(str_disk_tab_id, str_datatable_id){ '
'+ '
'+ '
'+ - '

'+tr("Advanced options")+'

'+ + '

'+tr("Advanced options")+'

'+ '
'+ '
'+ '
'+ @@ -873,7 +873,7 @@ function generate_disk_tab_content(str_disk_tab_id, str_datatable_id){ '
'+ '
'+ '
'+ - '

'+tr("Advanced options")+''+ + '

'+tr("Advanced options")+''+ '

'+ '
'+ '
'+ @@ -1141,7 +1141,7 @@ function generate_nic_tab_content(str_nic_tab_id, str_datatable_id){ '
'+ '
'+ '
'+ - '

'+tr("Advanced options")+'

'+ + '

'+tr("Advanced options")+'

'+ '
'+ '
'+ '
'+ @@ -1150,7 +1150,7 @@ function generate_nic_tab_content(str_nic_tab_id, str_datatable_id){ '
'+ ''+ '
'+ - '
'+ + '
'+ ''+ '
'+ '
'+ @@ -1163,7 +1163,7 @@ function generate_nic_tab_content(str_nic_tab_id, str_datatable_id){ '
'+ ''+ '
'+ - '
'+ + '
'+ ''+ '
'+ '
'+ @@ -1193,7 +1193,7 @@ function generate_nic_tab_content(str_nic_tab_id, str_datatable_id){ ''+ '
'+ '
'+ - '
'+tr("A list of ports separated by commas or a ranges separated by semilocolons, e.g.: 22,80,5900:6000")+'
'+ + '
'+tr("A list of ports separated by commas or a ranges separated by semicolons, e.g.: 22,80,5900:6000")+'
'+ '
'+ '
'+ ''+ @@ -1218,7 +1218,7 @@ function generate_nic_tab_content(str_nic_tab_id, str_datatable_id){ ''+ '
'+ '
'+ - '
'+tr("A list of ports separated by commas or a ranges separated by semilocolons, e.g.: 22,80,5900:6000")+'
'+ + '
'+tr("A list of ports separated by commas or a ranges separated by semicolons, e.g.: 22,80,5900:6000")+'
'+ '
'+ '
'+ ''+ @@ -2997,7 +2997,7 @@ function setupCreateTemplateDialog(){ // width: 'auto', // height: height //}); - dialog.addClass("reveal-modal xlarge") + dialog.addClass("reveal-modal xlarge max-height") var tabs = $( "#template_create_tabs", dialog)//.tabs().addClass("ui-tabs-vertical"); @@ -4153,12 +4153,9 @@ $(document).ready(function(){ "oColVis": { "aiExclude": [ 0 ] }, - "sDom" : "<'H'>t<'row'<'six columns'i><'six columns'p>>", "aoColumnDefs": [ { "bSortable": false, "aTargets": ["check"] }, { "sWidth": "35px", "aTargets": [0,1] }, - { "sWidth": "150px", "aTargets": [5] }, - { "sWidth": "100px", "aTargets": [2,3] } ] }); diff --git a/src/sunstone/public/js/plugins/users-tab.js b/src/sunstone/public/js/plugins/users-tab.js index f60d01c634..b5eb0a3b6a 100644 --- a/src/sunstone/public/js/plugins/users-tab.js +++ b/src/sunstone/public/js/plugins/users-tab.js @@ -339,14 +339,16 @@ var user_quotas_tmpl = '
\
\
\
\ -
\ + \ ×\ -'; +\ +
'; var user_actions = { @@ -1166,7 +1168,6 @@ function setUserAutorefresh(){ $(document).ready(function(){ //if we are not oneadmin, our tab will not even be in the DOM. dataTable_users = $("#datatable_users",main_tabs_context).dataTable({ - "sDom" : "<'H'>t<'row'<'six columns'i><'six columns'p>>", "oColVis": { "aiExclude": [ 0 ] }, @@ -1174,11 +1175,7 @@ $(document).ready(function(){ { "bSortable": false, "aTargets": ["check"] }, { "sWidth": "35px", "aTargets": [0,1] }, { "bVisible": false, "aTargets": [8]} - ], - "oLanguage": (datatable_lang != "") ? - { - sUrl: "locale/"+lang+"/"+datatable_lang - } : "" + ] }); $('#user_search').keyup(function(){ diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index 9cba9de762..d61b859df9 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -371,6 +371,33 @@ var vm_actions = { notify: true }, + "VM.poweroff_hard" : { + type: "multiple", + call: OpenNebula.VM.poweroff_hard, + callback: vmShow, + elements: vmElements, + error: onError, + notify: true + }, + + "VM.undeploy" : { + type: "multiple", + call: OpenNebula.VM.undeploy, + callback: vmShow, + elements: vmElements, + error: onError, + notify: true + }, + + "VM.undeploy_hard" : { + type: "multiple", + call: OpenNebula.VM.undeploy_hard, + callback: vmShow, + elements: vmElements, + error: onError, + notify: true + }, + "VM.saveas" : { type: "single", call: OpenNebula.VM.saveas, @@ -754,45 +781,63 @@ var vm_buttons = { "VM.suspend" : { type: "confirm", text: tr("Suspend"), - layout: "vmsstopresume_buttons", + layout: "vmspause_buttons", tip: tr("This will suspend selected machines") }, "VM.resume" : { type: "confirm", - text: tr("Resume"), - layout: "vmsstopresume_buttons", + text: '', + layout: "vmsplay_buttons", tip: tr("This will resume selected stopped or suspended VMs") }, "VM.stop" : { type: "confirm", text: tr("Stop"), - layout: "vmsstopresume_buttons", + layout: "vmsstop_buttons", tip: tr("This will stop selected VMs") }, "VM.restart" : { type: "confirm", text: tr("Boot"), - layout: "vmsoneoff_buttons", + layout: "vmsplanification_buttons", tip: tr("This will redeploy selected VMs (in UNKNOWN or BOOT state)") }, "VM.reboot" : { type : "confirm", text: tr("Reboot"), - layout: "vmsoneoff_buttons", + layout: "vmsrepeat_buttons", tip: tr("This will send a reboot action to running VMs") }, "VM.reset" : { type: "confirm", text: tr("Reboot") + ' hard', - layout: "vmsoneoff_buttons", + layout: "vmsrepeat_buttons", tip: tr("This will perform a hard reboot on selected VMs") }, "VM.poweroff" : { type : "confirm", text: tr("Power Off"), - layout: "vmsoneoff_buttons", + layout: "vmspause_buttons", tip: tr("This will send a power off signal to running VMs. They can be restarted later.") }, + "VM.poweroff_hard" : { + type : "confirm", + text: tr("Power Off") + ' hard', + layout: "vmspause_buttons", + tip: tr("This will send a power off signal to running VMs. They can be restarted later.") + }, + "VM.undeploy" : { + type : "confirm", + text: tr("Undeploy"), + layout: "vmsstop_buttons", + tip: tr("Shuts down the given VM. The VM is saved in the system Datastore.") + }, + "VM.undeploy_hard" : { + type : "confirm", + text: tr("Undeploy") + ' hard', + layout: "vmsstop_buttons", + tip: tr("Shuts down the given VM. The VM is saved in the system Datastore.") + }, "VM.shutdown" : { type: "confirm", text: tr("Shutdown"), @@ -815,7 +860,7 @@ var vm_buttons = { "VM.resubmit" : { type: "confirm", text: tr("Destroy") + ' recreate', - layout: "vmsdelete_buttons", + layout: "vmsrepeat_buttons", tip: tr("This will resubmits VMs to PENDING state") }, @@ -1138,6 +1183,7 @@ function generatePlacementTable(vm){ \ '+tr("#")+'\ '+tr("Host")+'\ + '+tr("Action")+'\ '+tr("Reason")+'\ '+tr("Chg time")+'\ '+tr("Total time")+'\ @@ -1180,9 +1226,10 @@ function generatePlacementTable(vm){ html += ' \ - '+history[i].SEQ+'\ + '+history[i].SEQ+'\ '+history[i].HOSTNAME+'\ - '+OpenNebula.Helper.resource_state("VM_MIGRATE_REASON",parseInt(history[i].REASON, 10))+'\ + '+OpenNebula.Helper.resource_state("VM_MIGRATE_ACTION",parseInt(history[i].ACTION, 10))+'\ + '+OpenNebula.Helper.resource_state("VM_MIGRATE_REASON",parseInt(history[i].REASON, 10))+'\ '+pretty_time(history[i].STIME)+'\ '+pretty_time_runtime(dtime)+'\ '+pretty_time_runtime(dtime2)+'\ @@ -1313,8 +1360,7 @@ function updateVMInfo(request,vm){ var template_tab = { title: tr("Template"), content: - '\ - '+ + '
'+tr("VM template")+'
'+ prettyPrintJSON(vm_info.TEMPLATE)+ '
' }; @@ -1459,6 +1505,9 @@ function printActionsTable(vm_info) \ \ \ + \ + \ + \ \ \ \ @@ -1969,8 +2018,8 @@ function setupAttachDiskDialog(){ '+tr("Attach new disk")+'\ \
\ -
\
\ + \
\
\ \ @@ -1983,16 +2032,17 @@ function setupAttachDiskDialog(){
\
' + generate_disk_tab_content("attach_disk", "attach_disk") + - '
\ + '\ ×\ -
') +
') - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); setupTips(dialog); setup_disk_tab_content(dialog, "attach_disk", "attach_disk") @@ -2232,8 +2282,8 @@ function setupAttachNicDialog(){ '+tr("Attach new nic")+'\ \
\ -
\
\ + \
\
\ \ @@ -2246,16 +2296,17 @@ function setupAttachNicDialog(){
\
' + generate_nic_tab_content("attach_nic", "attach_nic") + - '
\ + '\ ×\ -
') +
') - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); setupTips(dialog); setup_nic_tab_content(dialog, "attach_nic", "attach_nic") @@ -2405,6 +2456,7 @@ function setupResizeCapacityDialog(){ '+tr("Resize VM capacity")+'\ \
\ +
\
\
\
\ @@ -2432,15 +2484,17 @@ function setupResizeCapacityDialog(){
\
' + generate_capacity_tab_content() + - '
\ + '\ ×\ -
') +
') - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); setupTips(dialog); $("#template_name_form", dialog).hide(); @@ -2844,9 +2898,11 @@ function setupVNC(){
\ \ \ +
\ \ '+tr("Canvas not supported.")+'\ \ +
\ ×\ \ '); @@ -2859,7 +2915,7 @@ function setupVNC(){ // resizable:true, // closeOnEscape: false //}); - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); $('#sendCtrlAltDelButton',dialog).click(function(){ rfb.sendCtrlAltDel(); @@ -2902,11 +2958,13 @@ function vncIcon(vm){ if (graphics && graphics.TYPE.toLowerCase() == "vnc" && $.inArray(state, VNCstates)!=-1){ gr_icon = ''; - gr_icon += '\"'+tr("Open'; + gr_icon += ''; } else { - gr_icon = '\"'+tr("VNC'; + gr_icon = ''; } + + gr_icon += '' return gr_icon; } @@ -2925,7 +2983,6 @@ function vmMonitorError(req,error_json){ $(document).ready(function(){ dataTable_vMachines = $("#datatable_vmachines",main_tabs_context).dataTable({ - "sDom" : "<'H'>t<'row'<'six columns'i><'six columns'p>>", "oColVis": { "aiExclude": [ 0 ] }, @@ -2933,17 +2990,15 @@ $(document).ready(function(){ { "bSortable": false, "aTargets": ["check"] }, { "sWidth": "35px", "aTargets": [0,1] }, { "bVisible": false, "aTargets": [6,7,10]} - ], - "oLanguage": (datatable_lang != "") ? - { - sUrl: "locale/"+lang+"/"+datatable_lang - } : "" + ] }); $('#vms_search').keyup(function(){ - dataTable_templates.fnFilter( $(this).val() ); + dataTable_vMachines.fnFilter( $(this).val() ); }) + + //addElement([ // spinner, // '','','','','','','','','','',''],dataTable_vMachines); diff --git a/src/sunstone/public/js/plugins/vnets-tab.js b/src/sunstone/public/js/plugins/vnets-tab.js index b53a3d2d1a..d60ca2e962 100644 --- a/src/sunstone/public/js/plugins/vnets-tab.js +++ b/src/sunstone/public/js/plugins/vnets-tab.js @@ -27,7 +27,7 @@ var vnets_tab_content = '\
\ \ '+tr("TOTAL")+' \ - '+tr("ADDRESSES")+'\ + '+tr("USED IPs")+'\ \ \ @@ -66,12 +66,12 @@ var vnets_tab_content = '\ '; var create_vn_tmpl = -'
\ -
\ +'
\

\ '+tr("Create Virtual Network")+'\

\
\ +
\
\
'+tr("Wizard")+'
\
'+tr("Advanced mode")+'
\ @@ -79,7 +79,6 @@ var create_vn_tmpl =
    \
  • \
    \ -
    \
    \
    \ \ @@ -317,7 +316,7 @@ var create_vn_tmpl =
    \ \
    \ -
    \ + \
    \
  • \
  • \
    \ -
    \

    '+tr("Write the Virtual Network template here")+'

    \ \ -
    \ + \
    \
  • \
\ - ×\ -
'; +
\ + ×'; var update_vnet_tmpl = '
\ @@ -972,7 +972,7 @@ function setupCreateVNetDialog() { // width: 475, // height: height //}); - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); //Make the tabs look nice for the creation mode //$('#vn_tabs',dialog).tabs(); @@ -1320,18 +1320,13 @@ function setVNetAutorefresh() { $(document).ready(function(){ dataTable_vNetworks = $("#datatable_vnetworks",main_tabs_context).dataTable({ - "sDom" : "<'H'>t<'row'<'six columns'i><'six columns'p>>", "oColVis": { "aiExclude": [ 0 ] }, "aoColumnDefs": [ { "sWidth": "35px", "aTargets": [0,1] }, { "bVisible": false, "aTargets": [7]} - ], - "oLanguage": (datatable_lang != "") ? - { - sUrl: "locale/"+lang+"/"+datatable_lang - } : "" + ] }); $('#vnet_search').keyup(function(){ diff --git a/src/sunstone/public/js/sunstone-util.js b/src/sunstone/public/js/sunstone-util.js index 364daf2c12..d47df2fa5d 100644 --- a/src/sunstone/public/js/sunstone-util.js +++ b/src/sunstone/public/js/sunstone-util.js @@ -341,9 +341,9 @@ function prettyPrintRowJSON(field,value,padding,weight, border_bottom,padding_to function initCheckAllBoxes(datatable){ //small css hack - $('input.check_all',datatable).css({"border":"2px"}); - $('input.check_all',datatable).live("change",function(){ - var table = $(this).parents('table'); + $('input.check_all').css({"border":"2px"}); + $('input.check_all').live("change",function(){ + var table = $(this).closest('.dataTables_wrapper'); var checked = $(this).attr('checked'); if (checked) { //check all $('tbody input.check_item',table).attr('checked','checked'); @@ -443,7 +443,7 @@ function onError(request,error_json) { //Used when refreshing elements of a datatable. function waitingNodes(dataTable){ $('tr input.check_item:visible',dataTable).replaceWith(spinner); - recountCheckboxes(dataTable); + //recountCheckboxes(dataTable); } @@ -1112,7 +1112,7 @@ function setupQuotasDialog(dialog){ // width: 740, // height: height //}); - dialog.addClass("reveal-modal xlarge") + dialog.addClass("reveal-modal xlarge max-height") //$('button',dialog).button(); $('#vm_quota,#datastore_quota,#image_quota,#network_quota',dialog).hide(); diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index 0069a7c118..5f55039387 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -582,19 +582,21 @@ function insertButtonsInTab(tab_name){ "
"+ '
'+ '
    '+ - '
  • '+ + '
  • '+ "
    "+ ""+ "
    "+ '
  • '+ - '
  • '+ + '
'+ + '
    '+ + '
  • '+ "
    "+ ""+ @@ -609,15 +611,34 @@ function insertButtonsInTab(tab_name){ "
    "+ "
"+ ''+ - '
  • '+ + ''+ + '
      '+ + '
    • '+ + "
      "+ + "
      "+ + "
      "+ + "
      "+ + '
    • '+ + '
    • '+ "
      "+ ""+ "
      "+ '
    • '+ + '
    • '+ + "
      "+ + ""+ + "
      "+ + '
    • '+ + '
    '+ + '
      '+ '
    • '+ "
      "+ "
        "+ @@ -703,13 +724,24 @@ function insertButtonsInTab(tab_name){ str_class.push("secondary", "button", "small", "radius"); button_code = '
      • '; break; - case "vmsstopresume_buttons": - context = $("#vmsstopresume_buttons ul", buttons_row); + case "vmsplay_buttons": + context = $("#vmsplay_buttons", buttons_row); + text = button.text; + str_class.push("secondary", "button", "small", "radius"); + button_code = ''; + break; + case "vmspause_buttons": + context = $("#vmspause_buttons ul", buttons_row); text = button.text; button_code = '
      • '+text+'
      • '; break; - case "vmsplanification_buttons": - context = $("#vmsplanification_buttons ul", buttons_row); + case "vmsstop_buttons": + context = $("#vmsstop_buttons ul", buttons_row); + text = button.text; + button_code = '
      • '+text+'
      • '; + break; + case "vmsrepeat_buttons": + context = $("#vmsrepeat_buttons ul", buttons_row); text = button.text; button_code = '
      • '+text+'
      • '; break; @@ -718,8 +750,8 @@ function insertButtonsInTab(tab_name){ text = button.text; button_code = '
      • '+text+'
      • '; break; - case "vmsoneoff_buttons": - context = $("#vmsoneoff_buttons ul", buttons_row); + case "vmsplanification_buttons": + context = $("#vmsplanification_buttons ul", buttons_row); text = button.text; button_code = '
      • '+text+'
      • '; break; @@ -769,12 +801,16 @@ function insertButtonsInTab(tab_name){ $("#vmsdelete_buttons", action_block).remove() } - if ($("#vmsoneoff_buttons ul li", action_block).length == 0 ) { - $("#vmsoneoff_buttons", action_block).remove() + if ($("#vmsstop_buttons ul li", action_block).length == 0 ) { + $("#vmsstop_buttons", action_block).remove() } - if ($("#vmsstopresume_buttons ul li", action_block).length == 0 ) { - $("#vmsstopresume_buttons", action_block).remove() + if ($("#vmspause_buttons ul li", action_block).length == 0 ) { + $("#vmspause_buttons", action_block).remove() + } + + if ($("#vmsrepeat_buttons ul li", action_block).length == 0 ) { + $("#vmsrepeat_buttons", action_block).remove() } if ($("#user_buttons ul li", action_block).length == 0 ) { @@ -880,7 +916,7 @@ function setupConfirmDialogs(){
        \
        \ \ - \ + \
        \ ×\ '); @@ -920,7 +956,7 @@ function setupConfirmDialogs(){
        \
        \ \ - \ + \
        \ ×\ '); diff --git a/src/sunstone/public/sass/app.scss b/src/sunstone/public/sass/app.scss index e69d9d6d3e..6e5081acb9 100644 --- a/src/sunstone/public/sass/app.scss +++ b/src/sunstone/public/sass/app.scss @@ -157,7 +157,6 @@ div.button-bar { #logo { font-weight: bold; - margin:10%; margin-top: 15%; margin-bottom: 10%; } @@ -224,7 +223,7 @@ div.button-bar { } #navigation { - margin: 8%;; + margin: 0 8%; box-shadow: 0 0 1px 0px black; } @@ -264,15 +263,23 @@ div.button-bar { } #navigation li:not(subTab) { - border-left: 5px solid #f2f2f2 !important; + border-left: 5px solid #f2f2f2; +} + +#navigation li:not(subTab):hover { + border-left: 5px solid #e2e2e2 ; } #navigation li.subTab:not(.navigation-active-li) { - border-left: 5px solid #fdfdfd !important; + border-left: 5px solid #fdfdfd; } -#navigation li:hover { - font-weight: bold; +#navigation li.subTab:not(.navigation-active-li):hover { + border-left: 5px solid #e2e2e2 ; +} + +#navigation a:hover { + background: #e2e2e2 !important; } #navigation .navigation-active-li { @@ -281,6 +288,7 @@ div.button-bar { + /* top menu css */ #menutop_container{ margin:0px 171px; @@ -614,7 +622,8 @@ small { .button.dropdown.small::after { - border-color: #2f2f2f transparent transparent transparent; + border-color: #9f9f9f transparent transparent transparent; + border-width: 4px; } .footer-opennebula { @@ -729,12 +738,28 @@ a.footer.button { } .reveal-body { - max-height: 360px; - overflow-y: auto; + height:80%; + overflow-y: overlay; overflow-x: hidden; - padding: 5px; + padding: 5px 20px; } +.reveal-footer { + position: absolute; + bottom: 20px; + width: 90%; +} + +.max-height{ + max-height: 85%; + position: absolute; + height: 100%; +} + +.ui-layout-content { + overflow-y: overlay; + overflow-x: hidden; +} // time-picker @@ -790,4 +815,25 @@ div.time-picker li.selected { form { margin: 0 !important; -} \ No newline at end of file +} + +#template_create_tabs { + //position: fixed; + width: 180px; +} + +.dataTables_scrollHead { + height: 30px; +} + +.dataTables_scrollBody { + margin-top: -3px; +} + +.show_hide { + cursor: pointer; +} + +.show_hide:hover > h4 > small { + color: #6f6f6f !important; +} diff --git a/src/sunstone/public/vendor/4.0/foundation_datatables/javascripts/datatables.foundation.js b/src/sunstone/public/vendor/4.0/foundation_datatables/javascripts/datatables.foundation.js index 31f10e269e..8b9e22d126 100644 --- a/src/sunstone/public/vendor/4.0/foundation_datatables/javascripts/datatables.foundation.js +++ b/src/sunstone/public/vendor/4.0/foundation_datatables/javascripts/datatables.foundation.js @@ -1,12 +1,13 @@ /* Set the defaults for DataTables initialisation */ $.extend( true, $.fn.dataTable.defaults, { - "sDom": "<'row'<'six columns'l><'six columns'f>r><'row'<'twelve columns't>><'row'<'six columns'i><'six columns'p>>", + "sDom": "<'H'>t<'row'<'four columns'l><'six columns'p>>", "sPaginationType": "foundation", "oLanguage": { - "sLengthMenu": 'Show
        entries' + "sLengthMenu": ' rows' } } ); + /* API method to get paging information */ $.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings ) { @@ -34,14 +35,18 @@ $.extend( $.fn.dataTableExt.oPagination, { }; $(nPaging).addClass('pagination').append( - '
          '+ - '
        • « '+oLang.sPrevious+'
        • '+ - '
        • '+oLang.sNext+' »
        • '+ + '
            ' + + '' + + ''+ + '' + + '' + '
          ' ); var els = $('a', nPaging); - $(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler ); - $(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler ); + $(els[0]).bind('click.DT', { action: "first" }, fnClickHandler); + $(els[1]).bind( 'click.DT', { action: "previous" }, fnClickHandler ); + $(els[2]).bind('click.DT', { action: "next" }, fnClickHandler); + $(els[3]).bind('click.DT', { action: "last" }, fnClickHandler); }, "fnUpdate": function ( oSettings, fnDraw ) { @@ -67,31 +72,31 @@ $.extend( $.fn.dataTableExt.oPagination, { for ( i=0, iLen=an.length ; i'+j+'') - .insertBefore( $('li:last', an[i])[0] ) + .insertBefore( $('li.next:first', an[i])[0] ) .bind('click', function (e) { e.preventDefault(); oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength; fnDraw( oSettings ); }); } - + // Add / remove disabled classes from the static elements if ( oPaging.iPage === 0 ) { - $('li:first', an[i]).addClass('unavailable'); + $('li.prev', an[i]).addClass('unavailable'); } else { - $('li:first', an[i]).removeClass('unavailable'); + $('li.prev', an[i]).removeClass('unavailable'); } if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) { - $('li:last', an[i]).addClass('unavailable'); + $('li.next', an[i]).addClass('unavailable'); } else { - $('li:last', an[i]).removeClass('unavailable'); + $('li.next', an[i]).removeClass('unavailable'); } } } diff --git a/src/sunstone/public/vendor/4.0/jquery_layout/layout-default-latest.css b/src/sunstone/public/vendor/4.0/jquery_layout/layout-default-latest.css index 14e507b51d..ba4df7fffd 100644 --- a/src/sunstone/public/vendor/4.0/jquery_layout/layout-default-latest.css +++ b/src/sunstone/public/vendor/4.0/jquery_layout/layout-default-latest.css @@ -42,7 +42,7 @@ body { .ui-layout-content { padding: 10px; position: relative; /* contain floated or positioned elements */ - overflow: auto; /* add scrolling to content-div */ + overflow: overlay; /* add scrolling to content-div */ } /* diff --git a/src/sunstone/views/_login_standard.erb b/src/sunstone/views/_login_standard.erb index da26dc91da..50af211cfe 100644 --- a/src/sunstone/views/_login_standard.erb +++ b/src/sunstone/views/_login_standard.erb @@ -2,8 +2,7 @@
          -
          -
          +
          @@ -17,8 +16,10 @@ retrieving -
          +
  • diff --git a/src/sunstone/views/_login_x509.erb b/src/sunstone/views/_login_x509.erb index 96150cd191..1e19ba1582 100644 --- a/src/sunstone/views/_login_x509.erb +++ b/src/sunstone/views/_login_x509.erb @@ -2,13 +2,6 @@
    -
    - Invalid username or password -
    -
    - OpenNebula is not running -
    -
    @@ -17,6 +10,10 @@
    +
    diff --git a/src/sunstone/views/index.erb b/src/sunstone/views/index.erb index 51eb7d924c..ccd1eac86c 100644 --- a/src/sunstone/views/index.erb +++ b/src/sunstone/views/index.erb @@ -86,7 +86,9 @@