Liron Aravot has uploaded a new change for review. Change subject: core: VdsUpdateRunTimeInfo - update device logical name ......................................................................
core: VdsUpdateRunTimeInfo - update device logical name This patch adds support to update disks logical names as retrieved from vdsm. Change-Id: I08b13ba18ded824d7c62f72766fa7055da6ec49c Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1063597 Signed-off-by: Liron Aravot <lara...@redhat.com> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql 5 files changed, 40 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/33/31733/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java index d9f5b38..636505b 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java @@ -398,6 +398,16 @@ /** * @param version * Compatibility version to check for. + * @return <code>true</code> if reported disk logical names is supported for the given version. + */ + public static boolean reportedDisksLogicalNames(Version version) { + return supportedInConfig(ConfigValues.ReportedDisksLogicalNames, version); + + } + + /** + * @param version + * Compatibility version to check for. * @return <code>true</code> if skip fencing when host connected to SD feature is supported for the given version. */ public static boolean isSkipFencingIfSDActiveSupported(Version version) { diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java index c811b0b..a227c07 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java @@ -1846,6 +1846,10 @@ @DefaultValueAttribute("true") LiveMergeSupported, + @TypeConverterAttribute(Boolean.class) + @DefaultValueAttribute("true") + ReportedDisksLogicalNames, + @TypeConverterAttribute(Integer.class) @DefaultValueAttribute("300") AlertOnNumberOfLVs, diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java index 85407b6..a230ac6 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java @@ -19,6 +19,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.exception.ExceptionUtils; import org.ovirt.engine.core.common.AuditLogType; +import org.ovirt.engine.core.common.FeatureSupported; import org.ovirt.engine.core.common.businessentities.CpuStatistics; import org.ovirt.engine.core.common.businessentities.Disk; import org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType; @@ -1227,11 +1228,18 @@ Guid deviceId = getDeviceId(device); VmDevice vmDevice = deviceMap.get(new VmDeviceId(deviceId, vmId)); + String logicalName = null; + if (FeatureSupported.reportedDisksLogicalNames(_vds.getVdsGroupCompatibilityVersion()) && + VmDeviceType.DISK.getName().equals(device.get(VdsProperties.Device))) { + logicalName = getDeviceLogicalName((Map<?, ?>) vm.get(VdsProperties.DiskMapping), deviceId); + } + if (deviceId == null || vmDevice == null) { - deviceId = addNewVmDevice(vmId, device); + deviceId = addNewVmDevice(vmId, device, logicalName); } else { vmDevice.setAddress(((Map<String, String>) device.get(VdsProperties.Address)).toString()); vmDevice.setAlias(StringUtils.defaultString((String) device.get(VdsProperties.Alias))); + vmDevice.setLogicalName(logicalName); addVmDeviceToList(vmDevice); } @@ -1239,6 +1247,13 @@ } handleRemovedDevices(vmId, processedDevices, devices); + } + + + private String getDeviceLogicalName(Map<?, ?> diskMapping, Guid deviceId) { + String modifiedDeviceId = deviceId.toString().substring(0, 20); + Map<?, ?> deviceMapping = (Map<?, ?>) diskMapping.get(modifiedDeviceId); + return deviceMapping == null ? null : (String)deviceMapping.get(VdsProperties.Name); } /** @@ -1279,7 +1294,7 @@ * @param vmId * @param device */ - private Guid addNewVmDevice(Guid vmId, Map device) { + private Guid addNewVmDevice(Guid vmId, Map device, String logicalName) { Guid newDeviceId = Guid.Empty; String typeName = (String) device.get(VdsProperties.Type); String deviceName = (String) device.get(VdsProperties.Device); @@ -1302,7 +1317,7 @@ alias, null, null, - null); + logicalName); newVmDevices.add(newDevice); log.debugFormat("New device was marked for adding to VM {0} Devices : {1}", vmId, newDevice); } diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java index 9f6a646..034bcbe 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java @@ -296,6 +296,8 @@ public static final String Device = "device"; public static final String DeviceType = "deviceType"; public static final String Devices = "devices"; + public static final String DiskMapping = "diskMapping"; + public static final String Name = "name"; public static final String Index = "index"; public static final String PoolId = "poolID"; diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql index 1c0bc14..4374682 100644 --- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql +++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql @@ -332,6 +332,12 @@ select fn_db_add_config_value('JsonProtocolSupported','false','3.3'); select fn_db_add_config_value('JsonProtocolSupported','false','3.4'); +select fn_db_add_config_value('ReportedDisksLogicalNames','false','3.0'); +select fn_db_add_config_value('ReportedDisksLogicalNames','false','3.1'); +select fn_db_add_config_value('ReportedDisksLogicalNames','false','3.2'); +select fn_db_add_config_value('ReportedDisksLogicalNames','false','3.3'); +select fn_db_add_config_value('ReportedDisksLogicalNames','false','3.4'); + -- by default use no proxy select fn_db_add_config_value('SpiceProxyDefault','','general'); -- To view, visit http://gerrit.ovirt.org/31733 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I08b13ba18ded824d7c62f72766fa7055da6ec49c Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Liron Aravot <lara...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches