Moti Asayag has uploaded a new change for review. Change subject: engine: Generalize messaging broker type ......................................................................
engine: Generalize messaging broker type The patch starts a series of refactoring patches to support various messaging broker types to be configured on hosts which are installed with an external network provider. Change-Id: Ib8075f2ef1227ab9c4a40cd3a961921d42d5ac22 Signed-off-by: Moti Asayag <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/OpenstackNetworkProviderProperties.java M backend/manager/modules/dal/src/test/resources/fixtures.xml M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/NeutronAgentModel.java A packaging/dbscripts/upgrade/03_05_0400_generalize_messaging_broker_type.sql 5 files changed, 75 insertions(+), 22 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/55/27555/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java index 201c3ee..728e519 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsDeploy.java @@ -494,7 +494,7 @@ public Void call() throws Exception { _setCliEnvironmentIfNecessary( OpenStackEnv.NEUTRON_CONFIG_PREFIX + "DEFAULT/qpid_hostname", - _openStackAgentProperties.getAgentConfiguration().getQpidConfiguration().getAddress() + _openStackAgentProperties.getAgentConfiguration().getMessagingConfiguration().getAddress() ); return null; }}, @@ -502,7 +502,7 @@ public Void call() throws Exception { _setCliEnvironmentIfNecessary( OpenStackEnv.NEUTRON_CONFIG_PREFIX + "DEFAULT/qpid_port", - _openStackAgentProperties.getAgentConfiguration().getQpidConfiguration().getPort() + _openStackAgentProperties.getAgentConfiguration().getMessagingConfiguration().getPort() ); return null; }}, @@ -510,7 +510,7 @@ public Void call() throws Exception { _setCliEnvironmentIfNecessary( OpenStackEnv.NEUTRON_CONFIG_PREFIX + "DEFAULT/qpid_username", - _openStackAgentProperties.getAgentConfiguration().getQpidConfiguration().getUsername() + _openStackAgentProperties.getAgentConfiguration().getMessagingConfiguration().getUsername() ); return null; }}, @@ -518,7 +518,7 @@ public Void call() throws Exception { _setCliEnvironmentIfNecessary( OpenStackEnv.NEUTRON_CONFIG_PREFIX + "DEFAULT/qpid_password", - _openStackAgentProperties.getAgentConfiguration().getQpidConfiguration().getPassword() + _openStackAgentProperties.getAgentConfiguration().getMessagingConfiguration().getPassword() ); return null; }}, diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/OpenstackNetworkProviderProperties.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/OpenstackNetworkProviderProperties.java index c77aa81..8581b36 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/OpenstackNetworkProviderProperties.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/OpenstackNetworkProviderProperties.java @@ -89,12 +89,21 @@ return builder.toString(); } - public static class QpidConfiguration implements Serializable { + public static class MessagingConfiguration implements Serializable { private static final long serialVersionUID = -8072430559946539586L; + private BrokerType brokerType; private String address; private Integer port; private String username; private String password; + + public BrokerType getBrokerType() { + return brokerType; + } + + public void setBrokerType(BrokerType brokerType) { + this.brokerType = brokerType; + } public String getAddress() { return address; @@ -103,7 +112,6 @@ public void setAddress(String address) { this.address = address; } - public Integer getPort() { return port; @@ -137,6 +145,7 @@ result = prime * result + ((getPort() == null) ? 0 : getPort().hashCode()); result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode()); result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode()); + result = prime * result + ((getBrokerType() == null) ? 0 : getBrokerType().hashCode()); return result; } @@ -148,10 +157,10 @@ if (obj == null) { return false; } - if (!(obj instanceof QpidConfiguration)) { + if (!(obj instanceof MessagingConfiguration)) { return false; } - QpidConfiguration other = (QpidConfiguration) obj; + MessagingConfiguration other = (MessagingConfiguration) obj; if (getAddress() == null) { if (other.getAddress() != null) { return false; @@ -180,21 +189,28 @@ } else if (!getUsername().equals(other.getUsername())) { return false; } + if (getBrokerType() == null) { + if (other.getBrokerType() != null) { + return false; + } + } else if (!getBrokerType().equals(other.getBrokerType())) { + return false; + } return true; } } public static class AgentConfiguration implements Serializable { private static final long serialVersionUID = -3588687921167640459L; - private QpidConfiguration qpidConfiguration; + private MessagingConfiguration messagingConfiguration; private String networkMappings; - public QpidConfiguration getQpidConfiguration() { - return qpidConfiguration; + public MessagingConfiguration getMessagingConfiguration() { + return messagingConfiguration; } - public void setQpidConfiguration(QpidConfiguration qpidConfiguration) { - this.qpidConfiguration = qpidConfiguration; + public void setQpidConfiguration(MessagingConfiguration messagingConfiguration) { + this.messagingConfiguration = messagingConfiguration; } public String getNetworkMappings() { @@ -210,7 +226,7 @@ final int prime = 31; int result = 1; result = prime * result + ((getNetworkMappings() == null) ? 0 : getNetworkMappings().hashCode()); - result = prime * result + ((getQpidConfiguration() == null) ? 0 : getQpidConfiguration().hashCode()); + result = prime * result + ((getMessagingConfiguration() == null) ? 0 : getMessagingConfiguration().hashCode()); return result; } @@ -233,14 +249,18 @@ } else if (!getNetworkMappings().equals(other.getNetworkMappings())) { return false; } - if (getQpidConfiguration() == null) { - if (other.getQpidConfiguration() != null) { + if (getMessagingConfiguration() == null) { + if (other.getMessagingConfiguration() != null) { return false; } - } else if (!getQpidConfiguration().equals(other.getQpidConfiguration())) { + } else if (!getMessagingConfiguration().equals(other.getMessagingConfiguration())) { return false; } return true; } } + + public enum BrokerType { + QPID + } } diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml b/backend/manager/modules/dal/src/test/resources/fixtures.xml index cafc6a2..b5b2389 100644 --- a/backend/manager/modules/dal/src/test/resources/fixtures.xml +++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml @@ -875,7 +875,7 @@ <null/> <value>bubu</value> <value>LINUX_BRIDGE</value> - <value>{"qpidConfiguration" : {"address" : "test", "port" : 5672, "username" : null, "password" : null}, "networkMappings" : ""}</value> + <value>{"messagingConfiguration" : {"brokerTpe" : "QPID", "address" : "test", "port" : 5672, "username" : null, "password" : null}, "networkMappings" : ""}</value> </row> </table> diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/NeutronAgentModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/NeutronAgentModel.java index 645aeb8..b2ef854 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/NeutronAgentModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/providers/NeutronAgentModel.java @@ -3,7 +3,8 @@ import org.ovirt.engine.core.common.businessentities.BusinessEntitiesDefinitions; import org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties; import org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.AgentConfiguration; -import org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.QpidConfiguration; +import org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.BrokerType; +import org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties.MessagingConfiguration; import org.ovirt.engine.core.common.businessentities.Provider; import org.ovirt.engine.ui.uicommonweb.models.EntityModel; import org.ovirt.engine.ui.uicommonweb.models.ListModel; @@ -140,7 +141,7 @@ if (agentConfiguration != null) { getInterfaceMappings().setEntity(agentConfiguration.getNetworkMappings()); - QpidConfiguration qpidConfiguration = agentConfiguration.getQpidConfiguration(); + MessagingConfiguration qpidConfiguration = agentConfiguration.getMessagingConfiguration(); if (qpidConfiguration != null) { getQpidHost().setEntity(qpidConfiguration.getAddress()); Integer port = qpidConfiguration.getPort(); @@ -171,9 +172,9 @@ } agentConfiguration.setNetworkMappings(getInterfaceMappings().getEntity()); - QpidConfiguration qpidConfiguration = agentConfiguration.getQpidConfiguration(); + MessagingConfiguration qpidConfiguration = agentConfiguration.getMessagingConfiguration(); if (qpidConfiguration == null) { - qpidConfiguration = new QpidConfiguration(); + qpidConfiguration = new MessagingConfiguration(); agentConfiguration.setQpidConfiguration(qpidConfiguration); } qpidConfiguration.setAddress(getQpidHost().getEntity()); @@ -181,6 +182,7 @@ qpidConfiguration.setPort(port == null ? null : Integer.valueOf(port)); qpidConfiguration.setUsername(getQpidUsername().getEntity()); qpidConfiguration.setPassword(getQpidPassword().getEntity()); + qpidConfiguration.setBrokerType(BrokerType.QPID); } } diff --git a/packaging/dbscripts/upgrade/03_05_0400_generalize_messaging_broker_type.sql b/packaging/dbscripts/upgrade/03_05_0400_generalize_messaging_broker_type.sql new file mode 100644 index 0000000..3a33f1e --- /dev/null +++ b/packaging/dbscripts/upgrade/03_05_0400_generalize_messaging_broker_type.sql @@ -0,0 +1,31 @@ +-- The following update statements modifies an existing representation +-- of provider's agent properties +-- qpidConfiguration ---> messagingConfiguration +-- added brokerType with a specific type (QPID) + +-- Input: +-- +-- { + +-- "qpidConfiguration" : { + +-- "address" : "192.168.10.33", + +-- "port" : 5678, + +-- "username" : "noone", + +-- "password" : "nopass" + +-- }, + +-- "networkMappings" : "xxx:eth600" + +-- } + +-- Output: +-- { + +-- "messagingConfiguration" : { + +-- "brokerType" : "QPID", + +-- "address" : "192.168.10.33", + +-- "port" : 5678, + +-- "username" : "noone", + +-- "password" : "nopass" + +-- }, + +-- "networkMappings" : "xxx:eth600" + +-- } + +update providers +set agent_configuration = replace (agent_configuration, '"qpidConfiguration" : {', E'"messagingConfiguration" : {\n "brokerType" : "QPID",'); -- To view, visit http://gerrit.ovirt.org/27555 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib8075f2ef1227ab9c4a40cd3a961921d42d5ac22 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Moti Asayag <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
