-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[4.9] CLOUDSTACK-9569: propagate global configuration router.aggregation.command.each.timeout to KVM agent #1856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
| // | ||
|
|
||
| package com.cloud.agent.api; | ||
|
|
||
| import java.util.Map; | ||
|
|
||
| public class SetHostParamsCommand extends Command { | ||
|
|
||
| Map<String, String> params; | ||
|
|
||
| public SetHostParamsCommand(Map<String, String> params) { | ||
| this.params = params; | ||
| } | ||
|
|
||
| public Map<String, String> getParams() { | ||
| return params; | ||
| } | ||
|
|
||
| protected SetHostParamsCommand() { | ||
| } | ||
|
|
||
| @Override | ||
| public boolean executeInSequence() { | ||
| return true; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,7 @@ public class VirtualRoutingResource { | |
| private int _retry; | ||
| private int _port; | ||
| private Duration _eachTimeout; | ||
| private Map<String, Object> _params; | ||
|
|
||
| private String _cfgVersion = "1.0"; | ||
|
|
||
|
|
@@ -259,8 +260,18 @@ private Answer execute(GetDomRVersionCmd cmd) { | |
| return new GetDomRVersionAnswer(cmd, result.getDetails(), lines[0], lines[1]); | ||
| } | ||
|
|
||
| public boolean configureHostParams(final Map<String, String> params) { | ||
| if (_params.get("router.aggregation.command.each.timeout") == null) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this check?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the idea is: if router.aggregation.command.each.timeout is already set in agent.properties, then ignore the propagation. |
||
| String value = (String)params.get("router.aggregation.command.each.timeout"); | ||
| _eachTimeout = Duration.standardSeconds(NumbersUtil.parseInt(value, 10)); | ||
| } | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException { | ||
| _name = name; | ||
| _params = params; | ||
|
|
||
| String value = (String)params.get("ssh.sleep"); | ||
| _sleep = NumbersUtil.parseInt(value, 10) * 1000; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtSetHostParamsCommandWrapper.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
| // | ||
|
|
||
| package com.cloud.hypervisor.kvm.resource.wrapper; | ||
|
|
||
| import java.util.Map; | ||
|
|
||
| import com.cloud.agent.api.Answer; | ||
| import com.cloud.agent.api.SetHostParamsCommand; | ||
| import com.cloud.hypervisor.kvm.resource.LibvirtComputingResource; | ||
| import com.cloud.resource.CommandWrapper; | ||
| import com.cloud.resource.ResourceWrapper; | ||
|
|
||
| @ResourceWrapper(handles = SetHostParamsCommand.class) | ||
| public final class LibvirtSetHostParamsCommandWrapper extends CommandWrapper<SetHostParamsCommand, Answer, LibvirtComputingResource> { | ||
|
|
||
| @Override | ||
| public Answer execute(final SetHostParamsCommand command, final LibvirtComputingResource libvirtComputingResource) { | ||
|
|
||
| final Map<String, String> params = command.getParams(); | ||
| boolean success = libvirtComputingResource.getVirtRouterResource().configureHostParams(params); | ||
|
|
||
| if (!success) { | ||
| return new Answer(command, false, "Failed to set host parameters"); | ||
| } else { | ||
| return new Answer(command, true, null); | ||
| } | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Map is not serializable, also HashMap that is actually used may have issues with serialization. Please check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@koushik-das luckily there is no issue on our platforms. We have some similar definitions in other Command in cloudstack actually.