-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CLVM enhancements and fixes #12617
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
Draft
Pearl1594
wants to merge
63
commits into
main
Choose a base branch
from
clvm-enhancements
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
CLVM enhancements and fixes #12617
Changes from 31 commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
9e03f4b
CLVM enhancements and fixes
Pearl1594 96edadc
add support for proper cleanup of snapshots and prevent vol snapshot …
Pearl1594 f9d8062
remove snap vol restriction for sunning vms
Pearl1594 43e9384
refactor clvm code
Pearl1594 c9dd7ed
add support for live migration
Pearl1594 4984ee5
add support for migrating lvm lock
Pearl1594 190b201
clvm deletion called explicitly
Pearl1594 8a7e48a
made necessary changes to allow migration of lock and deletion of det…
Pearl1594 ab98daa
fix create vol from snap and attach
Pearl1594 6f20113
add support to revert snapshot for clvm
Pearl1594 21242ac
add support to revert snapshot for clvm
Pearl1594 7a11626
make zero fill configurable
Pearl1594 82d6edd
make setting non-dynamic & fix test
Pearl1594 7b5af5e
fix locking at vol/vm creation
Pearl1594 d8890ec
fix revert snapshot format type and handle revert snapshot functional…
Pearl1594 d93e044
1. Create clvmlockmanager and move common code \n
Pearl1594 16f319d
add license
Pearl1594 b3e0bb5
add unit tests
Pearl1594 c83affd
remove command/answer classes from sonar coverage check
Pearl1594 ed7cf12
fix failing test and add test
Pearl1594 03a8860
add unit test for helper class
Pearl1594 d51123d
Merge branch 'main' of https://github.com/apache/cloudstack into clvm…
Pearl1594 81bb667
add support for new gen clvm with template (qcow2) backing
Pearl1594 cc924c5
Add support for clvm_ng - which allows qcow2 on block storage , linke…
Pearl1594 ecba1b3
fix test
Pearl1594 4c34200
fix test and use physical size + 50% of virtual size for backing file…
Pearl1594 572ffeb
migrate clvm volumes as full clone and allow migration from clvm to nfs
Pearl1594 357e840
fix test
Pearl1594 798401e
Merge branch 'main' of https://github.com/apache/cloudstack into clvm…
Pearl1594 22f9d0e
fix clvm_ng to nfs migration, and handle overhead calc
Pearl1594 c0cf895
support live migration from clvm_ng to nfs and vice-versa
Pearl1594 01aa259
add support to migrate to and from clvm to nfs
Pearl1594 7e5e1e7
fix creation of volume on destination host during migration to clvm/c…
Pearl1594 437f77c
support live vm migration between clvm -> clvm-ng (vice-versa), nfs -…
Pearl1594 348cf33
add unit tests for clvm/clvm_ng operations
Pearl1594 22c4934
Add support for incremental volume snapshots for clvm_ng
Pearl1594 8ed2a3a
refactor
Pearl1594 70583a4
prevent snapshot backup for incremental clvm_ng snaps, fix build fail…
Pearl1594 237f074
Merge branch 'main' of https://github.com/apache/cloudstack into clvm…
Pearl1594 058007e
fix lockhost on creation of volumes from snap and fix bitmap issue wh…
Pearl1594 0fcf12c
add tests
Pearl1594 0afa603
fix build failure, add tests
Pearl1594 2f0fc97
fix EOF and trailing spaces
Pearl1594 a923bdb
remove failing test - fails on CI but passes locally
Pearl1594 93782bb
add tests
Pearl1594 f84a507
restrict pre and post migration commands to only kvm hosts where vm h…
Pearl1594 e45a43d
add more tests
Pearl1594 381dc67
add more tests
Pearl1594 a29f823
Merge branch 'main' of https://github.com/apache/cloudstack into clvm…
Pearl1594 4903339
evist lock tracking - use lvs command to get lock host than DB
Pearl1594 34b0729
add test for pre/post migration
Pearl1594 be2994d
Merge branch 'main' of https://github.com/apache/cloudstack into clvm…
Pearl1594 0e2bac1
Merge branch 'main' of https://github.com/apache/cloudstack into clvm…
9e31784
fix merge conflict
ffb8698
skip warning lines when retrieving lock hostname
746baff
renamed and re-arranged classes; addressed comments part-1
e604a46
update bean name
7caa9b5
Create a CLVM storage adaptor
e3f1ccb
update existing clvm get stats method
f29002b
address comment
184024b
fix precommit check failure
360201b
Apply suggestions from code review
sureshanaparti f4502f1
Apply suggestions from code review
sureshanaparti 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
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
42 changes: 42 additions & 0 deletions
42
core/src/main/java/com/cloud/agent/api/PostMigrationAnswer.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,42 @@ | ||
| // | ||
| // 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; | ||
|
|
||
| /** | ||
| * Answer for PostMigrationCommand. | ||
| * Indicates success or failure of post-migration operations on the destination host. | ||
| */ | ||
| public class PostMigrationAnswer extends Answer { | ||
|
|
||
| protected PostMigrationAnswer() { | ||
| } | ||
|
|
||
| public PostMigrationAnswer(PostMigrationCommand cmd, String detail) { | ||
| super(cmd, false, detail); | ||
| } | ||
|
|
||
| public PostMigrationAnswer(PostMigrationCommand cmd, Exception ex) { | ||
| super(cmd, ex); | ||
| } | ||
|
|
||
| public PostMigrationAnswer(PostMigrationCommand cmd) { | ||
| super(cmd, true, null); | ||
| } | ||
| } |
54 changes: 54 additions & 0 deletions
54
core/src/main/java/com/cloud/agent/api/PostMigrationCommand.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,54 @@ | ||
| // | ||
| // 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.VirtualMachineTO; | ||
|
|
||
| /** | ||
| * PostMigrationCommand is sent to the destination host after a successful VM migration. | ||
| * It performs post-migration tasks such as: | ||
| * - Claiming exclusive locks on CLVM volumes (converting from shared to exclusive mode) | ||
| * - Other post-migration cleanup operations | ||
| */ | ||
| public class PostMigrationCommand extends Command { | ||
|
Check warning on line 30 in core/src/main/java/com/cloud/agent/api/PostMigrationCommand.java
|
||
| private VirtualMachineTO vm; | ||
| private String vmName; | ||
|
|
||
| protected PostMigrationCommand() { | ||
| } | ||
|
|
||
| public PostMigrationCommand(VirtualMachineTO vm, String vmName) { | ||
| this.vm = vm; | ||
| this.vmName = vmName; | ||
| } | ||
|
|
||
| public VirtualMachineTO getVirtualMachine() { | ||
| return vm; | ||
| } | ||
|
|
||
| public String getVmName() { | ||
| return vmName; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean executeInSequence() { | ||
| return true; | ||
| } | ||
| } | ||
56 changes: 56 additions & 0 deletions
56
core/src/main/java/com/cloud/agent/api/PreMigrationCommand.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,56 @@ | ||
| // | ||
| // 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.VirtualMachineTO; | ||
|
|
||
| /** | ||
| * PreMigrationCommand is sent to the source host before VM migration starts. | ||
| * It performs pre-migration tasks such as: | ||
| * - Converting CLVM volume exclusive locks to shared mode so destination host can access them | ||
| * - Other pre-migration preparation operations on the source host | ||
| * | ||
| * This command runs on the SOURCE host before PrepareForMigrationCommand runs on the DESTINATION host. | ||
| */ | ||
| public class PreMigrationCommand extends Command { | ||
| private VirtualMachineTO vm; | ||
| private String vmName; | ||
|
|
||
| protected PreMigrationCommand() { | ||
| } | ||
|
|
||
| public PreMigrationCommand(VirtualMachineTO vm, String vmName) { | ||
| this.vm = vm; | ||
| this.vmName = vmName; | ||
| } | ||
|
|
||
| public VirtualMachineTO getVirtualMachine() { | ||
| return vm; | ||
| } | ||
|
|
||
| public String getVmName() { | ||
| return vmName; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean executeInSequence() { | ||
| return true; | ||
| } | ||
| } |
97 changes: 97 additions & 0 deletions
97
core/src/main/java/org/apache/cloudstack/storage/command/ClvmLockTransferCommand.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,97 @@ | ||
| // 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 org.apache.cloudstack.storage.command; | ||
|
|
||
| import com.cloud.agent.api.Command; | ||
|
|
||
| /** | ||
| * Command to transfer CLVM (Clustered LVM) exclusive lock between hosts. | ||
| * This enables lightweight volume migration for CLVM storage pools where volumes | ||
| * reside in the same Volume Group (VG) but need to be accessed from different hosts. | ||
| * | ||
| * <p>Instead of copying volume data (traditional migration), this command simply | ||
| * deactivates the LV on the source host and activates it exclusively on the destination host. | ||
| * | ||
| * <p>This is significantly faster (10-100x) than traditional migration and uses no network bandwidth. | ||
| */ | ||
| public class ClvmLockTransferCommand extends Command { | ||
|
|
||
| /** | ||
| * Operation to perform on the CLVM volume. | ||
| * Maps to lvchange flags for LVM operations. | ||
| */ | ||
| public enum Operation { | ||
| /** Deactivate the volume on this host (-an) */ | ||
| DEACTIVATE("-an", "deactivate"), | ||
|
|
||
| /** Activate the volume exclusively on this host (-aey) */ | ||
| ACTIVATE_EXCLUSIVE("-aey", "activate exclusively"), | ||
|
|
||
| /** Activate the volume in shared mode on this host (-asy) */ | ||
| ACTIVATE_SHARED("-asy", "activate in shared mode"); | ||
|
|
||
| private final String lvchangeFlag; | ||
| private final String description; | ||
|
|
||
| Operation(String lvchangeFlag, String description) { | ||
| this.lvchangeFlag = lvchangeFlag; | ||
| this.description = description; | ||
| } | ||
|
|
||
| public String getLvchangeFlag() { | ||
| return lvchangeFlag; | ||
| } | ||
|
|
||
| public String getDescription() { | ||
| return description; | ||
| } | ||
| } | ||
|
|
||
| private String lvPath; | ||
| private Operation operation; | ||
| private String volumeUuid; | ||
|
|
||
| public ClvmLockTransferCommand() { | ||
| // For serialization | ||
| } | ||
|
|
||
| public ClvmLockTransferCommand(Operation operation, String lvPath, String volumeUuid) { | ||
| this.operation = operation; | ||
| this.lvPath = lvPath; | ||
| this.volumeUuid = volumeUuid; | ||
| // Execute in sequence to ensure lock safety | ||
| setWait(30); | ||
| } | ||
|
|
||
| public String getLvPath() { | ||
| return lvPath; | ||
| } | ||
|
|
||
| public Operation getOperation() { | ||
| return operation; | ||
| } | ||
|
|
||
| public String getVolumeUuid() { | ||
| return volumeUuid; | ||
| } | ||
|
|
||
| @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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.