On 05/19/2016 10:42 AM, Wei WA Li wrote:

I found these 3 mothod to get guest IP, but none works for me now.
Is it a problem that self.address_cache is {}?

----------  source -----------
arp_ip = self.address_cache.get(nic.mac.lower())
or
arp_ip = self.address_cache.get(nic.mac.upper())
or
arp_ip = ip_map.get(nic.mac.lower())


---------- variable  ------
nic.mac = {'netdst': 'virbr0', 'ip': None, 'nic_name': 'nic1', 'mac':
'02:00:00:93:42:41', 'nettype': 'bridge', 'nic_model': 'virtio',
'g_nic_name': None}
self.address_cache = {}




Wei,

Can you better explain what you're trying to do, and what is your environment?

I have added a line to boot.py:

diff --git a/generic/tests/boot.py b/generic/tests/boot.py
index bf4ddc9..2176493 100644
--- a/generic/tests/boot.py
+++ b/generic/tests/boot.py
@@ -23,6 +23,7 @@ def run(test, params, env):
     timeout = float(params.get("login_timeout", 240))
     vms = env.get_all_vms()
     for vm in vms:
+        logging.info("VM IP address: %s", vm.get_address(0))
error.context("Try to log into guest '%s'." % vm.name, logging.info)
         session = vm.wait_for_login(timeout=timeout)
         session.close()

And got the following result:

...
2016-05-30 10:17:25,036 qemu_monitor L0286 DEBUG| (monitor hmp1) Sending command 'cont'
2016-05-30 10:17:25,037 qemu_monitor     L0714 DEBUG| Send command: cont
2016-05-30 10:17:25,044 boot L0026 INFO | VM IP address: 127.0.0.1 2016-05-30 10:17:25,044 error L0085 INFO | Context: Try to log into guest 'avocado-vt-vm1'.
...

This IP address is actually accurate because for this run I used user level networking (the default setup).

-Cleber.

Best regards,
-
Li, Wei (李 伟)
zKVM Solution Test
IBM China Systems & Technology Lab, Beijing
E-Mail: li...@cn.ibm.com
Tel: 86-10-82450631  Notes: Wei WA Li/China/IBM
Address: 3BW298, Ring Bldg. No.28 Building, ZhongGuanCun Software Park,No.8
         DongBeiWang West Road, ShangDi, Haidian District, Beijing,
P.R.China




From:   Wei WA Li/China/IBM
To:     Avocado-devel@redhat.com
Date:   2016/05/19 18:21
Subject:        No guest information on host arp table


Hi all,

I have a question about def get_address(self, index=0) and log guest.

I found there is no guest information on our host arp table. I am not sure
whether it is only way to get guest IP.
If it is not, how can I get guest IP?


[root@zs95kv2 guests]# arp
Address                  HWtype  HWaddress           Flags Mask
Iface
zkvm-10-20-92-160.pokpr  ether   02:00:00:af:33:8a   CM
vlan1292
v1292gw10-20-92-254.pok  ether   00:26:88:57:b7:f0   C
vlan1292
ZP93K6.pokprv.stglabs.i  ether   02:00:00:12:65:53   C
vlan1292
v508gw9-12-23-1.pok.stg  ether   00:26:88:59:b7:f0   C
vlan508
9.12.23.95               ether   00:04:96:10:44:b0   C
vlan508
[root@zs95kv2 guests]# arp -a
zkvm-10-20-92-160.pokprv.stglabs.ibm.com (10.20.92.160) at
02:00:00:af:33:8a [ether] PERM on vlan1292
v1292gw10-20-92-254.pokprv.stglabs.ibm.com (10.20.92.254) at
00:26:88:57:b7:f0 [ether] on vlan1292
ZP93K6.pokprv.stglabs.ibm.com (10.20.92.60) at 02:00:00:12:65:53 [ether] on
vlan1292
v508gw9-12-23-1.pok.stglabs.ibm.com (9.12.23.1) at 00:26:88:59:b7:f0
[ether] on vlan508
? (9.12.23.95) at 00:04:96:10:44:b0 [ether] on vlan508
[root@zs95kv2 guests]#

[root@zs95kv2 guests]# virsh list
 Id    Name                           State
----------------------------------------------------

[root@zs95kv2 guests]# virsh start avocado-vt-vm1
Domain avocado-vt-vm1 started

[root@zs95kv2 guests]# virsh console avocado-vt-vm1

root@zp93k6g93160:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group
default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
UP group default qlen 1000
    link/ether 02:00:00:93:42:41 brd ff:ff:ff:ff:ff:ff
    inet 10.20.93.160/24 brd 10.20.93.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fd55:faaf:e1ab:a21:0:ff:fe93:4241/64 scope global mngtmpaddr
dynamic
       valid_lft 2591990sec preferred_lft 604790sec
    inet6 fe80::ff:fe93:4241/64 scope link
       valid_lft forever preferred_lft forever
root@zp93k6g93160:~#


Best regards,
-
Li, Wei (李 伟)
zKVM Solution Test
IBM China Systems & Technology Lab, Beijing
E-Mail: li...@cn.ibm.com
Tel: 86-10-82450631  Notes: Wei WA Li/China/IBM
Address: 3BW298, Ring Bldg. No.28 Building, ZhongGuanCun Software Park,No.8
         DongBeiWang West Road, ShangDi, Haidian District, Beijing,
P.R.China



_______________________________________________
Avocado-devel mailing list
Avocado-devel@redhat.com
https://www.redhat.com/mailman/listinfo/avocado-devel


--
Cleber Rosa
[ Sr Software Engineer - Virtualization Team - Red Hat ]
[ Avocado Test Framework - avocado-framework.github.io ]

_______________________________________________
Avocado-devel mailing list
Avocado-devel@redhat.com
https://www.redhat.com/mailman/listinfo/avocado-devel

Reply via email to