Omer Frenkel has uploaded a new change for review. Change subject: core: fix edit of sound card for running vm ......................................................................
core: fix edit of sound card for running vm Currently, when updating the sound card setting for running vm, the query that checks if sound card exists is wrong, because sound card can have multiple types of devices (ac97,ich6) Added a code that use the "UNKNOWN" device type, to mark the mechanism to use only the general device type (sound) without the specific type. Change-Id: If2ff54c3d0929ddf04f39bb42e61e185005d9655 Signed-off-by: Omer Frenkel <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VmManagementParametersBase.java 2 files changed, 10 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/35/31035/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java index 5d0bca5..f722bf6 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java @@ -51,6 +51,7 @@ import org.ovirt.engine.core.common.osinfo.OsRepository; import org.ovirt.engine.core.common.utils.Pair; import org.ovirt.engine.core.common.utils.SimpleDependecyInjector; +import org.ovirt.engine.core.common.utils.VmDeviceType; import org.ovirt.engine.core.common.vdscommands.SetVmStatusVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.UpdateVmDynamicDataVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.VDSCommandType; @@ -780,9 +781,16 @@ log.warn("VmHandler:: isUpdateValidForVmDevices: Reflection error"); } + // if device type is set to unknown, search by general type only + // because some devices has more than one type, like sound can be ac97/ich6 + String device = null; + if (annotation.type() != VmDeviceType.UNKNOWN) { + device = annotation.type().getName(); + } + if (isEnabled == null || !VmDeviceUtils.vmDeviceChanged(vmId, annotation.generalType(), - annotation.type().getName(), isEnabled)) { + device, isEnabled)) { continue; } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VmManagementParametersBase.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VmManagementParametersBase.java index f5f14e85..0638339 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VmManagementParametersBase.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VmManagementParametersBase.java @@ -51,7 +51,7 @@ * for add vm legacy logic will be used: create device for desktop type * for update the current configuration will remain */ - @EditableDeviceOnVmStatusField(generalType = VmDeviceGeneralType.SOUND, type = VmDeviceType.SOUND, isReadOnly = true) + @EditableDeviceOnVmStatusField(generalType = VmDeviceGeneralType.SOUND, type = VmDeviceType.UNKNOWN, isReadOnly = true) private Boolean soundDeviceEnabled; /* * This parameter is used to decide if to create console device or not if it is null then: for add vm don't add -- To view, visit http://gerrit.ovirt.org/31035 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If2ff54c3d0929ddf04f39bb42e61e185005d9655 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Omer Frenkel <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
