VirtualMachineSettings
A virtual machine as a database record. Provider neutral: a Hyper-V machine and a Proxmox guest both project onto this shape, which is what let one repository, one unit of work and one test base span both environments.
public sealed record VirtualMachineSettings : IEquatable<VirtualMachineSettings>
1. Constructors
1.1. VirtualMachineSettings(VirtualMachineKey, MachineName, SystemManagement.Contracts.Elements.OperatingSystem, VmId, DataSize, int, DataSize, VirtualMachinePowerState)
A virtual machine as a database record. Provider neutral: a Hyper-V machine and a Proxmox guest both project onto this shape, which is what let one repository, one unit of work and one test base span both environments.
public VirtualMachineSettings(VirtualMachineKey Key, MachineName Name, SystemManagement.Contracts.Elements.OperatingSystem OperatingSystem, VmId VmId, DataSize Memory, int Cores, DataSize Disk, VirtualMachinePowerState PowerState)
| Name | Type | Description |
|---|---|---|
Key |
VirtualMachineKey |
Primary key. |
Name |
MachineName |
Machine name as the environment report it. |
OperatingSystem |
SystemManagement.Contracts.Elements.OperatingSystem |
Operating system. |
VmId |
VmId |
Numeric id within the environment. |
Memory |
DataSize |
Assigned memory. |
Cores |
int |
Assigned processor cores. A unitless count, so it stay an int. |
Disk |
DataSize |
Primary disk size. CREATE ONLY - see the property. |
PowerState |
VirtualMachinePowerState |
Normalised power state. |
2. Properties
2.1. AutoStart
Gets a value indicating whether the machine start right after insert.
public bool AutoStart { get; init; }
2.2. Cores
Assigned processor cores. A unitless count, so it stay an int.
public int Cores { get; init; }
2.3. Disk
Gets the primary disk size. Set once, at creation, and never again.
public DataSize Disk { get; }
2.4. IsVirtualMachine
Gets a value indicating whether this row describe a REAL virtual machine - the criterion a synchronisation select on.
public bool IsVirtualMachine { get; init; }
2.5. Iso
Gets the boot image NAME, e.g. nixos.iso. Null when the machine boot from disk.
public ISubPath? Iso { get; init; }
2.6. IsoStorage
Gets the storage the boot image live on. Empty mean provider default.
public StorageName IsoStorage { get; init; }
2.7. Key
Primary key.
public VirtualMachineKey Key { get; init; }
2.8. MacAddress
Gets the NIC MAC address the guest is created with. Null mean let the environment pick.
public MAC? MacAddress { get; init; }
2.9. Memory
Assigned memory.
public DataSize Memory { get; init; }
2.10. Name
Machine name as the environment report it.
public MachineName Name { get; init; }
2.11. NetworkName
Gets the virtual switch or bridge to attach.
public VirtualSwitchName NetworkName { get; init; }
2.12. OperatingSystem
Operating system. OS.Unknown when the environment do not report one.
public SystemManagement.Contracts.Elements.OperatingSystem OperatingSystem { get; init; }
2.13. PowerState
Normalised power state.
public VirtualMachinePowerState PowerState { get; init; }
2.14. SerialNumber
Gets the BIOS serial number the guest is created with. Empty mean let the environment pick.
public SerialNumber SerialNumber { get; init; }
2.15. Storage
Gets the storage the disk is created on. Empty mean provider default.
public StorageName Storage { get; init; }
2.16. VmId
Numeric id within the environment. ValueObjects.VmId.None let the provider pick.
public VmId VmId { get; init; }
3. Methods
3.1. DescribesSameMachineAs(VirtualMachineSettings)
Compare only the fields an update can actually APPLY to a live machine.
public bool DescribesSameMachineAs(VirtualMachineSettings other)
| Name | Type | Description |
|---|---|---|
other |
VirtualMachineSettings |
Live record read back from the environment. |
Returns: bool — when an update would change nothing.
4. Operators
4.1. operator !=(VirtualMachineSettings, VirtualMachineSettings)
public static bool operator !=(VirtualMachineSettings left, VirtualMachineSettings right)
| Name | Type | Description |
|---|---|---|
left |
VirtualMachineSettings |
|
right |
VirtualMachineSettings |
Returns: bool
4.2. operator ==(VirtualMachineSettings, VirtualMachineSettings)
public static bool operator ==(VirtualMachineSettings left, VirtualMachineSettings right)
| Name | Type | Description |
|---|---|---|
left |
VirtualMachineSettings |
|
right |
VirtualMachineSettings |
Returns: bool
5. Extension Methods
5.1. IsHostedOn(SerialNumber)
Whether this record describe a virtual machine living on the given host.
public static bool IsHostedOn(this VirtualMachineSettings record, SerialNumber hostSerial)
| Name | Type | Description |
|---|---|---|
record |
VirtualMachineSettings |
Record to test. |
hostSerial |
SerialNumber |
Serial of the host. |
Returns: bool — when the record belong to that host.