-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Vmware offline migration #2848
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
Vmware offline migration #2848
Changes from all commits
17a86ef
103a0b2
1c552b3
e3956e2
2e5e58c
52abf56
4673035
918b02f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,4 +120,16 @@ public void execute() { | |
| } | ||
| } | ||
|
|
||
| @Override | ||
| public String getSyncObjType() { | ||
| return (getSyncObjId() != null) ? BaseAsyncCmd.migrationSyncObject : null; | ||
| } | ||
|
|
||
| @Override | ||
| public Long getSyncObjId() { | ||
| if (getStoragePoolId() != null) { | ||
|
Member
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. If You can simple call
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 consideration here (and the intermediate version) that other objects, like the host, could be the sync object as well so this could be extended to return that under conditions.
Member
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. I did not get your explanation. When we extend the class and then override the method, the whole implementation of |
||
| return getStoragePoolId(); | ||
| } | ||
| return null; | ||
| } | ||
| } | ||
| 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 org.apache.cloudstack.storage.to.VolumeObjectTO; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public class MigrateVmToPoolAnswer extends Answer { | ||
|
|
||
| List<VolumeObjectTO> volumeTos; | ||
|
|
||
| public MigrateVmToPoolAnswer(MigrateVmToPoolCommand cmd, Exception ex) { | ||
| super(cmd, ex); | ||
| volumeTos = null; | ||
| } | ||
|
|
||
| public MigrateVmToPoolAnswer(MigrateVmToPoolCommand cmd, List<VolumeObjectTO> volumeTos) { | ||
| super(cmd, true, null); | ||
| this.volumeTos = volumeTos; | ||
| } | ||
|
|
||
| public List<VolumeObjectTO> getVolumeTos() { | ||
| return volumeTos; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| // | ||
| // 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 com.cloud.agent.api.to.VolumeTO; | ||
|
|
||
| import java.util.Collection; | ||
|
|
||
| /** | ||
| * used to tell the agent to migrate a vm to a different primary storage pool. | ||
| * It is for now only implemented on Vmware and is supposed to work irrespective of whether the VM is started or not. | ||
| * | ||
| */ | ||
| public class MigrateVmToPoolCommand extends Command { | ||
| private Collection<VolumeTO> volumes; | ||
| private String vmName; | ||
| private String destinationPool; | ||
| private boolean executeInSequence = false; | ||
|
|
||
| protected MigrateVmToPoolCommand() { | ||
| } | ||
|
|
||
| /** | ||
| * | ||
| * @param vmName the name of the VM to migrate | ||
| * @param volumes used to supply feedback on vmware generated names | ||
| * @param destinationPool the primary storage pool to migrate the VM to | ||
| * @param executeInSequence | ||
|
Member
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. if you do not have anything further to talk about a parameter, I think that you do not need to list it here.
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. doesn't that make it part of the javadoc rendering? it seems weird to include only part of the parameter list in the javadoc.
Member
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. Good question. I do not know how it would be better now. Maybe it would have an impact if we generated the javadoc for the code, but we do not do that... |
||
| */ | ||
| public MigrateVmToPoolCommand(String vmName, Collection<VolumeTO> volumes, String destinationPool, boolean executeInSequence) { | ||
| this.vmName = vmName; | ||
| this.volumes = volumes; | ||
| this.destinationPool = destinationPool; | ||
| this.executeInSequence = executeInSequence; | ||
| } | ||
|
|
||
| public Collection<VolumeTO> getVolumes() { | ||
| return volumes; | ||
| } | ||
|
|
||
| public String getDestinationPool() { | ||
| return destinationPool; | ||
| } | ||
|
|
||
| public String getVmName() { | ||
| return vmName; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean executeInSequence() { | ||
| return executeInSequence; | ||
| } | ||
|
|
||
| } | ||
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.
Why did you need to implemente these
getSyncObjTypeandgetSyncObjId? Could you explain this a little bit further?Uh oh!
There was an error while loading. Please reload this page.
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.
i can, but it will be not a little bit ;)
tl;dr: limitting the number of jobs sent to vmware.
There is a mechanism to limit jobs. It checks in the sync phase of async jobs to see if the queue for those jobs exeeds a certain length. If so it return to the user to try again later. It can filter on type and entity, if it can get them. These methods are part of those mechs.