Skip to content

Linstor: Fix migrate primary storage#9528

Merged
DaanHoogland merged 3 commits intoapache:4.19from
LINBIT:9176-instances-volumes-stored-on-linstor-are-of-format-qcow2-instead-of-raw
Sep 9, 2024
Merged

Linstor: Fix migrate primary storage#9528
DaanHoogland merged 3 commits intoapache:4.19from
LINBIT:9176-instances-volumes-stored-on-linstor-are-of-format-qcow2-instead-of-raw

Conversation

@rp-
Copy link
Copy Markdown
Contributor

@rp- rp- commented Aug 14, 2024

Description

This PR fixes migrate primary storage for Linstor primary storage.
Always use RAW as copy sourceFormat for Linstor devices, as all images are stored as RAW on Linstor, but we have to pretend to use qcow2 to be able to use qcow2 as snapshot format. Also use .getPath() for resource names, as they are altered after a primary storage migration.
Fixes: #9176 and #9522

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Linstor Cluster with migrating VM volumes between Linstor and NFS primary storage

How did you try to break this feature and the system with this change?

Migrated from Linstor to NFS and back to NFS, than tried various volume actions like snaphots and revert.

@rp-
Copy link
Copy Markdown
Contributor Author

rp- commented Aug 14, 2024

If it helps, I can make the:

commits into its own PR.

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 0% with 48 lines in your changes missing coverage. Please review.

Project coverage is 15.08%. Comparing base (eaab991) to head (ebcf66a).
Report is 25 commits behind head on 4.19.

Files with missing lines Patch % Lines
.../cloud/hypervisor/kvm/storage/KVMPhysicalDisk.java 0.00% 14 Missing ⚠️
...cloudstack/storage/datastore/util/LinstorUtil.java 0.00% 11 Missing ⚠️
.../hypervisor/kvm/storage/LinstorStorageAdaptor.java 0.00% 7 Missing ⚠️
...tore/driver/LinstorPrimaryDataStoreDriverImpl.java 0.00% 7 Missing ⚠️
...ud/hypervisor/kvm/storage/KVMStorageProcessor.java 0.00% 5 Missing ⚠️
.../hypervisor/kvm/storage/LibvirtStorageAdaptor.java 0.00% 2 Missing ⚠️
...ck/storage/snapshot/LinstorVMSnapshotStrategy.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##               4.19    #9528     +/-   ##
===========================================
  Coverage     15.08%   15.08%             
- Complexity    11180    11185      +5     
===========================================
  Files          5406     5406             
  Lines        472915   472942     +27     
  Branches      61731    58606   -3125     
===========================================
+ Hits          71326    71350     +24     
- Misses       393647   393648      +1     
- Partials       7942     7944      +2     
Flag Coverage Δ
uitests 4.30% <ø> (ø)
unittests 15.80% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

1 similar comment
@github-actions
Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

Always use RAW as copy sourceFormat for Linstor devices,
as all images are stored as RAW on Linstor, but we have to
pretend to use qcow2 to be able to use qcow2 as snapshot format.
Also use .getPath() for resource names, as they are altered after
a primary storage migration.
@rp- rp- force-pushed the 9176-instances-volumes-stored-on-linstor-are-of-format-qcow2-instead-of-raw branch from b60e159 to 064a8d7 Compare August 21, 2024 09:44
Copy link
Copy Markdown
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm, mostly Linstore code but might have some effect on other implementations!

@rp- rp- force-pushed the 9176-instances-volumes-stored-on-linstor-are-of-format-qcow2-instead-of-raw branch from 064a8d7 to ebcf66a Compare August 22, 2024 15:13
@rp- rp- requested review from sureshanaparti and yadvr August 27, 2024 08:46
private KVMStoragePool pool;
private final String name;
private final KVMStoragePool pool;
private String dispName;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private String dispName;
private String displayName;

/* Linstor images are always stored as RAW, but Linstor uses qcow2 in DB,
to support snapshots(backuped) as qcow2 files. */
PhysicalDiskFormat sourceFormat = srcPool.getType() != StoragePoolType.Linstor ?
disk.getFormat() : PhysicalDiskFormat.RAW;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can set format RAW in KVMPhysicalDisk for Linstor disks?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean, setting it in KVMPhysicalDisk.setFormat() or KVMPhysicalDisk.getFormat()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

@sureshanaparti sureshanaparti Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rp- sorry, missed this. if the format is set while creating the linstor disk (KVMPhysicalDisk), you get it with disk.getFormat()

Copy link
Copy Markdown
Contributor

@sureshanaparti sureshanaparti Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check in LinstorStorageAdaptor.java - getPhysicalDisk() & createPhysicalDisk() - where KVMPhysicalDisk obj is created and RAW format is set (so, I think, no need to set the format RAW with StoragePoolType.Linstor pool type check again).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly it is, because the LinstorStorageAdaptor isn't used for migrating from another PrimaryStorage.
And so it will use the format sent from the management server and this doesn't match what is expected from the qemu-img convert command.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want I can create the migration error and show you the exception/error log.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, got it. maybe, you can revisit that later.

@yadvr
Copy link
Copy Markdown
Member

yadvr commented Sep 3, 2024

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@rohityadavcloud a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 10928

@blueorangutan
Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10993

@DaanHoogland
Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan
Copy link
Copy Markdown

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@DaanHoogland
Copy link
Copy Markdown
Contributor

@slavkap @rg9975 @harikrishna-patnala can you review?

@blueorangutan
Copy link
Copy Markdown

[SF] Trillian test result (tid-11375)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 44760 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9528-t11375-kvm-ol8.zip
Smoke tests completed. 133 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

Copy link
Copy Markdown
Contributor

@slavkap slavkap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code LGTM, but I haven't tested it

@DaanHoogland
Copy link
Copy Markdown
Contributor

The code LGTM, but I haven't tested it

Are you alright with merging as is @slavkap ?

@slavkap
Copy link
Copy Markdown
Contributor

slavkap commented Sep 9, 2024

@DaanHoogland, yes all looks good

@DaanHoogland DaanHoogland merged commit 3f5a77e into apache:4.19 Sep 9, 2024
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Sep 10, 2024
@rp- rp- deleted the 9176-instances-volumes-stored-on-linstor-are-of-format-qcow2-instead-of-raw branch February 13, 2025 08:55
rp- added a commit to LINBIT/cloudstack that referenced this pull request Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[linstor] Fail to revert or delete instance snapshot in case of migrated volumes

7 participants