Hello Moti Asayag, I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/16851 to review the following change. Change subject: engine: Install Openstack agents on the host ...................................................................... engine: Install Openstack agents on the host The patch allows the user to provide an Openstack network provider, which according to its specific will install the agent on the host. Change-Id: Ib365bc5e7db9b0c1d070eb9182b554cd830e797d Signed-off-by: Moti Asayag <masa...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java 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/action/AddVdsActionParameters.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/InstallVdsParameters.java 5 files changed, 149 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/51/16851/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java index d47bd49..db0b955 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsCommand.java @@ -154,6 +154,8 @@ getParameters().getRootPassword()); installVdsParameters.setOverrideFirewall(getParameters().getOverrideFirewall()); installVdsParameters.setRebootAfterInstallation(getParameters().isRebootAfterInstallation()); + installVdsParameters.setProviderId(getParameters().getProviderId()); + installVdsParameters.setNetworkMappings(getParameters().getNetworkMappings()); Map<String, String> values = new HashMap<String, String>(); values.put(VdcObjectType.VDS.name().toLowerCase(), getParameters().getvds().getName()); Step installStep = ExecutionHandler.addSubStep(getExecutionContext(), diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java index fd2c0f9..a39b061 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java @@ -9,6 +9,9 @@ import org.ovirt.engine.core.common.AuditLogType; import org.ovirt.engine.core.common.action.InstallVdsParameters; import org.ovirt.engine.core.common.action.VdcActionType; +import org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties; +import org.ovirt.engine.core.common.businessentities.Provider; +import org.ovirt.engine.core.common.businessentities.ProviderType; import org.ovirt.engine.core.common.businessentities.VDSStatus; import org.ovirt.engine.core.common.businessentities.VDSType; import org.ovirt.engine.core.common.config.Config; @@ -117,6 +120,18 @@ installer.setManagementNetwork(NetworkUtils.getEngineNetwork()); } + if (parameters.getProviderId() != null) { + Provider<?> provider = getDbFacade().getProviderDao().get(parameters.getProviderId()); + if (provider.getType() == ProviderType.OPENSTACK_NETWORK) { + OpenstackNetworkProviderProperties agentProperties = + (OpenstackNetworkProviderProperties) provider.getAdditionalProperties(); + if (parameters.getNetworkMappings() != null) { + agentProperties.getAgentConfiguration().setNetworkMappings(parameters.getNetworkMappings()); + } + installer.setOpenStackAgentProperties(agentProperties); + } + } + switch (getVds().getVdsType()) { case VDS: installer.setUser("root"); 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 7d83fc4..a0f28cb 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 @@ -24,6 +24,8 @@ import javax.naming.TimeLimitExceededException; import org.apache.commons.lang.StringUtils; +import org.ovirt.engine.core.common.businessentities.OpenstackNetworkPluginType; +import org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties; import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.VDSType; @@ -100,6 +102,8 @@ private String _certificate; private String _iptables = ""; + + private OpenstackNetworkProviderProperties _openStackAgentProperties = null; /** * set vds object with unique id. @@ -215,7 +219,7 @@ * Values to determine when customization should be performed. */ private static enum CustomizationCondition { - IPTABLES_OVERRIDE + IPTABLES_OVERRIDE, NEUTRON_SETUP, NEUTRON_LINUX_BRIDGE_SETUP, NEUTRON_OPEN_VSWITCH_SETUP }; /** * Special annotation to specify when the customization is necessary. @@ -427,6 +431,86 @@ _parser.cliEnvironmentSet( org.ovirt.ovirt_host_deploy.constants.CoreEnv.FORCE_REBOOT, reboot + ); + return null; + }}, + new Callable<Void>() {@CallWhen(CustomizationCondition.NEUTRON_SETUP) + public Void call() throws Exception { + _parser.cliEnvironmentSet( + "OPENSTACK/neutronEnable", + true + ); + return null; + }}, + new Callable<Void>() {@CallWhen(CustomizationCondition.NEUTRON_SETUP) + public Void call() throws Exception { + _parser.cliEnvironmentSet( + "OPENSTACK_NEUTRON_CONFIG/DEFAULT/qpid_hostname", + _openStackAgentProperties.getAgentConfiguration().getQpidConfiguration().getAddress() + ); + return null; + }}, + new Callable<Void>() {@CallWhen(CustomizationCondition.NEUTRON_SETUP) + public Void call() throws Exception { + _parser.cliEnvironmentSet( + "OPENSTACK_NEUTRON_CONFIG/DEFAULT/qpid_port", + _openStackAgentProperties.getAgentConfiguration().getQpidConfiguration().getPort() + ); + return null; + }}, + new Callable<Void>() {@CallWhen(CustomizationCondition.NEUTRON_SETUP) + public Void call() throws Exception { + _parser.cliEnvironmentSet( + "OPENSTACK_NEUTRON_CONFIG/DEFAULT/qpid_username", + _openStackAgentProperties.getAgentConfiguration().getQpidConfiguration().getUsername() + ); + return null; + }}, + new Callable<Void>() {@CallWhen(CustomizationCondition.NEUTRON_SETUP) + public Void call() throws Exception { + _parser.cliEnvironmentSet( + "OPENSTACK_NEUTRON_CONFIG/DEFAULT/qpid_password", + _openStackAgentProperties.getAgentConfiguration().getQpidConfiguration().getPassword() + ); + return null; + }}, + new Callable<Void>() {@CallWhen(CustomizationCondition.NEUTRON_SETUP) + public Void call() throws Exception { + _parser.cliEnvironmentSet( + "OPENSTACK_NEUTRON_CONFIG/DEFAULT/rpc_backend", + "quantum.openstack.common.rpc.impl_qpid" + ); + return null; + }}, + new Callable<Void>() {@CallWhen(CustomizationCondition.NEUTRON_LINUX_BRIDGE_SETUP) + public Void call() throws Exception { + _parser.cliEnvironmentSet( + "OPENSTACK/neutronLinuxBridgeEnable", + true + ); + return null; + }}, + new Callable<Void>() {@CallWhen(CustomizationCondition.NEUTRON_LINUX_BRIDGE_SETUP) + public Void call() throws Exception { + _parser.cliEnvironmentSet( + "OPENSTACK_NEUTRON_LINUXBRIDGE_CONFIG/LINUX_BRIDGE/physical_interface_mappings", + _openStackAgentProperties.getAgentConfiguration().getNetworkMappings() + ); + return null; + }}, + new Callable<Void>() {@CallWhen(CustomizationCondition.NEUTRON_OPEN_VSWITCH_SETUP) + public Void call() throws Exception { + _parser.cliEnvironmentSet( + "OPENSTACK/neutronOpenvswitchEnable", + true + ); + return null; + }}, + new Callable<Void>() {@CallWhen(CustomizationCondition.NEUTRON_OPEN_VSWITCH_SETUP) + public Void call() throws Exception { + _parser.cliEnvironmentSet( + "OPENSTACK_NEUTRON_OPENVSWITCH_CONFIG/OVS/bridge_mappings", + _openStackAgentProperties.getAgentConfiguration().getNetworkMappings() ); return null; }}, @@ -1019,4 +1103,17 @@ _thread = null; } } + + public void setOpenStackAgentProperties(OpenstackNetworkProviderProperties properties) { + _openStackAgentProperties = properties; + if (_openStackAgentProperties != null) { + _customizationConditions.add(CustomizationCondition.NEUTRON_SETUP); + if (OpenstackNetworkPluginType.LINUX_BRIDGE.name().equals(_openStackAgentProperties.getPluginType())) { + _customizationConditions.add(CustomizationCondition.NEUTRON_LINUX_BRIDGE_SETUP); + } + else if (OpenstackNetworkPluginType.OPEN_VSWITCH.name().equals(_openStackAgentProperties.getPluginType())) { + _customizationConditions.add(CustomizationCondition.NEUTRON_OPEN_VSWITCH_SETUP); + } + } + } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVdsActionParameters.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVdsActionParameters.java index bd6fe43..78044ca 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVdsActionParameters.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/AddVdsActionParameters.java @@ -15,6 +15,8 @@ private boolean privateAddPending; private boolean glusterPeerProbeNeeded = true; + private Guid providerId; + private String networkMappings; public boolean getAddPending() { return privateAddPending; @@ -42,4 +44,20 @@ public boolean isGlusterPeerProbeNeeded() { return this.glusterPeerProbeNeeded; } + + public Guid getProviderId() { + return providerId; + } + + public void setProvider(Guid provider) { + this.providerId = provider; + } + + public String getNetworkMappings() { + return networkMappings; + } + + public void setNetworkMappings(String networkMappings) { + this.networkMappings = networkMappings; + } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/InstallVdsParameters.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/InstallVdsParameters.java index dcb7b78..9bb2b94 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/InstallVdsParameters.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/InstallVdsParameters.java @@ -8,7 +8,8 @@ private boolean reinstallOrUpgrade; private String oVirtIsoFile; - + private Guid providerId; + private String networkMappings; public InstallVdsParameters() { } @@ -35,5 +36,19 @@ oVirtIsoFile = value; } + public Guid getProviderId() { + return providerId; + } + public void setProviderId(Guid providerId) { + this.providerId = providerId; + } + + public String getNetworkMappings() { + return networkMappings; + } + + public void setNetworkMappings(String networkMappings) { + this.networkMappings = networkMappings; + } } -- To view, visit http://gerrit.ovirt.org/16851 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib365bc5e7db9b0c1d070eb9182b554cd830e797d Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Mike Kolesnik <mkole...@redhat.com> Gerrit-Reviewer: Moti Asayag <masa...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches