HI,all:
I'm
new to libvirt, and have some questions about How to get the IP address of a
Domain?
I
searched the old mails int the mail-list ,found one way to do this,it is
first get the mac address of the Domain,then used some
sniffer or
arp tools to fetch the IP address , but:
Q1:
Is there any APIs of libvirt to get the domain's IP address directly? If does
not exist now , have any plan to add this api or some extra tools to do this
,just like the vm-tools on
VMware ESX?
Q2:
How to get the domain's mac? I download the virt-manager src, searching it's
source to find how to do this :
in details.py , this line seems to
get the mac address:
in function
update_hwlist(hwtype, info, name, icon_name):
Line 2475
for net in self.vm.get_network_devices():
mac = net.macaddr
update_hwlist(HW_LIST_TYPE_NIC, net,
"NIC %s" % mac[-9:], "network-idle") then
,I looked into domains.py, in function
get_network_devices():
def get_network_devices(self, refresh_if_necc=True):
return self._build_device_list("interface", refresh_if_necc)
next, go to function
_build_device_list()
def _build_device_list(self, device_type,
refresh_if_necc=True, inactive=False):
guest = self._get_guest(refresh_if_necc=refresh_if_necc,
inactive=inactive)
devs = guest.get_devices(device_type)
count = 0
for dev in devs:
dev.vmmindex = count
count += 1
return devs
finally ,in funciton
_get_guest(self, inactive=False, refresh_if_necc=True)
def _get_guest(self, inactive=False, refresh_if_necc=True):
raise NotImplementedError() this puzzled me , only raise a exception NotImplentedError(),but not deal
with it .
How to get the mac address?
Sorry ,I 'm new to Python either...
Really appreciate for your help!
wade
|
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list