MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / validate_identifier

Method validate_identifier

vmm/src/config.rs:2830–2845  ·  view source on GitHub ↗
(
        id_list: &mut BTreeSet<String>,
        id: &Option<String>,
    )

Source from the content-addressed store, hash-verified

2828
2829impl VmConfig {
2830 fn validate_identifier(
2831 id_list: &mut BTreeSet<String>,
2832 id: &Option<String>,
2833 ) -> ValidationResult<()> {
2834 if let Some(id) = id.as_ref() {
2835 if id.starts_with("__") {
2836 return Err(ValidationError::InvalidIdentifier(id.clone()));
2837 }
2838
2839 if !id_list.insert(id.clone()) {
2840 return Err(ValidationError::IdentifierNotUnique(id.clone()));
2841 }
2842 }
2843
2844 Ok(())
2845 }
2846
2847 pub fn backed_by_shared_memory(&self) -> bool {
2848 if self.memory.shared || self.memory.hugepages {

Callers

nothing calls this directly

Calls 2

cloneMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected