On Tue, Sep 03, 2013 at 10:16:05PM +0800, Osier Yang wrote:
Except what Daniel pointed out:
On 01/09/13 21:43, Nehal J Wani wrote:
>+static const char testQemuAgentGetInterfacesResponse[] =
>+ "{\"return\": "
>+ " ["
>+ " {\"name\":\"lo\","
>+ " \"ip-addresses\":"
>+ " ["
>+ " {\"ip-address-type\":\"ipv4\","
>+ " \"ip-address\":\"127.0.0.1\","
>+ " \"prefix\":8"
>+ " },"
>+ " {\"ip-address-type\":\"ipv6\","
>+ " \"ip-address\":\"::1\","
>+ " \"prefix\":128"
>+ " }"
>+ " ],"
>+ "
\"hardware-address\":\"00:00:00:00:00:00\""
>+ " },"
>+ " {\"name\":\"eth0\","
>+ " \"ip-addresses\":"
>+ " ["
>+ " {\"ip-address-type\":\"ipv4\","
>+ "
\"ip-address\":\"192.168.102.142\","
>+ " \"prefix\":24"
>+ " },"
>+ " {\"ip-address-type\":\"ipv6\","
>+ "
\"ip-address\":\"fe80::5054:ff:fe89:ad35\","
>+ " \"prefix\":64"
>+ " },"
>+ " {\"ip-address-type\":\"ipv4\","
>+ "
\"ip-address\":\"192.168.234.152\","
>+ " \"prefix\":16"
>+ " },"
>+ " {\"ip-address-type\":\"ipv6\","
>+ "
\"ip-address\":\"fe80::5054:ff:fec3:68bb\","
>+ " \"prefix\":64"
Can qemu guest agent really returns mutiple same type IP addresses?
Isn't it returning
the other IP addresses as "iface:alias" ?
iface:alias has only ever existed for IPv4. It is never used
for IPv6 interfaces. It is possible to have multiple IPv4
addrs, without them appearing in :alias format
eg:
# ifconfig
em1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.33.1.228 netmask 255.255.254.0 broadcast 10.33.1.255
inet6 200::200 prefixlen 64 scopeid 0x0<global>
inet6 fe80::3e97:eff:fe95:800c prefixlen 64 scopeid 0x20<link>
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:54:95:2a txqueuelen 0 (Ethernet)
# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
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
inet 128.0.0.1/24 scope global lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
3: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen
1000
link/ether 3c:97:0e:95:80:0c brd ff:ff:ff:ff:ff:ff
inet 10.33.1.228/23 brd 10.33.1.255 scope global em1
valid_lft forever preferred_lft forever
inet 128.0.0.1/24 scope global em1
valid_lft forever preferred_lft forever
inet6 200::200/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::3e97:eff:fe95:800c/64 scope link
valid_lft forever preferred_lft forever
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN
link/ether 52:54:00:54:95:2a brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
Notice no em1:<alias> device exists even though it has multiple addrs
>+ " }"
>+ " ],"
>+ "
\"hardware-address\":\"52:54:00:89:ad:35\""
>+ " },"
>+ " {\"name\":\"eth1\","
>+ " \"ip-addresses\":"
>+ " ["
>+ " {\"ip-address-type\":\"ipv4\","
>+ "
\"ip-address\":\"192.168.103.83\","
>+ " \"prefix\":24"
>+ " },"
>+ " {\"ip-address-type\":\"ipv6\","
>+ "
\"ip-address\":\"fe80::5054:ff:fed3:39ee\","
>+ " \"prefix\":64"
>+ " }"
>+ " ],"
>+ "
\"hardware-address\":\"52:54:00:d3:39:ee\""
>+ " },"
>+ " {\"name\":\"eth1:0\","
>+ " \"ip-addresses\":"
>+ " ["
>+ " {\"ip-address-type\":\"ipv4\","
>+ " \"ip-address\":\"192.168.10.91\","
>+ " \"prefix\":24"
>+ " },"
>+ " {\"ip-address-type\":\"ipv6\","
>+ "
\"ip-address\":\"fe80::fc54:ff:fefe:4c4f\","
>+ " \"prefix\":64"
>+ " }"
>+ " ],"
>+ "
\"hardware-address\":\"52:54:00:d3:39:ee\""
>+ " },"
>+ " {\"name\":\"eth2\","
>+ "
\"hardware-address\":\"52:54:00:36:2a:e5\""
>+ " }"
>+ " ]"
>+ "}";
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|