Skip to content

openstack: convert qcow2 snapshots for image based VMs #692

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 15 commits into from
Jan 10, 2024

Conversation

bennyz
Copy link
Member

@bennyz bennyz commented Dec 26, 2023

This PR currently introduces the image-converter image that will perform the conversion. It has to jobs:

  1. Measure the required size, it will receive a PVC and will run a job to measure the required size for the conversion.
    forklift-controller will create an additional PVC for the output of the conversion
  2. Another job that will start the pod with convert command and will perform the conversion itself

@bennyz bennyz force-pushed the openstack-add-snapshot-conversion branch 3 times, most recently from c68afe1 to 325b1fb Compare January 1, 2024 10:21
Copy link
Member

@ahadas ahadas left a comment

Choose a reason for hiding this comment

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

didn't look at the details yet but there might be a need for a 'converter' also for export-to-OVA - can't we reuse the virt-v2v image for this though? it should have qemu-img..

@bennyz bennyz force-pushed the openstack-add-snapshot-conversion branch 2 times, most recently from 271145a to c45587a Compare January 3, 2024 16:37
@bennyz bennyz changed the title WIP openstack: convert qcow2 snapshots for image based VMs openstack: convert qcow2 snapshots for image based VMs Jan 7, 2024
@bennyz bennyz force-pushed the openstack-add-snapshot-conversion branch from 4c2d93b to d579b2c Compare January 8, 2024 07:47
@bennyz bennyz force-pushed the openstack-add-snapshot-conversion branch 5 times, most recently from 4807ac1 to 4a84c3c Compare January 9, 2024 11:32
for _, image := range images {
if imageID, ok := image.Properties[forkliftPropertyOriginalImageID]; ok && imageID == workload.ImageID {
annotations[planbase.AnnRequiresConversion] = "true"
Copy link
Member

Choose a reason for hiding this comment

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

how about:

Suggested change
annotations[planbase.AnnRequiresConversion] = "true"
// these are always qcow2 images that need to be converted to raw
annotations[planbase.AnnRequiresConversion] = "true"

for _, image := range images {
if imageID, ok := image.Properties[forkliftPropertyOriginalImageID]; ok && imageID == workload.ImageID {
annotations[planbase.AnnRequiresConversion] = "true"
Copy link
Member

Choose a reason for hiding this comment

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

you told me you'll add a test of the format here - that would be better

@bennyz bennyz force-pushed the openstack-add-snapshot-conversion branch 2 times, most recently from 6b35b03 to 1be0321 Compare January 10, 2024 07:40
@bennyz bennyz marked this pull request as ready for review January 10, 2024 07:55
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Missing completedPVCs++ when noticing the successful job

Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
When a VM has both image and volumes attached, set the boot order to
prefer the image if the volumes aren't bootable

Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
instead of setting as qcow2

Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
@bennyz bennyz force-pushed the openstack-add-snapshot-conversion branch from 02941b9 to db2aac1 Compare January 10, 2024 08:14
Copy link

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

2 New issues
0 Security Hotspots
No data about Coverage
6.0% Duplication on New Code

See analysis details on SonarCloud

for _, pvc := range persistentVolumeClaims {
// Handle loopvar https://go.dev/wiki/LoopvarExperiment
Copy link
Member

@ahadas ahadas Jan 10, 2024

Choose a reason for hiding this comment

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

it would be great to upgrade to go 1.21 when we can not only to get rid of this thingie but also to have slice.Contains ;)

@@ -842,7 +911,7 @@ func (r *KubeVirt) GetPodsWithLabels(podLabels map[string]string) (pods *core.Po
}

// Deletes an object from destination cluster associated with the VM.
func (r *KubeVirt) DeleteObject(object client.Object, vm *plan.VMStatus, message, objType string) (err error) {
func (r *KubeVirt) DeleteObject(object client.Object, vm *plan.VMStatus, message, objType string, options ...client.DeleteOption) (err error) {
Copy link
Member

Choose a reason for hiding this comment

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

options is unused but ok, it should be at some point

Copy link
Member Author

Choose a reason for hiding this comment

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

ah yes, I tried PropagationPolicy again 😅

@ahadas ahadas merged commit 82a0fa8 into kubev2v:main Jan 10, 2024
@bennyz bennyz deleted the openstack-add-snapshot-conversion branch January 16, 2024 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants