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

Validate hostname when creating a host #6712

Closed
3 tasks
dann1 opened this issue Sep 5, 2024 · 1 comment
Closed
3 tasks

Validate hostname when creating a host #6712

dann1 opened this issue Sep 5, 2024 · 1 comment

Comments

@dann1
Copy link
Contributor

dann1 commented Sep 5, 2024

Description
It is possible to create a host whose hostname contains whitespaces at the beginning.

root@PC04:~# onehost create ' localhost' -i kvm -v kvm
ID: 2
root@PC04:~# onehost list
  ID NAME                                                                                                                CLUSTER    TVM      ALLOCATED_CPU      ALLOCATED_MEM STAT
   2  localhost                                                                                                          default      0                  -                  - err
   0 localhost                                                                                                           default      6  2150 / 9600 (22%) 28.3G / 128G (22%) on

The call succeeds, however it will lead to errors. The whitespace being next to a regular whitespace makes the error not so obvious.

root@PC04:~# onehost show 2
HOST 2 INFORMATION
ID                    : 2
NAME                  :  localhost
CLUSTER               : default
STATE                 : ERROR
IM_MAD                : kvm
VM_MAD                : kvm
LAST MONITORING TIME  : -

HOST SHARES
RUNNING VMS           : 0
MEMORY
  TOTAL               : 0K
  TOTAL +/- RESERVED  : 0K
  USED (REAL)         : 0K
  USED (ALLOCATED)    : 0K
CPU
  TOTAL               : 0
  TOTAL +/- RESERVED  : 0
  USED (REAL)         :
  USED (ALLOCATED)    : 0

MONITORING INFORMATION
ERROR="Thu Sep  5 03:27:36 2024 : Error monitoring Host  localhost (2): "
IM_MAD="kvm"
RESERVED_CPU=""
RESERVED_MEM=""
VM_MAD="kvm"

WILD VIRTUAL MACHINES

NAME                                                      IMPORT_ID  CPU     MEMORY

VIRTUAL MACHINES

Column 'HOST' not found

The idea is to improve the already existing validation on the API Call.

root@PC04:~# onehost create '' -i kvm -v kvm
[one.host.allocate] Invalid NAME, it cannot be empty

Use case
Prevent errors after a seemingly successful host creation.

Progress Status

  • Code committed
  • Testing - QA
  • Documentation (Release notes - resolved issues, compatibility, known issues)
@aioue
Copy link

aioue commented Oct 7, 2024

Creation also accepts underscore which isn't a valid hostname character.

@paczerny paczerny assigned paczerny and vvbohdan and unassigned paczerny Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants