Package virtualization :: Module domain_directory :: Class DomainDirectory
[hide private]
[frames] | no frames]

Class DomainDirectory

source code

Instance Methods [hide private]
 
__init__(self) source code
 
get_config_path(self, uuid) source code
 
is_known_config(self, uuid)
Returns true if a config for the given uuid is saved in the directory.
source code
 
load_config(self, uuid)
This function loads a domain's configuration by its UUID.
source code
 
create_standard_config(self, uuid, name, mem_kb, vcpus, disk, mac) source code
 
save_unknown_domain_configs(self, domain_uuids)
This function saves the configuration for any domains whose UUIDs are passed in the domain_uuids list.
source code
 
__fixup_config_for_restart(self, config)
This function edits the given configuration so that it can be used in subsequent calls to libvirt's createLinux call.
source code
 
__write_xml_file(self, uuid, xml) source code
Method Details [hide private]

load_config(self, uuid)

source code 

This function loads a domain's configuration by its UUID. A DomainConfig object is returned.

save_unknown_domain_configs(self, domain_uuids)

source code 

This function saves the configuration for any domains whose UUIDs are passed in the domain_uuids list. If the UUID is already known, it is skipped.

__fixup_config_for_restart(self, config)

source code 

This function edits the given configuration so that it can be used in subsequent calls to libvirt's createLinux call. Specifically, the following modifications are made:

  • Remove the "id" attribute from the <domain> tag. The "id" is whatever the hypervisor wants to assign to it, so we should not try to assign it explicitly.
  • Determine whether the config contains an <os> section.
    • If it does, check whether the kernel and the initrd files it refers to actually exist on disk.
      • If so, do nothing.
      • If not, remove the entire <os> section and insert a <bootloader> section if one does not yet exist. These files might not exist if the instance was started by xm using a bootloader such as pygrub, which makes temporary copies of the kernel & initrd and then removes them after starting the instance.
    • If it does not, ensure there is a <bootloader> section or add one if needed.