def __init__(self, deltacloud, dom): self._deltacloud = deltacloud self.xml = dom.toxml() self.id = xml_get_text(dom, "id")[0] self.name = xml_get_text(dom, "name")[0] self.state = xml_get_text(dom, "state")[0] self.limit = xml_get_text(dom, "limit")[0]
def __init__(self, deltacloud, dom): self._deltacloud = deltacloud self.xml = dom.toxml() self.id = xml_get_text(dom, "id")[0] self.memory = xml_get_text(dom, "memory")[0] self.storage = xml_get_text(dom, "storage")[0] self.architecture = xml_get_text(dom, "architecture")[0]
def _xml_to_instance(xml, driver): # Get image_id image_id = _id_from_url( xml.getElementsByTagName("image")[0].getAttribute("href") ) # Get realm_id realm_id = _id_from_url( xml.getElementsByTagName("realm")[0].getAttribute("href") ) # Get Addresses public_addresses_element = xml.getElementsByTagName("public_addresses")[0] private_addresses_element = xml.getElementsByTagName("private_addresses")[0] public_addresses = xml_get_text(public_addresses_element, "address") private_addresses = xml_get_text(private_addresses_element, "address") instance = Instance( xml.getAttribute("id"), driver, xml_get_text(xml, "owner_id")[0], xml_get_text(xml, "name")[0], image_id, realm_id, xml_get_text(xml, "state")[0], public_addresses, private_addresses, ) # We set _action_urls here because we need it later when modifying the # instance's state. instance._action_urls = xml_get_elements_dictionary(xml, "link", "rel", "href") return instance
def __init__(self, deltacloud, dom): self._deltacloud = deltacloud self.xml = dom.toxml() self.created = xml_get_text(dom, "created")[0] self.state = xml_get_text(dom, "state")[0] self.capacity = xml_get_text(dom, "capacity")[0] self.device = xml_get_text(dom, "device")[0]
def _xml_to_instance(xml, driver): """Converts the xml for one vm to an ``Instance`` object.""" # Get IP addresses ips = [] for nic in xml.getElementsByTagName("NIC"): ip = xml_get_text(nic, "IP")[0] if ip: ips.append(ip) # Get image_id image_id = None for disk in xml.getElementsByTagName("DISK"): if xml_get_text(xml, "TYPE") is "disk": url = disk.getElementsByTagName("STORAGE")[0].getAttribute("href") image_id = _id_from_url(url) break return Instance( xml_get_text(xml, "ID")[0], driver, driver.name, xml_get_text(xml, "NAME")[0], image_id, "default", xml_get_text(xml, "STATE")[0], ips, ips, )
def __init__(self, deltacloud, dom): self._deltacloud = deltacloud self.xml = dom.toxml() self.id = xml_get_text(dom, "id")[0] self.owner_id = xml_get_text(dom, "owner_id")[0] self.name = xml_get_text(dom, "name")[0] self.description = xml_get_text(dom, "description")[0] self.architecture = xml_get_text(dom, "architecture")[0]
def _xml_to_realm(xml, driver): return Realm( xml.getAttribute("id"), driver, xml_get_text(xml, "name")[0], xml_get_text(xml, "state")[0].startswith("AVAILABLE"), -1, )
def _xml_to_image(xml, driver): return Image( xml.getAttribute("id"), driver, xml_get_text(xml, "owner_id")[0], xml_get_text(xml, "name")[0], xml_get_text(xml, "description")[0], xml_get_text(xml, "architecture")[0], )
def _xml_to_image(xml, driver): return Image( xml_get_text(xml, "ID")[0], driver, driver.name, xml_get_text(xml, "NAME")[0], xml_get_text(xml, "DESCRIPTION")[0], "default", )
def __init__(self, deltacloud, dom): self._deltacloud = deltacloud self.xml = dom.toxml() self.id = xml_get_text(dom, "id")[0] self.owner_id = xml_get_text(dom, "owner_id")[0] self.name = xml_get_text(dom, "name")[0] self.image = xml_get_text(dom, "image")[0] self.flavor = xml_get_text(dom, "flavor")[0] self.realm = xml_get_text(dom, "realm")[0] self.state = xml_get_text(dom, "state")[0] # Actions self.actions = xml_get_elements_dictionary(dom, "link", "rel", "href") self.available_actions = self.actions.keys() # Addresses pub_addr_element = dom.getElementsByTagName("public-addresses")[0] priv_addr_element = dom.getElementsByTagName("private-addresses")[0] self.public_addresses = xml_get_text(pub_addr_element, "address") self.private_addresses = xml_get_text(priv_addr_element, "address")
def __init__(self, deltacloud, dom): self._deltacloud = deltacloud self.xml = dom.toxml() self.name = xml_get_text(dom, "name")[0] self.transitions = []