diff --git a/src/datastore_mad/remotes/fs/cp b/src/datastore_mad/remotes/fs/cp index a97cd5c345..f0cf44c308 100755 --- a/src/datastore_mad/remotes/fs/cp +++ b/src/datastore_mad/remotes/fs/cp @@ -175,6 +175,12 @@ else fi FORMAT=$($QEMU_IMG info $DST | grep "^file format:" | awk '{print $3}' || :) + + if [ -z $FORMAT ]; then + rm -rf $DST + log_error "Unknown image format src=$SRC" + exit -1 + fi fi [[ "$FORMAT" = "luks" ]] && FORMAT="raw" diff --git a/src/datastore_mad/remotes/fs/rm b/src/datastore_mad/remotes/fs/rm index 0050e399ef..f01fb3ed9b 100755 --- a/src/datastore_mad/remotes/fs/rm +++ b/src/datastore_mad/remotes/fs/rm @@ -63,7 +63,7 @@ if [ -n "$BRIDGE_LIST" ]; then "Error deleting $SRC in $DST_HOST" else BASENAME_SRC=`basename "${SRC##$REMOTE_RM_CMD}"` - if [ -f "$SRC" -a `dirname "$SRC"` = "$BASE_PATH" -a -n "$BASENAME_SRC" ] + if [ -e "$SRC" -a `dirname "$SRC"` = "$BASE_PATH" -a -n "$BASENAME_SRC" ] then log "Removing $SRC from the image repository" diff --git a/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/CommonFields.js b/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/CommonFields.js index fcbfdebdc8..2bfa0a5ed3 100644 --- a/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/CommonFields.js +++ b/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/CommonFields.js @@ -16,7 +16,7 @@ import { string, number } from 'yup' import { INPUT_TYPES, T, HYPERVISORS, Field } from 'client/constants' -const { kvm, vcenter, firecracker, lxc } = HYPERVISORS +const { vcenter, firecracker, lxc } = HYPERVISORS /** @type {Field[]} List of general fields */ export const GENERAL_FIELDS = [ @@ -126,7 +126,7 @@ export const VCENTER_FIELDS = [ { name: 'VCENTER_ADAPTER_TYPE', label: T.BusAdapterController, - notOnHypervisors: [kvm, firecracker], + onlyOnHypervisors: [vcenter], type: INPUT_TYPES.SELECT, values: [ { text: '', value: '' }, @@ -140,7 +140,7 @@ export const VCENTER_FIELDS = [ { name: 'VCENTER_DISK_TYPE', label: T.DiskProvisioningType, - notOnHypervisors: [kvm, firecracker], + onlyOnHypervisors: [vcenter], type: INPUT_TYPES.SELECT, values: [ { text: '', value: '' }, diff --git a/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/ImageSteps/AdvancedOptions/index.js b/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/ImageSteps/AdvancedOptions/index.js index 5049e81d1b..07efe2283b 100644 --- a/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/ImageSteps/AdvancedOptions/index.js +++ b/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/ImageSteps/AdvancedOptions/index.js @@ -60,7 +60,7 @@ const Content = ({ hypervisor }) => { const AdvancedOptions = ({ hypervisor } = {}) => ({ id: STEP_ID, label: T.AdvancedOptions, - resolver: () => SCHEMA(hypervisor), + resolver: SCHEMA(hypervisor), optionsValidate: { abortEarly: false }, content: () => Content({ hypervisor }), }) diff --git a/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/VolatileSteps/AdvancedOptions/index.js b/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/VolatileSteps/AdvancedOptions/index.js index b08f0a25d3..f5927b9929 100644 --- a/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/VolatileSteps/AdvancedOptions/index.js +++ b/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/VolatileSteps/AdvancedOptions/index.js @@ -60,7 +60,7 @@ const Content = ({ hypervisor }) => { const AdvancedOptions = ({ hypervisor } = {}) => ({ id: STEP_ID, label: T.AdvancedOptions, - resolver: () => SCHEMA(hypervisor), + resolver: SCHEMA(hypervisor), optionsValidate: { abortEarly: false }, content: () => Content({ hypervisor }), }) diff --git a/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/VolatileSteps/BasicConfiguration/index.js b/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/VolatileSteps/BasicConfiguration/index.js index 7faf7545b8..c3ac924973 100644 --- a/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/VolatileSteps/BasicConfiguration/index.js +++ b/src/fireedge/src/client/components/Forms/Vm/AttachDiskForm/VolatileSteps/BasicConfiguration/index.js @@ -42,7 +42,7 @@ const Content = ({ hypervisor }) => { const BasicConfiguration = ({ hypervisor } = {}) => ({ id: STEP_ID, label: T.Configuration, - resolver: () => SCHEMA(hypervisor), + resolver: SCHEMA(hypervisor), optionsValidate: { abortEarly: false }, content: () => Content({ hypervisor }), }) diff --git a/src/fireedge/src/client/components/HOC/AuthLayout.js b/src/fireedge/src/client/components/HOC/AuthLayout.js index c95f7e97a1..b283079de2 100644 --- a/src/fireedge/src/client/components/HOC/AuthLayout.js +++ b/src/fireedge/src/client/components/HOC/AuthLayout.js @@ -69,7 +69,7 @@ const AuthLayout = ({ subscriptions = [], children }) => { useEffect(() => { if (!jwt) { - const token = findStorageData(JWT_NAME) || findExternalToken() + const token = findExternalToken() || findStorageData(JWT_NAME) token && changeJwt(token) && storage(JWT_NAME, token) } diff --git a/src/fireedge/src/client/components/Tables/Enhanced/Utils/utils.js b/src/fireedge/src/client/components/Tables/Enhanced/Utils/utils.js index 7f7b9eb966..79adde6c5d 100644 --- a/src/fireedge/src/client/components/Tables/Enhanced/Utils/utils.js +++ b/src/fireedge/src/client/components/Tables/Enhanced/Utils/utils.js @@ -49,8 +49,7 @@ export const createColumns = ({ filters = {}, columns = [] }) => { ...((filterById || filterByAccessor) && ( { - // TODO: Add label to filters - // label: createLabelFilter, + // TODO: Implements time filter component time: createTimeFilter, }[`${id}`.toLowerCase()] ?? createCategoryFilter )(column)), diff --git a/src/fireedge/src/client/models/Helper.js b/src/fireedge/src/client/models/Helper.js index 97cde2a887..3b46d0b650 100644 --- a/src/fireedge/src/client/models/Helper.js +++ b/src/fireedge/src/client/models/Helper.js @@ -288,9 +288,18 @@ export const getActionsAvailable = (actions = {}, hypervisor = '') => .filter(([_, action]) => { if (typeof action === 'boolean') return action - const { enabled = false, not_on: notOn = [] } = action || {} + const { + enabled = false, + not_on: notOn = [], + only_on: onlyOn = [], + } = action || {} - return !!enabled && !notOn?.includes?.(hypervisor) + return ( + !!enabled && + ((!notOn && !onlyOn) || + (notOn && !notOn?.includes?.(hypervisor)) || + onlyOn?.includes?.(hypervisor)) + ) }) .map(([actionName, _]) => actionName) diff --git a/src/fireedge/src/client/utils/helpers.js b/src/fireedge/src/client/utils/helpers.js index ddec55ace0..1af3056c08 100644 --- a/src/fireedge/src/client/utils/helpers.js +++ b/src/fireedge/src/client/utils/helpers.js @@ -236,7 +236,10 @@ export const filterFieldsByHypervisor = ( fields .map((field) => (typeof field === 'function' ? field(hypervisor) : field)) .filter( - ({ notOnHypervisors } = {}) => !notOnHypervisors?.includes?.(hypervisor) + ({ notOnHypervisors, onlyOnHypervisors } = {}) => + (!notOnHypervisors && !onlyOnHypervisors) || + (notOnHypervisors && !notOnHypervisors.includes?.(hypervisor)) || + onlyOnHypervisors?.includes?.(hypervisor) ) /** diff --git a/src/image/ImageManagerProtocol.cc b/src/image/ImageManagerProtocol.cc index 9fbf32f91c..0d2c7ca89e 100644 --- a/src/image/ImageManagerProtocol.cc +++ b/src/image/ImageManagerProtocol.cc @@ -103,6 +103,8 @@ void ImageManager::_cp(unique_ptr msg) goto error; } + image->set_source(source); + is >> format; if (is.fail() || format.empty()) @@ -111,8 +113,6 @@ void ImageManager::_cp(unique_ptr msg) goto error_common; } - image->set_source(source); - image->set_format(format); image->set_state_unlock(); diff --git a/src/onedb/onedb.rb b/src/onedb/onedb.rb index 3f7bb483d4..c82de01524 100644 --- a/src/onedb/onedb.rb +++ b/src/onedb/onedb.rb @@ -760,14 +760,14 @@ class OneDB shared_upgrade = Gem::Version.new(shared) < Gem::Version.new(source) local_upgrade = Gem::Version.new(local) < Gem::Version.new(source_local) - # Both need to be lower than current version as sometimes the DB schema + # One needs to be lower than current version as sometimes the DB schema # have been increased only for local or shared. - return [true, 2] if shared_upgrade && local_upgrade + return [true, 2] if shared_upgrade || local_upgrade shared_new = Gem::Version.new(shared) > Gem::Version.new(source) local_new = Gem::Version.new(local) > Gem::Version.new(source_local) - # Both version should be lower or equal than source. + # Both version should be higher than source. return [true, 3] if shared_new || local_new [false, 0]