1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-08 21:17:43 +03:00

M #-: Add default zone in federation (#2433)

This commit is contained in:
Jorge Miguel Lobo Escalona 2023-01-05 14:35:16 +01:00 committed by GitHub
parent 18f9137de2
commit 4f71e1f266
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -42,3 +42,9 @@ debug_level: 2
guacd:
port: 4822
host: 'localhost'
# Local zone in a Federation setup
# This attribute must point to the Zone ID of the local OpenNebula to which this FireEdge belongs to.
default_zone:
id: 0
name: OpenNebula

View File

@ -136,12 +136,13 @@ const validateSession = ({
/**
* Get Zone.
*
* @param {string} zone - zone id
* @param {string} selectedZone - zone id
* @returns {object} data zone
*/
const getZone = (zone = '0') => {
const getZone = (selectedZone) => {
// get fireedge config
const appConfig = getFireedgeConfig()
const zone = selectedZone || appConfig?.default_zone?.id || '0'
// set first zone
if (
appConfig.one_xmlrpc &&
@ -149,6 +150,13 @@ const getZone = (zone = '0') => {
defaultOpennebulaZones[0] &&
defaultOpennebulaZones[0].rpc
) {
if (
appConfig.default_zone?.id &&
appConfig.default_zone?.name &&
appConfig.default_zone?.endpoint
) {
defaultOpennebulaZones[0] = appConfig.default_zone
}
defaultOpennebulaZones[0].rpc = appConfig.one_xmlrpc
if (appConfig.subscriber_endpoint) {
defaultOpennebulaZones[0].zeromq = appConfig.subscriber_endpoint