Skip to content
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

Migrate VMs with direct LUNs from ovirt #371

Merged
merged 8 commits into from
Jul 17, 2023
Merged

Conversation

liranr23
Copy link
Member

This patch will allow importing direct LUNs from oVirt provider to
kubeVirt. The attached direct LUNs will be created in the destination
cluster. It will be connected to the VM as PVC and a PV which contains
the relevant direct LUN details.

Only on late oVirt version the API provides the relevant details.
Therefore, older version can not perform this flow.

The storage should be exposed to the destination environment.

@ahadas
Copy link
Member

ahadas commented May 31, 2023

@liranr23 I took a look and it doesn't seem that the ovirt go-sdk was built since @bennyz added those fields that should be consumed here so that might explain why forklift doesn't get them

@liranr23
Copy link
Member Author

@liranr23 I took a look and it doesn't seem that the ovirt go-sdk was built since @bennyz added those fields that should be consumed here so that might explain why forklift doesn't get them

that doesn't matter as we get the data using raw http client not ovirt-go-sdk

@ahadas
Copy link
Member

ahadas commented May 31, 2023

\

@liranr23 I took a look and it doesn't seem that the ovirt go-sdk was built since @bennyz added those fields that should be consumed here so that might explain why forklift doesn't get them

that doesn't matter as we get the data using raw http client not ovirt-go-sdk

not sure I'm following why the raw client is relevant here but looking at this, it looks like the code we use is supposed to set the address..

@liranr23
Copy link
Member Author

\

@liranr23 I took a look and it doesn't seem that the ovirt go-sdk was built since @bennyz added those fields that should be consumed here so that might explain why forklift doesn't get them

that doesn't matter as we get the data using raw http client not ovirt-go-sdk

not sure I'm following why the raw client is relevant here but looking at this, it looks like the code we use is supposed to set the address..

it does. thanks to miguel the problem was on ovirt (in my opinion). some details are not showed when querying the list of disks and when checking out the specific disk it has all the details.

@codecov
Copy link

codecov bot commented May 31, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (3533ffb) 0.00% compared to head (9b556c5) 0.00%.

❗ Current head 9b556c5 differs from pull request most recent head c87dd17. Consider uploading reports for the commit c87dd17 to get more accurate results

Additional details and impacted files
@@     Coverage Diff     @@
##   main   #371   +/-   ##
===========================
===========================

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ahadas
Copy link
Member

ahadas commented May 31, 2023

\

@liranr23 I took a look and it doesn't seem that the ovirt go-sdk was built since @bennyz added those fields that should be consumed here so that might explain why forklift doesn't get them

that doesn't matter as we get the data using raw http client not ovirt-go-sdk

not sure I'm following why the raw client is relevant here but looking at this, it looks like the code we use is supposed to set the address..

it does. thanks to miguel the problem was on ovirt (in my opinion). some details are not showed when querying the list of disks and when checking out the specific disk it has all the details.

ah yeah, I remember this behavior - makes sense

@liranr23 liranr23 force-pushed the direct_luns branch 2 times, most recently from 9fb4c19 to 605a8ea Compare June 12, 2023 08:59
@liranr23 liranr23 marked this pull request as ready for review June 12, 2023 08:59
@liranr23
Copy link
Member Author

A gap exist when the VM is set only with direct lun. then we must have storage map (ui and backend), but any map will work (without really doing anything).

@liranr23 liranr23 force-pushed the direct_luns branch 2 times, most recently from 381c85d to 49f04dc Compare June 15, 2023 08:43
@ahadas ahadas changed the title Introduce direct LUNs from ovirt Migrate VMs with direct LUNs from ovirt Jun 27, 2023
return
}
} else if len(da.Disk.Lun.LogicalUnits.LogicalUnit) > 0 && da.Disk.Lun.LogicalUnits.LogicalUnit[0].Address == "" {
// have LUN but without the relevant data
Copy link
Member

Choose a reason for hiding this comment

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

that's the information we get from oVirt, unrelated to the storage mapping, right? in that case, why putting it here?

Copy link
Member Author

Choose a reason for hiding this comment

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

because we fill up the inventory and in older ovirt versions we won't get the whole details. if so - we can't proceed with the migration

Copy link
Member

Choose a reason for hiding this comment

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

yeah, it makes sense to do that but the question is why here - can't we filter out this information before saving it to the inventory then?

Copy link
Member Author

Choose a reason for hiding this comment

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

filtering before saving - so the vm will be without the disk?

Copy link
Member

Choose a reason for hiding this comment

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

oh that's even better - then we can produce a validation error!

Copy link
Member Author

Choose a reason for hiding this comment

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

how so? empty map is allowed...

Copy link
Member

@ahadas ahadas Jul 2, 2023

Choose a reason for hiding this comment

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

right but the storage map is set later on - I'm referring to an earlier phase where we examine the vm from the source, if we see a diskless vm (e.g., a vm with a lun disk that we cannot migrate) then we can produce a validation error (not necessarily an 'error', maybe a 'warning in the general case and an 'error' when the vm is set with a bootable disk that we cannot migrate)

Copy link
Member

Choose a reason for hiding this comment

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

I still think it would be better to filter out the disk so we won't see invalid disks in the storage mapping and ideally also have a validation warning about this

pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Show resolved Hide resolved
pkg/controller/plan/adapter/ovirt/builder.go Outdated Show resolved Hide resolved
pkg/controller/plan/adapter/ovirt/builder.go Outdated Show resolved Hide resolved
pkg/controller/plan/adapter/ovirt/client.go Show resolved Hide resolved
pkg/controller/plan/migration.go Outdated Show resolved Hide resolved
pkg/controller/plan/migration.go Outdated Show resolved Hide resolved
if err != nil {
return
}
}
Copy link
Member

Choose a reason for hiding this comment

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

this code is not that clear - what does it do?

Copy link
Member Author

Choose a reason for hiding this comment

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

when we get disks from ovirt it gives us the list. only when querying the disk we will get full details (in case of LUN we need them).

Copy link
Member

Choose a reason for hiding this comment

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

so shouldn't it be 'get'?

Copy link
Member Author

Choose a reason for hiding this comment

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

i'm getting an error when it's get.

{"level":"info","ts":1688392887.263588,"logger":"collector|ovirt","msg":"Failed.","provider":"konveyor-forklift/ovirt","url":"engineurl/disks/c467d491-2646-44f2-bd5c-f4bff1c3186b","phase":"load","error":"not found.","stacktrace":"\ngithub.com/konveyor/forklift-controller/pkg/controller/provider/container/ovirt.(*Client).get.func1()\n\tpkg/controller/provider/container/ovirt/client.go:173\ngithub.com/konveyor/forklift-controller/pkg/controller/provider/container/ovirt.(*Client).get()\n\tpkg/controller/provider/container/ovirt/client.go:188\ngithub.com/konveyor/forklift-controller/pkg/controller/provider/container/ovirt.(*DiskAdapter).List()\n\tpkg/controller/provider/container/ovirt/model.go:1014\ngithub.com/konveyor/forklift-controller/pkg/controller/provider/container/ovirt.(*Collector).create()\n\tpkg/controller/provider/container/ovirt/collector.go:279\ngithub.com/konveyor/forklift-controller/pkg/controller/provider/container/ovirt.(*Collector).load()\n\tpkg/controller/prov...

Copy link
Member

Choose a reason for hiding this comment

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

@liranr23 the response of the 'list' call should specify the URL of each disk AFAIR, what's the URL of the disk c467d491-2646-44f2-bd5c-f4bff1c3186b there?

@ahadas
Copy link
Member

ahadas commented Jun 27, 2023

@liranr23 it looks good overall!

pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
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.

@liranr23 I thought you said the changes to the 'rego' files don't seem to work - so this PR is not up-to-date in this area, right?

pkg/controller/plan/adapter/ovirt/client.go Show resolved Hide resolved
pkg/controller/plan/migration.go Outdated Show resolved Hide resolved
liranr23 and others added 7 commits July 17, 2023 00:02
This patch will collect the data from oVirt provider regarding direct
LUNs and populate the inventory.

Signed-off-by: Liran Rotenberg <lrotenbe@redhat.com>
This patch will allow importing direct LUNs from oVirt provider to
kubeVirt. The attached direct LUNs will be created in the destination
cluster. It will be connected to the VM as PVC and a PV which contains
the relevant direct LUN details.

Only on late oVirt version the API provides the relevant details.
Therefore, older version can not perform this flow.

The storage should be exposed to the destination environment.

Signed-off-by: Liran Rotenberg <lrotenbe@redhat.com>
Signed-off-by: Liran Rotenberg <lrotenbe@redhat.com>
When failing to get the VM from the inventory to detach its LUN disks.

Signed-off-by: Arik Hadas <ahadas@redhat.com>
And improve the comment that describes it.

Signed-off-by: Arik Hadas <ahadas@redhat.com>
Signed-off-by: Arik Hadas <ahadas@redhat.com>
Signed-off-by: Arik Hadas <ahadas@redhat.com>
Signed-off-by: Arik Hadas <ahadas@redhat.com>
@sonarcloud
Copy link

sonarcloud bot commented Jul 16, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
5.7% 5.7% Duplication

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.

the open threads can be resolved separately

@ahadas ahadas requested a review from bennyz July 16, 2023 22:04
@ahadas ahadas merged commit 1557a58 into kubev2v:main Jul 17, 2023
7 checks passed
@liranr23 liranr23 deleted the direct_luns branch November 20, 2023 14:08
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.

3 participants