(self)
| 198 | return range_pcpus |
| 199 | |
| 200 | def get_net_device(self): |
| 201 | def get_mac_ipaddr(net, mac_host): |
| 202 | def fixed(ctx): |
| 203 | for net in ctx.xpathEval('/network/ip/dhcp/host'): |
| 204 | mac = net.xpathEval('@mac')[0].content |
| 205 | host = net.xpathEval('@ip')[0].content |
| 206 | if mac == mac_host: |
| 207 | return host |
| 208 | return None |
| 209 | |
| 210 | return util.get_xml_path(net.XMLDesc(0), func=fixed) |
| 211 | |
| 212 | def networks(ctx): |
| 213 | result = [] |
| 214 | for net in ctx.xpathEval('/domain/devices/interface'): |
| 215 | mac_host = net.xpathEval('mac/@address')[0].content |
| 216 | nic_host = net.xpathEval('source/@network|source/@bridge|source/@dev|target/@dev')[0].content |
| 217 | try: |
| 218 | net = self.get_network(nic_host) |
| 219 | ip = get_mac_ipaddr(net, mac_host) |
| 220 | except: |
| 221 | ip = None |
| 222 | result.append({'mac': mac_host, 'nic': nic_host, 'ip': ip}) |
| 223 | return result |
| 224 | |
| 225 | return util.get_xml_path(self._XMLDesc(0), func=networks) |
| 226 | |
| 227 | def get_disk_device(self): |
| 228 | def disks(ctx): |
no test coverage detected