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

replacing a list of predefined instance types #395

Closed
aivanise opened this issue Jun 10, 2021 · 2 comments · Fixed by #396
Closed

replacing a list of predefined instance types #395

aivanise opened this issue Jun 10, 2021 · 2 comments · Fixed by #396

Comments

@aivanise
Copy link

I wanted to replace this huge list of instance types, so I did this:

DROP TABLE IF EXISTS Instace_Type_Providers;
CREATE TABLE Instace_Type_Providers (
ITP_ID int NOT NULL AUTO_INCREMENT,
ITP_Name varchar(255) NOT NULL,
PRIMARY KEY (ITP_ID)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
INSERT INTO Instace_Type_Providers VALUES (1,'Local');
DROP TABLE IF EXISTS Instance_Types;
CREATE TABLE Instance_Types (
IT_ID int NOT NULL AUTO_INCREMENT,
IT_Provider_ID int NOT NULL,
IT_Name varchar(255) NOT NULL,
IT_CPU float(6,2) NOT NULL,
IT_Mem float(6,2) NOT NULL,
PRIMARY KEY (IT_ID)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
INSERT INTO Instance_Types VALUES (1,1,'small',2.00,2.00),(2,1,'medium',4.00,4.00),(3,1,'large',8.00,8.00),(4,1,'huge',16.00,16.00);

they show up correctly in the container create dialog but on creation i'm getting 'HTTP 400 bad request, unknown instance type 'small'

rebooted everything just to be sure its not cached somewhere, didn't help, what am I missing?

BTW there is a typo in the table name "Instace" instead of "instance" ;)

@turtle0x1
Copy link
Owner

turtle0x1 commented Jun 16, 2021

LXD actually uses a predefined list of instance types that can be found here, so the IT_Name column "cant" be arbitrary. (they haven't updated this list since 2019 though)

Instead we need to change it so we dont provide the instance type to LXD but lookup the limits from the database based on the name and apply them ourselves. To be backwards compatible names must be unique across all "providers" which is annoying but it will have to-do.

  • Admin page for managing instance types
  • Lookup instanceType names when using them and apply the limits to the new instance

turtle0x1 added a commit that referenced this issue Jun 23, 2021
@aivanise
Copy link
Author

thank you, works like a charm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants