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

[BUG] OpenStack VM Import Can't Handle Source VM if Source VM has Camel Case #6505

Open
irishgordo opened this issue Sep 5, 2024 · 5 comments
Assignees
Labels
area/vm-importer issues related to vm-import-controller addon kind/bug Issues that are defects reported by users or that we know have reached a real release reproduce/always Reproducible 100% of the time severity/3 Function working but has a major issue w/ workaround
Milestone

Comments

@irishgordo
Copy link
Contributor

irishgordo commented Sep 5, 2024

Describe the bug

harvester-vm-import-controller-84b88445cd-9z84n time="2024-09-05T01:42:49Z" level=error msg="vm migration target openSUSE-uefi-secure in VM mr-opensuse-uefi-secre in namespace default is not RFC 1123 compliant"                          
harvester-vm-import-controller-84b88445cd-9z84n time="2024-09-05T01:42:49Z" level=info msg="vm mr-opensuse-uefi-secre in namespace default has an invalid spec"                                                                             
harvester-vm-import-controller-84b88445cd-9z84n time="2024-09-05T01:42:49Z" level=info msg="reconcilling openstack soure :default/mike-demo"                                                                                                
harvester-vm-import-controller-84b88445cd-9z84n time="2024-09-05T01:42:49Z" level=info msg="found 7 servers"                                                                                                                                
harvester-vm-import-controller-84b88445cd-9z84n time="2024-09-05T01:42:49Z" level=info msg="reconcilling openstack soure :default/mike-admin"                                                                                               
harvester-vm-import-controller-84b88445cd-9z84n time="2024-09-05T01:42:49Z" level=info msg="reconcilling openstack soure :default/mike-demo"                                                                                                                                                                                                                                                                                                                                  

In:

---
apiVersion: v1
kind: Secret
metadata: 
  name: mike-test-admin
  namespace: default
stringData:
  "username": "admin"
  "password": "testtesttest"
  "project_name": "admin"
  "domain_name": "default"
---
apiVersion: v1
kind: Secret
metadata: 
  name: mike-test-demo
  namespace: default
stringData:
  "username": "admin"
  "password": "testtesttest"
  "project_name": "demo"
  "domain_name": "default"
---
apiVersion: migration.harvesterhci.io/v1beta1
kind: OpenstackSource
metadata:
  name: mike-admin
  namespace: default
spec:
  endpoint: "http://a.b.c.182/identity"  
  region: "RegionOne"
  credentials:
    name: mike-test-admin
    namespace: default
---
apiVersion: migration.harvesterhci.io/v1beta1
kind: OpenstackSource
metadata:
  name: mike-demo
  namespace: default
spec:
  endpoint: "http://a.b.c.182/identity"  
  region: "RegionOne"
  credentials:
    name: mike-test-demo
    namespace: default
---
apiVersion: migration.harvesterhci.io/v1beta1
kind: VirtualMachineImport
metadata:
  name: mr-opensuse-uefi-secre
  namespace: default
spec: 
  virtualMachineName: "openSUSE-uefi-secure"
  networkMapping:
  - sourceNetwork: "shared"
    destinationNetwork: "default/vlan1"
  sourceCluster: 
    name: mike-demo
    namespace: default
    kind: OpenstackSource
    apiVersion: migration.harvesterhci.io/v1beta1

The VM Import won't work by "source machine's virttual vm name" -> so in OpenStack, if the source VM name is camelCased -> we can only import by UUID and not by name.

To Reproduce
Steps to reproduce the behavior:

  1. openstack, just have a vm with a camelcase name
  2. try to import by name
  3. it won't work, in the logs kubectl logs svc/vm-import-controller it will complain that the source vm isn't meeting RFC naming conventions, but the source VM may have been out of the control of the Harvester user/admin/org, so they were just using an already present name

Workaround

  • In openstack change the name of the VM to not be camelcase
  • Then import will work by name

Expected behavior
Maybe some sanitization on RFC compliance with names from VMs from OpenStack I'm not sure...

Environment

  • Harvester ISO version: v1.3.2-rc2
  • Underlying Infrastructure: bare-metal

cc: @TachunLin

@irishgordo irishgordo added kind/bug Issues that are defects reported by users or that we know have reached a real release reproduce/always Reproducible 100% of the time severity/needed Reminder to add a severity label and to remove this one area/vm-importer issues related to vm-import-controller addon severity/3 Function working but has a major issue w/ workaround labels Sep 5, 2024
@votdev votdev self-assigned this Sep 5, 2024
@votdev votdev added this to the v1.5.0 milestone Sep 5, 2024
@votdev votdev removed the severity/needed Reminder to add a severity label and to remove this one label Sep 5, 2024
@votdev
Copy link
Member

votdev commented Sep 5, 2024

It's not possible to have object names with upper case characters, otherwise this will happen:

time="2024-09-05T11:29:21Z" level=error msg="error syncing 'default/foo-test': handler virtualmachine-import-job-change: error creating kubevirt VM in createVirtualMachine :VirtualMachine.kubevirt.io \"foo-Test\" is invalid: metadata.name: Invalid value: \"foo-Test\": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'), requeuing"

See https://kubernetes.io/docs/concepts/overview/working-with-objects/names/

@votdev
Copy link
Member

votdev commented Sep 5, 2024

As already mentioned above, we could adapt the name during import so that Kubernetes does not interfere with it. To do this, however, the entire code of the vm-import-controller must be extended because spec.virtualMachineName is accessed in many places. We cannot simply change/sanitize the value of this field as this is also used when importing the VMs and if we change the name in any way, the source VM will no longer be found in the client. Therefore, the structure must be extended by a field that contains the corrected/sanitized virtualMachineName.

@votdev
Copy link
Member

votdev commented Sep 5, 2024

We could add a new field to the VirtualMachineImportStatus, e.g.

type VirtualMachineImportStatus struct {
	// The sanitized name of the target virtual machine object.
    VirtualMachineName string             `json:"virtualMachineName,omitempty"`
	Status             ImportStatus       `json:"importStatus,omitempty"`
	DiskImportStatus   []DiskInfo         `json:"diskImportStatus,omitempty"`
	ImportConditions   []common.Condition `json:"importConditions,omitempty"`
	NewVirtualMachine  string             `json:"newVirtualMachine,omitempty"`
}

This would also be helpful for the issue #6500 where the importer has to convert the ID of the source VM into the origin name at some point.

votdev added a commit to votdev/vm-import-controller that referenced this issue Sep 10, 2024
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Sep 10, 2024
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Sep 10, 2024
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Sep 10, 2024
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Sep 10, 2024
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Sep 10, 2024
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Sep 10, 2024
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
@harvesterhci-io-github-bot
Copy link
Collaborator

harvesterhci-io-github-bot commented Sep 10, 2024

Pre Ready-For-Testing Checklist

@harvesterhci-io-github-bot
Copy link
Collaborator

Automation e2e test issue: harvester/tests#1519

votdev added a commit to votdev/vm-import-controller that referenced this issue Sep 23, 2024
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Oct 7, 2024
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Oct 9, 2024
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Oct 9, 2024
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Oct 9, 2024
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Oct 9, 2024
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Nov 14, 2024
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Jan 22, 2025
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Jan 29, 2025
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Jan 29, 2025
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
(cherry picked from commit 6e6b619)
Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Jan 30, 2025
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve error and log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Jan 30, 2025
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve error and log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Jan 30, 2025
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve error and log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
votdev added a commit to votdev/vm-import-controller that referenced this issue Jan 30, 2025
- Import OpenStack server by UUID
- Import OpenStack server with upper case characters in its name

The following improvements have been done:
- Sanitize the configured `VirtualMachineName` field, e.g. convert upper case to lower case to make it RFC 1123 compliant.
- Convert UUID to real name for OpenStack imports
- Reduce waiting time to recheck if created VM is running from 5min to 2min
- Rename variable `uuid` to `serverUUID` in the OpenStack client code to do not collide with the imported uuid module
- Improve error and log messages
- Fix typos
- Add comments

Related to: harvester/harvester#6500
Related to: harvester/harvester#6505

Signed-off-by: Volker Theile <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/vm-importer issues related to vm-import-controller addon kind/bug Issues that are defects reported by users or that we know have reached a real release reproduce/always Reproducible 100% of the time severity/3 Function working but has a major issue w/ workaround
Projects
None yet
Development

No branches or pull requests

3 participants