Open liranr23 opened 6 months ago
but in order to do so you will need to query both VirtualMachineInstancetype from the destination cluster namespace and VirtualMachineClusterInstancetype. If that's too difficult, maybe a text box will be enough.
If the inventory will add an /instancetypes
endpoint it will be possible.
like we do for networks: https://github.com/kubev2v/forklift/blob/a4ce2e8dcfe3a083654c2b68581efc88e2d34167/pkg/controller/provider/web/ocp/netattachdefinition.go#L18
cc:// @ahadas
but in order to do so you will need to query both VirtualMachineInstancetype from the destination cluster namespace and VirtualMachineClusterInstancetype. If that's too difficult, maybe a text box will be enough.
If the inventory will add an
/instancetypes
endpoint it will be possible.like we do for networks: https://github.com/kubev2v/forklift/blob/a4ce2e8dcfe3a083654c2b68581efc88e2d34167/pkg/controller/provider/web/ocp/netattachdefinition.go#L18
cc:// @ahadas
+1 makes sense, it better not be a free text field
Once https://github.com/kubev2v/forklift/pull/824 will go in you can query like this:
https://<inventory-url>/providers/openshift/<provider-id>/clusterinstancetypes/?detail=1
for namespace specific (most likely user made):
https://<inventory-url>/providers/openshift/<provider-id>/instancetypes/?detail=1
you can also do single get using:
https://<inventory-url>/providers/openshift/<provider-id>/clusterinstancetypes/<clusterinstancetype-id>?detail=1
an example of a response of single get (https://<inventory-url>/providers/openshift/d1284344-be63-4c88-8d05-c067b09cce42/clusterinstancetypes/2bb1bc4b-2990-4953-8083-9a0a8db2e693?detail=1
):
{
"uid": "2bb1bc4b-2990-4953-8083-9a0a8db2e693",
"version": "41620",
"namespace": "",
"name": "u1.nano",
"selfLink": "providers/openshift/d1284344-be63-4c88-8d05-c067b09cce42/clusterinstancetypes/:clusterinstancetype",
"id": "2bb1bc4b-2990-4953-8083-9a0a8db2e693",
"object": {
"kind": "VirtualMachineClusterInstancetype",
"apiVersion": "instancetype.kubevirt.io/v1beta1",
"metadata": {
"name": "u1.nano",
"uid": "2bb1bc4b-2990-4953-8083-9a0a8db2e693",
"resourceVersion": "41620",
"generation": 1,
"creationTimestamp": "2024-03-31T16:09:25Z",
"labels": {
"app.kubernetes.io/component": "templating",
"app.kubernetes.io/managed-by": "ssp-operator",
"app.kubernetes.io/name": "common-instancetypes",
"app.kubernetes.io/part-of": "hyperconverged-cluster",
"app.kubernetes.io/version": "4.14.4",
"instancetype.kubevirt.io/common-instancetypes-version": "v0.3.5",
"instancetype.kubevirt.io/cpu": "1",
"instancetype.kubevirt.io/memory": "512Mi",
"instancetype.kubevirt.io/vendor": "redhat.com"
},
"annotations": {
"instancetype.kubevirt.io/class": "General Purpose",
"instancetype.kubevirt.io/description": "The U Series is quite neutral and provides resources for\ngeneral purpose applications.\n\n*U* is the abbreviation for \"Universal\", hinting at the universal\nattitude towards workloads.\n\nVMs of instance types will share physical CPU cores on a\ntime-slice basis with other VMs.",
"instancetype.kubevirt.io/version": "1",
"openshift.io/documentation-url": "https://access.redhat.com",
"openshift.io/provider-display-name": "Red Hat",
"openshift.io/support-url": "https://access.redhat.com",
"operator-sdk/primary-resource": "openshift-cnv/ssp-kubevirt-hyperconverged",
"operator-sdk/primary-resource-type": "SSP.ssp.kubevirt.io"
},
"managedFields": [
{
"manager": "manager",
"operation": "Update",
"apiVersion": "instancetype.kubevirt.io/v1beta1",
"time": "2024-03-31T16:09:25Z",
"fieldsType": "FieldsV1",
"fieldsV1": {
"f:metadata": {
"f:annotations": {
".": {},
"f:instancetype.kubevirt.io/class": {},
"f:instancetype.kubevirt.io/description": {},
"f:instancetype.kubevirt.io/version": {},
"f:openshift.io/documentation-url": {},
"f:openshift.io/provider-display-name": {},
"f:openshift.io/support-url": {},
"f:operator-sdk/primary-resource": {},
"f:operator-sdk/primary-resource-type": {}
},
"f:labels": {
".": {},
"f:app.kubernetes.io/component": {},
"f:app.kubernetes.io/managed-by": {},
"f:app.kubernetes.io/name": {},
"f:app.kubernetes.io/part-of": {},
"f:app.kubernetes.io/version": {},
"f:instancetype.kubevirt.io/common-instancetypes-version": {},
"f:instancetype.kubevirt.io/cpu": {},
"f:instancetype.kubevirt.io/memory": {},
"f:instancetype.kubevirt.io/vendor": {}
}
},
"f:spec": {
".": {},
"f:cpu": {
".": {},
"f:guest": {}
},
"f:memory": {
".": {},
"f:guest": {}
}
}
}
}
]
},
"spec": {
"cpu": {
"guest": 1
},
"memory": {
"guest": "512Mi"
}
}
}
}
Note: this also affect the "Calculated resources VMs migration plan will consume on target cluster"
This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 15 days.
let's not merge this for 2.7, let's merge this later.
adding @dgur for visibitly
We are going to add a new feature in https://issues.redhat.com/browse/MTV-919, to allow the setting an instance type to the plan. In order to do that, the user needs to specify he wish to preserve it by setting it within the plan: selectedInstanceType=
e.g the plan will look like:
where you can see the new flag under the spec (like warm migrations). The field is optional, but to select using the feature is must be there and set to requested instance type. In the UI a drop down list in order to use it will be the best option to the users, but in order to do so you will need to query both
VirtualMachineInstancetype
from the destination cluster namespace andVirtualMachineClusterInstancetype
. If that's too difficult, maybe a text box will be enough. The backend part is still WIP.