Skip to content

Commit

Permalink
vpshere-vm: suffix node vm name with uuid
Browse files Browse the repository at this point in the history
To avoid potential conflicts, suffix node vm names with uuid
  • Loading branch information
etungsten committed Dec 12, 2023
1 parent 96bc97d commit 8a487a9
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use std::process::Command;
use std::time::Duration;
use testsys_model::{Configuration, SecretName};
use toml::Value;
use uuid::Uuid;

/// The default number of VMs to spin up.
const DEFAULT_VM_COUNT: i32 = 2;
Expand Down Expand Up @@ -384,8 +385,10 @@ impl Create for VMCreator {
.await
.context(resources, "Error sending cluster creation message")?;
info!("Launching {} Bottlerocket worker nodes", vm_count);
for i in 0..vm_count {
let node_name = format!("{}-node-{}", vsphere_cluster.name, i + 1);
for _ in 0..vm_count {
let mut vm_uuid = Uuid::new_v4().simple().to_string();
vm_uuid.truncate(8);
let node_name = format!("{}-node-{}", vsphere_cluster.name, vm_uuid);
info!("Cloning VM for worker node '{}'", node_name);
let vm_clone_output = Command::new("govc")
.arg("vm.clone")
Expand Down

0 comments on commit 8a487a9

Please sign in to comment.