Uh oh!
There was an error while loading. Please reload this page.
CLOUDSTACK-7982: KVM live migration with local storage - #1709
Conversation
ae85e53 to
4ff1562Comparemarcaurele
commented
Oct 18, 2016
Is there a way to get the management server log of the travis job? |
yadvr
commented
Oct 21, 2016
@marcaurele yes, click on the details, go to the failing job and open the raw build log/output for debugging. Can you rebase again please, squash the changes. I can help run tests on this PR. |
marcaurele
commented
Oct 21, 2016
@rhtyd I found the log but it doesn't give the mgmt server log output, only the job's output which got a |
yadvr
commented
Oct 21, 2016
@marcaurele I had another look, you're right -- we don't have any way to see mgmt server log for Travis runs. I think rebase/squash and do a push -f to re-kick Travis run. |
4ff1562 to
ee930e3Compare| _libvirtConnectionProtocol = (String) params.get("libvirt.connection.protocol"); | ||
| if (_libvirtConnectionProtocol == null) { | ||
| _libvirtConnectionProtocol = "qemu://"; |
There was a problem hiding this comment.
Isn't this redundant since you already specify qemu:// at the beginning of LibvirtComputingResource?
There was a problem hiding this comment.
It's something I have to document in the installation doc. If you want to run the migration over TLS, you have to specify here qemu+tls://
There was a problem hiding this comment.
I'll remove the default value on the variable definition
| // under the License. | ||
| package com.cloud.agent.api; | ||
| public class CancelMigrationCommand extends Command { |
There was a problem hiding this comment.
Along these lines of cancellation, I've long thought that we really need the ability to clean up long running jobs if the agent disconnects from the management server for any reason (say upgrade or restart of agent or management server, network problems, etc). Normally the management server will know the job failed but the agent keeps on trucking, causing problems, especially for things like migrations of storage. This may be an important thing to add for this feature, to avoid situations where a migration completes but CloudStack does not know about it because the management server was restarted during the migration.
Rather than forcing the management server to know that the agent work needs to be cleaned up and sending a command to the hypervisor that is tailored to each command that can fail, one solution that I've seen implemented that has worked well is for LibvirtComputingResource to hold a global List of tasks, then it overrides the disconnected() method and loops through this list, running the tasks. It then exposes methods addDisconnectHook(Runnable hook) and removeDisconnectHook(Runnable hook) so that commands that are sensitive to being interrupted can add in cancellation logic in the case of disconnect before starting and remove it when finished.
Something like:
@Override
public void disconnected() {
this._connected = false;
s_logger.info("Detected agent disconnect event, running through " + _disconnectHooks.size() + " disconnect hooks");
for (Runnable hook : _disconnectHooks) {
hook.run();
}
_disconnectHooks.clear();
}
public void addDisconnectHook(Runnable hook) {
s_logger.debug("Adding disconnect hook " + hook);
_disconnectHooks.add(hook);
}
public void removeDisconnectHook(Runnable hook) {
s_logger.debug("Removing disconnect hook " + hook);
if (_disconnectHooks.contains(hook)) {
s_logger.debug("Removing disconnect hook " + hook);
_disconnectHooks.remove(hook);
} else {
s_logger.debug("Requested removal of disconnect hook, but hook not found: " + hook);
}
}
An example hook to cancel the migration might look like this:
public class MigrationCancelHook extends Thread {
private static final Logger LOGGER = Logger.getLogger(MigrationCancelHook.class.getName());
private static final String HOOK_PREFIX = "MigrationCancelHook-";
Domain _migratingDomain;
String _vmName;
public MigrationCancelHook(Domain migratingDomain) throws LibvirtException {
super(HOOK_PREFIX + migratingDomain.getName());
_migratingDomain = migratingDomain;
_vmName = migratingDomain.getName();
}
@Override
public void run() {
LOGGER.info("Interrupted migration of " + _vmName);
try {
if (_migratingDomain.abortJob() == 0) {
LOGGER.warn("Aborted migration job for " + _vmName);
}
} catch (Exception ex) {
LOGGER.warn("Failed to abort migration job for " + _vmName, ex);
}
}
}
There was a problem hiding this comment.
What you're describing is something slightly different than the case I want to address with my command. Your concern is valid, and the hook should be added too. I've sent once an email to the mailing list to ask why an agent that disconnects cannot reconnect to a management server until all its tasks are done, because the command will always be marked as failed on the management server and might have been executed successfully on the agent, causing incoherent states.
For the migration, without the cancellation command, if the migration takes a long time, the management server will cancel the job after a while and mark it as failed, thus invalidating the new host information. But the agent will keep on migrating the VM and when it has moved to the new host it becomes unreachable/unavailable since the network information hasn't been updated/committed.
yadvr
commented
Nov 20, 2016
@marcaurele can you check the Travis failure? Thanks. |
ee930e3 to
3847efaCompareyadvr
commented
Nov 23, 2017
@marcaurele can you rebase against latest master? |
3847efa to
cb23639Comparemarcaurele
commented
Nov 24, 2017
@rhtyd rebase done |
wido
commented
Nov 24, 2017
I see a few open bullet points in the PR's heading. How are we with those? This feature would be awesome for 4.11 |
marcaurele
commented
Nov 24, 2017
For the 1st one (Marvin test case) I will definitively need some help as I have no clue on how to write one. The rest will be done, I hope by next week. |
DaanHoogland
commented
Dec 4, 2017
@ustcweizhou@marcaurele will the implementations for local storage and shared storage be conflicting? |
marcaurele
commented
Dec 5, 2017
@DaanHoogland I don't know since we aren't using shared storage. I would think it should not since the API call is |
DaanHoogland
commented
Dec 6, 2017
I appreciate that @marcaurele. The issue with shared storage is that, when it is cluster wide, migration may or may not still have to include volumes. So either of the call will have to include the check if the target can reach the storage in use and then delegate to the other API based on the outcome of that check. |
DaanHoogland
commented
Dec 6, 2017
@marcaurele in travis there is a unit test and a marvin test failing, both concerning migration. Can you have a look? |
marcaurele
commented
Dec 6, 2017
@DaanHoogland I know about those failures, but I cannot access the mgmt logs to get the error/exception. And since we're not using upstream, I cannot run this version in our test lab either to debug it. I would appreciate if anyone can post the proper exception thrown during those failed tests. |
DaanHoogland
commented
Dec 6, 2017
I see @marcaurele I will investigate the marvin error. the other one i a plain compilation error though: @blueorangutan package |
yadvr
commented
Dec 6, 2017
@blueorangutan package |
blueorangutan
commented
Dec 6, 2017
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
blueorangutan
commented
Dec 6, 2017
Packaging result: ✖centos6 ✖centos7 ✖debian. JID-1348 |
blueorangutan
commented
Dec 12, 2017
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
blueorangutan
commented
Dec 12, 2017
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1366 |
DaanHoogland
commented
Dec 12, 2017
@blueorangutan test |
blueorangutan
commented
Dec 12, 2017
@DaanHoogland a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
blueorangutan
commented
Dec 12, 2017
Trillian test result (tid-1773)
|
yadvr
commented
Dec 19, 2017
@marcaurele can you fix the conflicts? |
bc94c1b to
168a0a7Comparewido
commented
Mar 20, 2018
How are we on this one? I'd really like to see this in master. Anything we can do to assist? |
marcaurele
commented
Mar 22, 2018
@wido I'll work on the rebase, but I need help to get it tested. The marvin tests are failing but I cannot access the management server logs to understand the issue, so I need someone who's using master in their lab to test this branch and give me a feedback on the log exceptions. Can you do that ? |
wido
commented
Mar 22, 2018
@marcaurele Yes, I should be able to do that or @GabrielBrascher might be able to help as well. |
wido
commented
Mar 29, 2018
@marcaurele Have you been able to do the rebase yet? |
168a0a7 to
540ab32Comparemarcaurele
commented
Apr 3, 2018
@wido some code has changed regarding migration with the local storage and I cannot find a way how to do a correct rebase and took a shotcut. I let you handle the tests from there, and I don't mind if you work further on this change to make it into a release. |
wido
commented
Apr 3, 2018
@marcaurele Awesome! Could you elaborate a bit about the shortcut? I kind find it right away in the changes. |
| } | ||
| } | ||
| final String result = LibvirtMigrationHelper.executeMigrationWithFlags(libvirtComputingResource, vm.getName(), command.getTargetHost(), libvirtComputingResource.getMigrateWithStorageFlags(), null, true); |
There was a problem hiding this comment.
@wido shortcut here with null, true as last parameters
wido
commented
Apr 3, 2018
Thanks! @GabrielBrascher and me will take a look at this. Might take some time to bootstrap and test env, but we will test it further. |
marcaurele
commented
Apr 3, 2018
@wido I updated the PR description with the new configuration keys required on the agent side. My logic was that each agent is responsible to give the migration flags & connection mode that it is capable of. An improvement would have been to have the possibility to overwrite the migration flags from the command. I know that @remibergsma did merge it in their cosmic cloud version. |
GabrielBrascher
commented
Apr 26, 2018
@marcaurele Do you need any help with this PR? Please ping me if necessary. |
marcaurele
commented
Apr 27, 2018
@GabrielBrascher I need help here as I don't have any setup with the upstream version therefore I cannot debug the issue. I did this manual backport which I hoped could work as is, but it doesn't. If you can test the branch and see what isn't working properly. Then I'll assist you to resolve the issues. |
GabrielBrascher
commented
Apr 29, 2018
@marcaurele I will perform some tests then. |
yadvr
commented
May 1, 2018
@marcaurele can you rebase this branch against latest master. With introducing of CA framework in 4.11, we've extended the use to secure KVM host as well, and tls based live migration is used when both src/dest hosts are secured (tls certs setup by the CA framework). With this perhaps you can simplify/update your PR? |
KVM live migration with non shared storage ported from Exoscale implementaion on branch 4.4.2. Signed-off-by: Marc-Aurèle Brothier <m@brothier.org>
540ab32 to
3d0cb26Comparemarcaurele
commented
May 2, 2018
rebase done |
GabrielBrascher
commented
Dec 24, 2018
Closing this as the PR #2997 was merged. |
This is the forward port of our KVM live migration implementation in 4.4.2 to the master branch.
Feedback is welcome. I still have to write the documentation to explain some configuration for libvirt and some config value in CS.
Things left:
Agent properties example
Jira: https://issues.apache.org/jira/browse/CLOUDSTACK-7982