SDLab

SDLab
SDLab.org::Adminな脳み

2014年5月15日木曜日

XenServer6.2 ) interface-rename COMMAND

How to Change Order of NICs in XenServer 6.x

http://support.citrix.com/article/CTX135809


interface-renameってコマンドを使ってみた。

[root@xs01 ~]# interface-rename --help
usage: interface-rename --rename|--list|--update <args>|--reset-to-install [-v] [-d]
Utility for managing the naming of physical network interfaces.  It is used to
undo the damage of race condition for device drivers grabbing eth names on
boot, taking into account naming policies provided at install time.  In
addition, it implements sensible policies when network hardware changes, and
the ability for manual alteration of the policies after install.
options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -v, --verbose         increase logging
  -d, --dry-run         dry run - don't write any state back to disk
  Actions:
    Exactly one action is expected
    -r, --rename        rename physical interfaces.  It is not safe to rename
                        interfaces which have traffic passing, or higher level
                        networking constructs on them (bonds/bridges/etc).
                        Use at your own risk after boot
    -l, --list          list current physical device information in a concise
                        manner as a reference for --update
    -u, --update        manually update the order of devices.  <args> should
                        be one or more <target eth name>=MAC|PCI|Phys|"SMBios"
    --reset-to-install  reset configuration to install state

renameとupdateはCLIから利用することはないだろうね・・・
listはNICのドライバ一覧を取得するのに便利だね。

[root@xs01 ~]# interface-rename --list
ERROR    [2014-05-13 19:17:46] Can't generate current state for interface '{'Driver': '802.1Q VLAN Support', 'Bus Info': '', 'BIOS device': {'all_ethN': 'eth6', 'physical': ''}, 'Assigned MAC': '00:1B:21:79:BB:9B', 'Firmware version': 'N/A', 'Driver version': '1.8', 'Kernel name': 'bond1.901'}' - Unrecognised PCI address ''
ERROR    [2014-05-13 19:17:46] Can't generate current state for interface '{'Driver': '802.1Q VLAN Support', 'Bus Info': '', 'BIOS device': {'all_ethN': 'eth7', 'physical': ''}, 'Assigned MAC': '00:1B:21:79:BB:9B', 'Firmware version': 'N/A', 'Driver version': '1.8', 'Kernel name': 'bond1.902'}' - Unrecognised PCI address ''
ERROR    [2014-05-13 19:17:46] Can't generate current state for interface '{'Driver': '802.1Q VLAN Support', 'Bus Info': '', 'BIOS device': {'all_ethN': 'eth8', 'physical': ''}, 'Assigned MAC': '00:1B:21:79:BB:9B', 'Firmware version': 'N/A', 'Driver version': '1.8', 'Kernel name': 'bond1.903'}' - Unrecognised PCI address ''
Name  MAC                PCI           ethN  Phys  SMBios  Driver  Version     Firmware
eth0  00:26:2d:08:12:78  0000:01:00.0  eth0  em1           igb     4.1.2       2.5, 0xf1300000
eth1  00:26:2d:08:12:79  0000:01:00.1  eth1  em2           igb     4.1.2       2.5, 0xf1300000
eth2  00:1b:21:79:bb:9a  0000:03:00.0  eth2  p2p1          e1000e  2.3.2-NAPI  5.11-2
eth3  00:1b:21:79:bb:9b  0000:03:00.1  eth3  p2p2          e1000e  2.3.2-NAPI  5.11-2
eth4  00:1b:21:79:ba:94  0000:04:00.0  eth4  p1p1          e1000e  2.3.2-NAPI  5.11-2
eth5  00:1b:21:79:ba:95  0000:04:00.1  eth5  p1p2          e1000e  2.3.2-NAPI  5.11-2


インストール時の状態にリセットも可能っぽい(今回は、Dry-Run)
[root@xs01 ~]# interface-rename --dry-run --reset-to-install
INFO     [2014-05-13 19:20:31] Dry Run - logging to stdout instead of '/var/log/interface-rename.log'
INFO     [2014-05-13 19:20:31] Would copy '/etc/sysconfig/network-scripts/interface-rename-data/.from_install/static-rules.conf' to '/etc/sysconfig/network-scripts/interface-rename-data/static-rules.conf' if not dry run
INFO     [2014-05-13 19:20:31] Would copy '/etc/sysconfig/network-scripts/interface-rename-data/.from_install/dynamic-rules.json' to '/etc/sysconfig/network-scripts/interface-rename-data/dynamic-rules.json' if not dry run
INFO     [2014-05-13 19:20:31] Would write:
# Automatically generated file from /etc/sysconfig/network-scripts/interface-rename.py
ACTION!="add" GOTO="network-done"
# Rules generated from static configuration and last boot data

# Rename unrecognised devices sideways to deal with them later
SUBSYSTEM=="net" KERNEL=="eth*" PROGRAM="/etc/udev/scripts/net-rename-sideways.sh %k" NAME="%c"
LABEL="network-done"
to '/etc/udev/rules.d/60-net.rules' if not dry run
INFO     [2014-05-13 19:20:31] All Done

こんなところにInstall時の設定が退避されるんだね。
見てみよう
[root@xs01 ~]# cd /etc/sysconfig/network-scripts/interface-rename-data/.from_install/
[root@xs01 .from_install]# ls
dynamic-rules.json  static-rules.conf
JSONだって。
MACとPCI BUSとETHで構成されるだけだった。
なお、ファイルの見方は static-rules.confに書いてある。
[root@xs01 .from_install]# more dynamic-rules.json
# Automatically adjusted file.  Do not edit unless you are certain you know how to
{
    "lastboot": [
        [
            "00:1B:21:79:BB:9B",
            "0000:03:00.1",
            "eth3"
        ],
        [
            "00:1B:21:79:BA:95",
            "0000:04:00.1",
            "eth5"
        ],
        [
            "00:26:2D:08:12:78",
            "0000:01:00.0",
            "eth0"
        ],
        [
            "00:1B:21:79:BA:94",
            "0000:04:00.0",
            "eth4"
        ],
        [
            "00:26:2D:08:12:79",
            "0000:01:00.1",
            "eth1"
        ],
        [
            "00:1B:21:79:BB:9A",
            "0000:03:00.0",
            "eth2"
        ]
    ],
    "old": []
}
listくらいしか用途を見いだせなかった。

0 件のコメント:

コメントを投稿