Revert "Merge feature/generic-vm-provisioning: generalize create_vm_from_cloud_init interface"

This reverts commit 7d18c12579, reversing
changes made to 7f0dd789b0.
This commit is contained in:
2026-07-07 00:53:06 +02:00
parent 7d18c12579
commit 97cab9754b
2 changed files with 19 additions and 27 deletions
+19 -18
View File
@@ -15,7 +15,6 @@ from napalm_device_types.base import DeviceTypeDriver
from napalm_device_types._ucd_metrics import IF_SKIP_DEFAULT, collect_ucd_metrics
from napalm_device_types.models import (
HealthMetricsDict,
NICConfigDict,
PackageDict,
SnapshotDict,
StorageVolumeDict,
@@ -550,36 +549,39 @@ class HypervisorDriver(DeviceTypeDriver):
template: str,
cpu: int,
memory: int,
nics: List[NICConfigDict],
mgmt_bridge: str,
mgmt_vlan_tag: int | None,
capture_bridge: str,
capture_vlan_tags: List[int],
cloud_init_config: Dict[str, Any],
ssh_public_keys: List[str] | None = None,
disk_resize_gb: int | None = None,
timeout: int = 180,
timeout: int = 120,
) -> VMProvisionResultDict:
"""
Create a new virtual machine from a Cloud-Init template.
Clones a pre-existing VM template, configures virtual network interfaces,
and injects Cloud-Init configuration via a storage snippet or similar
mechanism. The resulting VM is left in a running state.
Clones a pre-existing VM template, configures dual NICs (management +
capture), and injects Cloud-Init configuration via a storage snippet or
similar mechanism. The resulting VM is left in a running state.
Args:
name (string) - new VM display name
template (string) - hypervisor-internal ID/name of the template VM to clone
cpu (int) - number of virtual CPUs to assign
memory (int) - RAM to assign in megabytes
nics (list[NICConfigDict]) - list of network interface configurations.
First NIC is primary (DHCP by default); subsequent NICs are optional.
Each entry specifies bridge, optional vlan_tag (access) or trunk_vlan_tags,
and dhcp flag.
mgmt_bridge (string) - network bridge for management NIC (net0)
mgmt_vlan_tag (int | None) - VLAN tag for net0 (None → untagged)
capture_bridge (string) - network bridge for packet capture NIC (net1).
Must support ``vlan-aware`` and trunk mode.
capture_vlan_tags (list[int]) - VLAN tags to place on net1 (trunk).
Packets matching any of these VLANs are visible to the guest.
cloud_init_config (dict) - user-data dict (will be rendered to YAML).
Should include hostname, bootstrap_token, runcmd, and any custom config.
Should include: ``bootstrap_token``, ``central_url``, ``satellite_id``,
``runcmd`` for custom startup sequence.
ssh_public_keys (list[str] | None) - SSH public keys to inject into guest.
If None or empty, no SSH key injection is performed.
disk_resize_gb (int | None) - resize root disk to this size in GB.
If None, disk remains template size. Default None.
timeout (int) - maximum seconds to wait for provisioning completion
(clone, config, start). Default 180.
(clone, config, start). Default 120.
Returns:
VMProvisionResultDict - ``{"vmid": str, "name": str, "node": str}``
@@ -646,9 +648,8 @@ class HypervisorDriver(DeviceTypeDriver):
Returns:
VMStatusDict - ``{"status": str, "ip_address": str, "hostname": str,
"mac_address": str}``. ip_address, hostname, and mac_address refer to
the primary NIC (first interface) and are only present if the VM is
running and has network info available.
"mac_address": str}``. ip_address, hostname, and mac_address are only
present if the VM is running and has network info available.
Raises:
RuntimeError - if the VM does not exist or if wait_for_ip=True and
-9
View File
@@ -706,15 +706,6 @@ class HealthMetricsDict(TypedDict):
interfaces: NotRequired[Dict[str, HealthMetricsIfaceDict]]
class NICConfigDict(TypedDict):
"""Network interface configuration for VM provisioning."""
bridge: str # Bridge or network name
vlan_tag: NotRequired[int | None] # Access VLAN (None = untagged)
trunk_vlan_tags: NotRequired[list[int]] # Trunk VLAN list (alternative to vlan_tag)
dhcp: NotRequired[bool] # Enable DHCP (default True for first NIC, False for others)
class VMProvisionResultDict(TypedDict):
"""Return value of ``create_vm_from_cloud_init()`` — provisioned VM identifier."""