remove VM hostname from the responsabilities

This commit is contained in:
ghe0 2025-03-21 20:11:38 +02:00
parent f3c43e3ad3
commit 8e0bca9dd8
Signed by: ghe0
GPG Key ID: 451028EE56A0FBB4
2 changed files with 3 additions and 7 deletions

2
Cargo.lock generated

@ -373,7 +373,7 @@ dependencies = [
[[package]] [[package]]
name = "detee-shared" name = "detee-shared"
version = "0.1.0" version = "0.1.0"
source = "git+ssh://git@gitea.detee.cloud/testnet/proto?branch=main#cf0c9a2c0d2edf9254f25c6faa7494afcfa00d64" source = "git+ssh://git@gitea.detee.cloud/testnet/proto?branch=main#70e83dd0e982eeb491212c4a9d265df0b148fe24"
dependencies = [ dependencies = [
"base64", "base64",
"prost", "prost",

@ -391,7 +391,6 @@ pub struct VMNIC {
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct VM { pub struct VM {
pub uuid: String, pub uuid: String,
hostname: String,
admin_key: String, admin_key: String,
fw_ports: Vec<(u16, u16)>, fw_ports: Vec<(u16, u16)>,
nics: Vec<VMNIC>, nics: Vec<VMNIC>,
@ -459,7 +458,6 @@ impl From<VM> for snp_proto::UpdateVmResp {
#[derive(Deserialize, Debug)] #[derive(Deserialize, Debug)]
pub struct NewVMRequest { pub struct NewVMRequest {
uuid: String, uuid: String,
hostname: String,
admin_key: String, admin_key: String,
extra_ports: Vec<u16>, extra_ports: Vec<u16>,
public_ipv4: bool, public_ipv4: bool,
@ -478,7 +476,6 @@ impl From<snp_proto::NewVmReq> for NewVMRequest {
fn from(req: snp_proto::NewVmReq) -> Self { fn from(req: snp_proto::NewVmReq) -> Self {
Self { Self {
uuid: req.uuid, uuid: req.uuid,
hostname: req.hostname,
admin_key: req.admin_pubkey, admin_key: req.admin_pubkey,
extra_ports: req.extra_ports.iter().map(|&port| port as u16).collect(), extra_ports: req.extra_ports.iter().map(|&port| port as u16).collect(),
public_ipv4: req.public_ipv4, public_ipv4: req.public_ipv4,
@ -639,7 +636,6 @@ impl VM {
let vm = VM { let vm = VM {
uuid: req.uuid, uuid: req.uuid,
hostname: req.hostname,
admin_key: req.admin_key, admin_key: req.admin_key,
nics: vm_nics, nics: vm_nics,
vcpus: req.vcpus, vcpus: req.vcpus,
@ -803,8 +799,8 @@ impl VM {
i += 1; i += 1;
} }
let admin_key = format!("detee_admin={} ", self.admin_key); let admin_key = format!("detee_admin={} ", self.admin_key);
let hostname = format!("detee_name={}", self.hostname); let uuid = format!("detee_uuid={}", self.uuid);
format!("{}{}{}", ip_string, admin_key, hostname) format!("{}{}{}", ip_string, admin_key, uuid)
} }
fn write_config(&self) -> Result<()> { fn write_config(&self) -> Result<()> {