Struct Vm

Source
pub struct Vm<O> {
    pub id: VmId,
    pub name_label: String,
    pub name_description: String,
    pub power_state: PowerState,
    pub pool: String,
    pub tags: Vec<String>,
    pub os_version: BTreeMap<String, String>,
    pub other: O,
    /* private fields */
}
Expand description

Type representing a VM

Note that the “other” property contains a lot of different data. In the Xen Orchestra the user may even add additional values. For this reason the struct is made generic over the type O. See the trait OtherInfo for more info

Also see https://github.com/vatesfr/xen-orchestra/blob/a505cd9567233aab7ca6488b2fb8a0b6c610fa08/packages/xo-server/src/xapi-object-to-xo.mjs#L273

Fields§

§id: VmId§name_label: String§name_description: String§power_state: PowerState§pool: String§tags: Vec<String>§os_version: BTreeMap<String, String>§other: O

Implementations§

Source§

impl<'a, O: DeserializeOwned> Vm<O>

Source

pub fn is_running(&self) -> bool

Check if VM is running.

Source

pub fn distro(&self) -> Option<&str>

Try to guess OS distro of VM

Note: This only works for running VMs, returns None when distro can not be determined.

Source

pub fn ipv4_addresses(&self) -> impl Iterator<Item = Ipv4Addr> + '_

Get iterator of all valid IPv4 addresses for VM.

Note: This only works for running VMs, returns empty iterator otherwise

Trait Implementations§

Source§

impl<O: Debug> Debug for Vm<O>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, O> Deserialize<'de> for Vm<O>
where O: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

§

impl<O> Freeze for Vm<O>
where O: Freeze,

§

impl<O> RefUnwindSafe for Vm<O>
where O: RefUnwindSafe,

§

impl<O> Send for Vm<O>
where O: Send,

§

impl<O> Sync for Vm<O>
where O: Sync,

§

impl<O> Unpin for Vm<O>
where O: Unpin,

§

impl<O> UnwindSafe for Vm<O>
where O: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,