[PATCH v1] vlan: fix vlan interface misses tag attribute when inactive
by Leno Hou
This patch fixes the problem as shown below.
* virsh dumpxml failed with vlan1292 in inactive status
* virt-manager failed to view vlan1292 interface details.
Following is steps to reproduce in virsh.
1) setup 802.1q vlan tagging using ifcfg-files
#cat > /etc/sysconfig/network-scripts/ifcfg-vlan1292 < EOF
VLAN=yes
VLAN_NAME_TYPE=VLAN_PLUS_VID_NO_PAD
DEVICE=vlan1292
PHYSDEV=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.254.5.254
NETMASK=255.255.255.0
TYPE=Ethernet
NM_CONTROLLED=no
EOF
2) active vlan interface and dumpxml
#ifup vlan1292
#virsh iface-dumpxml vlan1292
<interface type='vlan' name='vlan1292'>
<protocol family='ipv4'>
<ip address='10.254.5.254' prefix='24'/>
</protocol>
<protocol family='ipv6'>
<ip address='fe80::4:21ff:fe00:b300' prefix='64'/>
</protocol>
<link speed='1000' state='up'/>
<vlan tag='1292'>
<interface name='eth0'/>
</vlan>
</interface>
3) deactive vlan interface and dumpxml
#ifdown vlan1292
#virsh iface-dumpxml vlan1292
error: XML error: vlan interface misses the tag attribute
Once applied this patch, it's will be successfully return the results:
#virsh iface-dumpxml vlan1292
<interface type='vlan' name='vlan1292'>
<start mode='onboot'/>
<protocol family='ipv4'>
<ip address='10.254.5.254' prefix='24'/>
</protocol>
<vlan tag='1292'>
<interface name='eth0'/>
</vlan>
</interface>
Signed-off-by: Leno Hou <lenohou(a)gmail.com>
---
data/xml/redhat-put.xsl | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/data/xml/redhat-put.xsl b/data/xml/redhat-put.xsl
index ed56c66..0a370fe 100644
--- a/data/xml/redhat-put.xsl
+++ b/data/xml/redhat-put.xsl
@@ -56,11 +56,22 @@
<xsl:template name="vlan-device">
<xsl:variable name="name" select="node[@label = 'DEVICE']/@value"/>
- <xsl:variable name="device" select="substring-before($name, '.')"/>
- <xsl:variable name="tag" select="substring-after($name, '.')"/>
- <vlan tag="{$tag}">
- <interface name="{$device}"/>
- </vlan>
+ <xsl:choose>
+ <xsl:when test="contains($name, '.')">
+ <xsl:variable name="device" select="substring-before($name, '.')"/>
+ <xsl:variable name="tag" select="substring-after($name, '.')"/>
+ <vlan tag="{$tag}">
+ <interface name="{$device}"/>
+ </vlan>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="device" select="node[@label = 'PHYSDEV']/@value"/>
+ <xsl:variable name="tag" select="translate($name, translate($name, '0123456789', ''), '')"/>
+ <vlan tag="{$tag}">
+ <interface name="{$device}"/>
+ </vlan>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
<!--
--
2.7.4
7 years, 3 months
[netcf] why netcf doesn't support the ifcfg file parameter for naming a vlan device differently from "$physdev.$vlantag" ?
by Leno Hou
As tiltled, we want to netcf support ifcfg file parameter for naming device can be differently from "$physdev.$vlantag".
as case 2 and case 4
1. VLAN_NAME_TYPE_RAW_PLUS_VID
ame will look like: eth0.0012
2. VLAN_NAME_TYPE_PLUS_VID_NO_PAD
Name will look like: vlan12
3. VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
Name will look like: eth0.12
4. VLAN_NAME_TYPE_PLUS_VID
Name will look like: vlan0012
I have a case of: error: XML error: vlan interface misses the tag attribute
by below steps.
1) Define the vlan interface with ifcfg-vlan1292
VLAN=yes
VLAN_NAME_TYPE=VLAN_PLUS_VID_NO_PAD
DEVICE=vlan1292
PHYSDEV=en5sp0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.254.5.254
NETMASK=255.255.255.0
TYPE=Ethernet
NM_CONTROLLED=no
2)ifup and ifdown this vlan1292
#ifup ifcfg-vlan1292
#ifdown ifcfg-vlan1292
3)# virsh iface-list --all
Name State MAC Address
---------------------------------------------------
en5sp0 active 02:38:53:00:76:00
lo active 00:00:00:00:00:00
vlan1292 inactive
# virsh iface-dumpxml vlan1292
error: XML error: vlan interface misses the tag attribute
4) setup active and dumpxml
# ifup ifcfg-vlan1292
# virsh iface-list --all
Name State MAC Address
---------------------------------------------------
en5sp0 active 02:38:53:00:76:00
lo active 00:00:00:00:00:00
vlan1292 active 02:38:53:00:76:00
# virsh iface-dumpxml vlan1292
<interface type='vlan' name='vlan1292'>
<protocol family='ipv4'>
<ip address='10.254.5.254' prefix='24'/>
</protocol>
<protocol family='ipv6'>
<ip address='fe80::38:53ff:fe00:7600' prefix='64'/>
</protocol>
<link speed='1000' state='up'/>
<vlan tag='1292'>
<interface name='en5sp0'/>
</vlan>
</interface>
7 years, 4 months
Re: [libvirt] [RFC] why netcf/libvirt lists/dumpxml only unslaved/unsubordinated interfaces?
by Daniel P. Berrange
On Tue, Nov 15, 2016 at 02:43:37PM +0300, Nikolay Shirokovskiy wrote:
>
>
> On 15.11.2016 14:18, Daniel P. Berrange wrote:
> > On Tue, Nov 15, 2016 at 02:13:01PM +0300, Nikolay Shirokovskiy wrote:
> >> It could be useful to dumpxml of slaves/subordinates too to introspect
> >> host interfaces tree in dephts. Now it is not possible:
> >> 'Interface eth0 does not exist or is not a toplevel interface'.
> >> Has it some deeper meaning or netcf can be enhanced? (and *libvirt* as well).
> >
> > The netcf API / libvirt Interface APIs are designed to work against the
> > concept of logical network connections, which may comprise multiple
> > physical interfaces. They are explicitly *not* a way to query all
> > individual physical interfaces - that's what libvirt's node device APIs
> > are for.
> >
>
> I donno. AFAIU you can start with bridge and unslaved physical interface. They are both
> in list and can be dumped. Then you enslave interface to the bridge via netcf's define
> and then physical interface can not be reached anymore. If I can not change host interfaces
> tree then it would be ok I guess.
That is expected behaviour. You originally had 2 separate logical
connections, and you've changed the system to have a single logical
connection.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|
7 years, 4 months
[PATCH] maint: update to latest gnulib
by Eric Blake
Lots has happened in upstream gnulib; but this particular update
is designed to fix the bootstrap problem on AIX 5.3 reported by
Michael Felt.
* .gnulib: Update to latest.
* bootstrap: Resync with upstream.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Of course, this won't go in until the gnulib patch is pushed
(which may necessitate a different commit id, if other gnulib
commits are created in the meantime), but posting it now since
it at least passes tests on my development environment.
.gnulib | 2 +-
bootstrap | 44 +++++++++++++++++++++++---------------------
2 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/.gnulib b/.gnulib
index 63881a6..66ed61f 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 63881a60d67422cd7b83eae5ecabdc6b67ea7192
+Subproject commit 66ed61fb6583905d026920acda8efe3d0d661ef5
diff --git a/bootstrap b/bootstrap
index e72894c..5d3c289 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,10 +1,10 @@
#! /bin/sh
# Print a version string.
-scriptversion=2014-12-08.12; # UTC
+scriptversion=2016-11-03.18; # UTC
# Bootstrap this package from checked-out sources.
-# Copyright (C) 2003-2015 Free Software Foundation, Inc.
+# Copyright (C) 2003-2016 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ export LC_ALL
local_gl_dir=gl
-# Honour $PERL, but work even if there is none
+# Honor $PERL, but work even if there is none.
PERL="${PERL-perl}"
me=$0
@@ -418,28 +418,30 @@ sort_ver() { # sort -V is not generally available
done
}
+get_version_sed='
+# Move version to start of line.
+s/.*[v ]\([0-9]\)/\1/
+
+# Skip lines that do not start with version.
+/^[0-9]/!d
+
+# Remove characters after the version.
+s/[^.a-z0-9-].*//
+
+# The first component must be digits only.
+s/^\([0-9]*\)[a-z-].*/\1/
+
+#the following essentially does s/5.005/5.5/
+s/\.0*\([1-9]\)/.\1/g
+p
+q'
+
get_version() {
app=$1
$app --version >/dev/null 2>&1 || { $app --version; return 1; }
- $app --version 2>&1 |
- sed -n '# Move version to start of line.
- s/.*[v ]\([0-9]\)/\1/
-
- # Skip lines that do not start with version.
- /^[0-9]/!d
-
- # Remove characters after the version.
- s/[^.a-z0-9-].*//
-
- # The first component must be digits only.
- s/^\([0-9]*\)[a-z-].*/\1/
-
- #the following essentially does s/5.005/5.5/
- s/\.0*\([1-9]\)/.\1/g
- p
- q'
+ $app --version 2>&1 | sed -n "$get_version_sed"
}
check_versions() {
@@ -1021,6 +1023,6 @@ echo "$0: done. Now you can run './configure'."
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
+# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
--
2.7.4
7 years, 4 months
[PATCH 0/4] Build and whitespace fixes
by Eric Blake
I was trying to test my new bootstrap patch, and ran into some
compiler warnings and errors. This can be checked in regardless
of whether the bootstrap changes are approved.
Eric Blake (4):
tests: Fix build due to missing STREQ
dutil: Untabify, to pacify gcc
maint: Remove all remaining TABs in C sources
maint: Inform emacs about our editing style
.dir-locals.el | 14 ++++
src/drv_debian.c | 20 ++----
src/drv_mswindows.c | 4 +-
src/drv_redhat.c | 20 ++----
src/drv_suse.c | 32 ++++------
src/dutil.c | 18 ++----
src/dutil.h | 8 ---
src/dutil_linux.c | 8 ---
src/dutil_linux.h | 8 ---
src/dutil_posix.c | 8 ---
src/dutil_posix.h | 8 ---
src/internal.h | 10 ---
src/list.h | 9 ---
src/ncftool.c | 9 ---
src/ncftransform.c | 8 ---
src/netcf.c | 9 ---
src/netcf.h | 10 ---
src/ref.h | 10 ---
src/xslt_ext.c | 9 ---
tests/cutest.c | 180 +++++++++++++++++++++++++---------------------------
tests/cutest.h | 51 ++++++---------
tests/test-debian.c | 8 ---
tests/test-redhat.c | 8 ---
tests/test-suse.c | 8 ---
tests/tutil.c | 8 ---
tests/tutil.h | 8 ---
26 files changed, 152 insertions(+), 341 deletions(-)
create mode 100644 .dir-locals.el
--
2.7.4
7 years, 4 months
netcf - anyone here for an "other operating system (but not (Solaris))"
by Michael Felt
Granted - the web page is from 7 years ago (now that I look more closely).
How can I help ?
netcf is in its very early stages, and can be improved in any number of ways. The most pressing needs right now are
implementing backends for other distributions (Debian, Ubuntu, etc.) and operating systems (Solaris)
testing and using netcf
So, early stages is probably not correct anymore - and only including Solaris is not very inviting to the other UNIX - still out there (AIX).
My interest: cloud-init is looking at using netcf rather than ubuntu "interfaces" (man 5 interfaces). I am working on a "distro" addin for AIX into cloud-init that will make trunk (the current one is very old, and would never merge into truck, so rewriting from scratch where needed and borrowing when possible)
So, will anyone pay attention if I take the time to download and try to build netcf for AIX?
Michael
7 years, 4 months
[PATCH] bootstrap: Fix get_version() for AIX 5.3
by Eric Blake
* build-aux/bootstrap (get_version): Factor out sed script, since
indented comments choke AIX 5.3 sed.
Reported-by: Michael Felt <aixtools(a)gmail.com>
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Michael, can you confirm that this version of bootstrap works
for your environment? The next step is for me to push this commit
to gnulib, then update netcf to the latest gnulib.
ChangeLog | 7 +++++++
build-aux/bootstrap | 38 ++++++++++++++++++++------------------
2 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fecb478..de488ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-11-03 Eric Blake <eblake(a)redhat.com>
+
+ bootstrap: Fix get_version() for AIX 5.3
+ * build-aux/bootstrap (get_version): Factor out sed script, since
+ indented comments choke AIX 5.3 sed.
+ Reported-by: Michael Felt <aixtools(a)gmail.com>
+
2016-11-02 Pádraig Brady <P(a)draigBrady.com>
backupfile: initialize default suffix within the implementation
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index f060bab..5d3c289 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
-scriptversion=2016-01-24.06; # UTC
+scriptversion=2016-11-03.18; # UTC
# Bootstrap this package from checked-out sources.
@@ -418,28 +418,30 @@ sort_ver() { # sort -V is not generally available
done
}
+get_version_sed='
+# Move version to start of line.
+s/.*[v ]\([0-9]\)/\1/
+
+# Skip lines that do not start with version.
+/^[0-9]/!d
+
+# Remove characters after the version.
+s/[^.a-z0-9-].*//
+
+# The first component must be digits only.
+s/^\([0-9]*\)[a-z-].*/\1/
+
+#the following essentially does s/5.005/5.5/
+s/\.0*\([1-9]\)/.\1/g
+p
+q'
+
get_version() {
app=$1
$app --version >/dev/null 2>&1 || { $app --version; return 1; }
- $app --version 2>&1 |
- sed -n '# Move version to start of line.
- s/.*[v ]\([0-9]\)/\1/
-
- # Skip lines that do not start with version.
- /^[0-9]/!d
-
- # Remove characters after the version.
- s/[^.a-z0-9-].*//
-
- # The first component must be digits only.
- s/^\([0-9]*\)[a-z-].*/\1/
-
- #the following essentially does s/5.005/5.5/
- s/\.0*\([1-9]\)/.\1/g
- p
- q'
+ $app --version 2>&1 | sed -n "$get_version_sed"
}
check_versions() {
--
2.7.4
7 years, 4 months
new to netcf - maybe this is answered in the documentation, however
by Michael Felt
I have done some superficial reading on netcf - and I notice several comments on bridiging. Found out what it is and I do not expect it on AIX. There is a specialized partition (VIOS) that provides that function (so-called Shared Ethernet Adapter aka SEA) by bridging the virtual LAN(s) with a physical port or ether-channel (pseudo) port.
What I have not noticed yet, common in AIX - is what is called an NIB - or Network Interface Backup. This is an additional feature of the AIX ether-channel pseudo device.
VLAN does exist in AIX, just done differently.
All in all, I expect most aspects to map well.
So, two questions:
a) does netcf have a description for (automated) network interface backup (yes or no are fine answers);
b) could someone give a short listing of the interface definitions netcf has implemented? I will read the documentation, but a bulleted list of topics helps me get to the important items first.
Thanks!
7 years, 4 months