Skip to content

Add CPU info to VM hosts, templates, and custom pricing#54

Merged
v0l merged 1 commit into
masterfrom
copilot/add-cpu-type-to-templates
Feb 20, 2026
Merged

Add CPU info to VM hosts, templates, and custom pricing#54
v0l merged 1 commit into
masterfrom
copilot/add-cpu-type-to-templates

Conversation

Copilot AI commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

CPU information is missing from VM hosts, templates, and custom pricing models, making it impossible to differentiate CPU workloads in offers or provisioning logic.

Changes

New struct and helpers (lnvps_db)

CpuIdEntry — represents a single CPUID instruction result stored on hosts:

Field Type Description
leaf u32 CPUID leaf (input EAX)
eax u32 EAX register output
ebx u32 EBX register output
ecx u32 ECX register output
edx u32 EDX register output

Helper functions cpuid_to_bytes and bytes_to_cpuid pack/unpack lists of CpuIdEntry to/from raw bytes (20 bytes per entry).

Database

Migration 20260219000000_cpu_type.sql adds CPU-related columns to all three tables:

Table Columns Semantics
vm_host cpuid VARBINARY(1024) NOT NULL DEFAULT '' Full raw CPUID dump from the physical host CPU
vm_template cpu_manufacturer VARCHAR(64) DEFAULT NULL, cpu_product VARCHAR(64) DEFAULT NULL Human-readable CPU filter; NULL = any CPU
vm_custom_pricing cpu_manufacturer VARCHAR(64) DEFAULT NULL, cpu_product VARCHAR(64) DEFAULT NULL Human-readable CPU filter; NULL = any CPU

All INSERT/UPDATE queries updated accordingly.

API (lnvps_api_common)

The raw CPUID binary is not exposed to the consumer API. Instead, templates and custom pricing expose human-readable filter fields:

  • ApiVmTemplate: optional cpu_manufacturer: Option<String> and cpu_product: Option<String> (omitted when null)
  • ApiCustomTemplateParams: optional cpu_manufacturer: Option<String> and cpu_product: Option<String> (omitted when null)

Admin API (lnvps_api_admin)

  • AdminHostInfo: cpuid: Vec<ApiCpuIdEntry> (full raw host CPUID dump, using ApiCpuIdEntry with named register fields)
  • AdminVmTemplateInfo, AdminCustomPricingInfo: cpu_manufacturer: Option<String> and cpu_product: Option<String> (omitted when null)
  • Create/update request structs accept the same optional fields (backward-compatible)
  • copy_custom_pricing propagates cpu_manufacturer and cpu_product from source
Original prompt

This section details on the original issue you should resolve

<issue_title>CPU info</issue_title>
<issue_description>Include CPU type in vm templates

  • Host CPU type
  • Template CPU type
  • Custom Pricing CPU type

CPU type should be an enum representing a matix like IntelX86, IntelX64, AMDx64 and so on, include 32bit/64bit/armv7 and arm64</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI assigned Copilot and v0l Feb 19, 2026
Copilot AI changed the title [WIP] Add CPU type to VM templates Add cpu_type to VM hosts, templates, and custom pricing Feb 19, 2026
Copilot AI requested a review from v0l February 19, 2026 13:07
Comment thread lnvps_db/migrations/20260219000000_cpu_type.sql Outdated
Comment thread lnvps_db/src/model.rs Outdated

Copilot AI commented Feb 19, 2026

Copy link
Copy Markdown
Contributor Author

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • git.v0l.io
    • Triggering command: /home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/bin/cargo /home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/bin/cargo metadata --format-version 1 --all-features --manifest-path /home/REDACTED/work/api/api/Cargo.toml --filter-platform x86_64-REDACTED-linux-gnu --lockfile-path /tmp/rust-analyzer1045-2/Cargo.lock -Zunstable-options (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Add cpu_type to VM hosts, templates, and custom pricing Add CPU info (manufacturer, architecture, CPUID) to VM hosts, templates, and custom pricing Feb 19, 2026
Copilot AI requested a review from v0l February 19, 2026 13:45

@v0l v0l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ive decided we should just store the raw CPUID results directly from the CPU.

raw CPUID results can be concatenated a list of results.

Each CPUID result contains a LEAF_ID (u32) and 4 register values (u32) (5xu32 for each result)

In the vm_host store BINARY(1024) which can store the raw CPUID results.

On the vm_template / vm_custom_template, the cpuid value acts as a variable list filter for CPUID results, since we dont expect to match the entire result set we can expect maybe using BINARY(25) (5x CPUID filter)

Comment thread lnvps_db/src/model.rs Outdated

Copilot AI commented Feb 19, 2026

Copy link
Copy Markdown
Contributor Author

Ive decided we should just store the raw CPUID results directly from the CPU.

raw CPUID results can be concatenated a list of results....

Done in commit 45be775. Raw CPUID data is now stored as:

  • vm_host: VARBINARY(1024) NOT NULL DEFAULT '' — full CPUID dump (list of CpuIdEntry, each 20 bytes: LEAF_ID + EAX + EBX + ECX + EDX as little-endian u32)
  • vm_template / vm_custom_pricing: VARBINARY(100) DEFAULT NULL — up to 5 CPUID filter entries (null = any CPU)

The Rust model uses Vec<u8> / Option<Vec<u8>> stored directly in the DB, with cpuid_to_bytes/bytes_to_cpuid helpers for packing/unpacking. The JSON API exposes Vec<ApiCpuIdEntry> with named fields {leaf, eax, ebx, ecx, edx}.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • git.v0l.io
    • Triggering command: /home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/bin/cargo /home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/bin/cargo metadata --format-version 1 --all-features --manifest-path /home/REDACTED/work/api/api/Cargo.toml --filter-platform x86_64-REDACTED-linux-gnu --lockfile-path /tmp/rust-analyzer1012-0/Cargo.lock -Zunstable-options (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Add CPU info (manufacturer, architecture, CPUID) to VM hosts, templates, and custom pricing Add raw CPUID data to VM hosts, templates, and custom pricing Feb 19, 2026
Copilot AI requested a review from v0l February 19, 2026 14:34
Comment thread lnvps_db/src/model.rs Outdated
Comment thread lnvps_api_common/src/model.rs Outdated

Copilot AI commented Feb 19, 2026

Copy link
Copy Markdown
Contributor Author

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • git.v0l.io
    • Triggering command: /home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/bin/cargo /home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/bin/cargo metadata --format-version 1 --all-features --manifest-path /home/REDACTED/work/api/api/Cargo.toml --filter-platform x86_64-REDACTED-linux-gnu --lockfile-path /tmp/rust-analyzer1003-2/Cargo.lock -Zunstable-options (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Add raw CPUID data to VM hosts, templates, and custom pricing Add CPU info to VM hosts, templates, and custom pricing Feb 19, 2026
Copilot AI requested a review from v0l February 19, 2026 15:00
@v0l
v0l force-pushed the copilot/add-cpu-type-to-templates branch from 468edf5 to 009c0c0 Compare February 20, 2026 13:39
@v0l
v0l marked this pull request as ready for review February 20, 2026 13:39
@v0l
v0l force-pushed the copilot/add-cpu-type-to-templates branch 2 times, most recently from 026a530 to 4e26c14 Compare February 20, 2026 14:13
- Add CpuMfg, CpuArch, and CpuFeature enums for CPU type specification
- Add cpu_mfg, cpu_arch, cpu_features columns to vm_host, vm_template,
  vm_custom_pricing, and vm_custom_template tables
- Add lnvps_host_util crate with lnvps-host-info binary for detecting
  CPU/GPU features on hosts via SSH
- Add SSH credentials (ssh_user, ssh_key) to vm_host for remote execution
- Add CommaSeparated<T> type for storing feature lists in database
- Update capacity filtering to match hosts by CPU requirements
- Cross-compile host-info binary for x86_64 and arm64 in Dockerfile
- Update admin API with CPU fields for templates, pricing, and hosts
- Update user API documentation with CPU feature enums
@v0l
v0l force-pushed the copilot/add-cpu-type-to-templates branch from 4e26c14 to f0d45fe Compare February 20, 2026 14:16
@v0l
v0l merged commit 21079e8 into master Feb 20, 2026
5 of 6 checks passed
@v0l
v0l deleted the copilot/add-cpu-type-to-templates branch February 20, 2026 16:22
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.

CPU info

2 participants