Category: virtualization

虚拟化技术

  • vmware esxi 查询命令

    网卡信息查询

    [root@localhost2:~] esxcfg-nics -l
    Name    PCI          Driver      Link Speed      Duplex MAC Address       MTU    Description
    vmnic0  0000:01:00.0 ntg3        Up   1000Mbps   Full   c8:1f:66:f2:25:fc 1500   Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet
    vmnic1  0000:01:00.1 ntg3        Down 0Mbps      Half   c8:1f:66:f2:25:fd 1500   Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet
    vmnic2  0000:02:00.0 ntg3        Down 0Mbps      Half   c8:1f:66:f2:25:fe 1500   Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet
    vmnic3  0000:02:00.1 ntg3        Up   1000Mbps   Full   c8:1f:66:f2:25:ff 1500   Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet
    vmnic4  0000:04:00.0 ixgben      Down 0Mbps      Half   90:e2:ba:93:9f:58 1500   Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection
    vmnic5  0000:04:00.1 ixgben      Up   10000Mbps  Full   90:e2:ba:93:9f:5a 1500   Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection
    

    获取主机总线适配器当前使用得驱动程序类型

    [root@localhost2:~] esxcfg-scsidevs -a
    vmhba0  vmw_ahci          link-n/a  sata.vmhba0                             (0000:00:1f.2) Intel Corporation Patsburg 6 Port SATA AHCI Controller
    vmhba1  lsi_mr3           link-n/a  sas.5c81f660f7636700                    (0000:03:00.0) LSI / Symbios Logic Dell PERC H710 Mini
    vmhba64 iscsi_vmk         online    iscsi.vmhba64                           iSCSI Software Adapter
    

    存储路径查询

    [root@localhost2:~] esxcli storage core path list
    sas.5c81f660f7636700-sas.605c95593ce97768-naa.6c81f660f7636700235c95593ce97768
       UID: sas.5c81f660f7636700-sas.605c95593ce97768-naa.6c81f660f7636700235c95593ce97768
       Runtime Name: vmhba1:C2:T2:L0
       Device: naa.6c81f660f7636700235c95593ce97768
       Device Display Name: Local DELL Disk (naa.6c81f660f7636700235c95593ce97768)
       Adapter: vmhba1
       Channel: 2
       Target: 2
       LUN: 0
       Plugin: NMP
       State: active
       Transport: sas
       Adapter Identifier: sas.5c81f660f7636700
       Target Identifier: sas.605c95593ce97768
       Adapter Transport Details: 5c81f660f7636700
       Target Transport Details: 605c95593ce97768
       Maximum IO Size: 262144
    
    sata.vmhba0-sata.0:4-mpx.vmhba0:C0:T4:L0
       UID: sata.vmhba0-sata.0:4-mpx.vmhba0:C0:T4:L0
    ...
    

    查询WWN号

    esxcli storage san iscsi list
    [root@localhost2:~] esxcli storage san iscsi list
       Adapter: vmhba64
       UID: iscsi.vmhba64
       Driver: iscsi_vmk
       State: online
       Description: iSCSI Software Adapter
    
    [root@localhost2:~] esxcli storage san iscsi list |grep UID
       UID: iscsi.vmhba64
    
    esxcli storage fc iscsi list
    esxcli storage san fc list |grep -E 'Node Name:|Port Name'
    

    query SCSI devices

    #List the devices currently registered with the PSA.
    esxcli storage core device list
    #List the SCSI stats for SCSI Devices in the system
    esxcli storage core device stats get
    
    
    #List all the SCSI paths on the system.
    esxcli storage core path list
    #List the SCSI stats for the SCSI Paths in the system.
    esxcli storage core path stats get
    
  • 编译ldmtool

    想在linux环境上挂载windows的动态磁盘.启动容器运行centos7, 编译ldmtool.

    下载版本

    https://github.com/mdbooth/libldm/archive/refs/tags/libldm-0.2.5.zip

    编译步骤

    sh autogen.sh
    make
    make install
    

    需要安装的库

    yum install make
    
    #autogen.sh: line 26: gtkdocize: command not found
    yum install gtk-doc
    #autogen.sh: line 29: autoreconf: command not found
    yum install autoconf
    
    #autoreconf: failed to run aclocal: No such file or directory
    yum install automake
    
    #autoreconf: failed to run libtoolize: No such file or directory
    yum install libtool
    
    #configure: error: readline library is missing
    yum install readline-devel
    
    #No package 'gobject-2.0' found
    yum install glib2-devel
    
    #No package 'json-glib-1.0' found
    yum install json-glib-devel
    
    #No package 'zlib' found
    yum install zlib-devel
    
    #No package 'uuid' found
    yum install libuuid-devel
    
    #No package 'devmapper' found
    yum install device-mapper-libs  device-mapper-devel
    
  • openstack4j 开启debug模式

    // 开启debug 模式.
    OSFactory.enableHttpLoggingFilter(true);
    // V3 authentication
    OSClient.OSClientV3 os = OSFactory.builderV3().endpoint(iamDomainV3)
                    .credentials(this.getUserName(), this.getPassWord(), Identifier.byName(this.domainName))
                    .scopeToDomain(Identifier.byName(this.domainName)).perspective(Facing.PUBLIC).withConfig(config)
                    .authenticate();
    

    openstack4j 支持输出http 日志. 方便查看请求发送的参数.

  • kubevirt通过json patch 关闭,启动虚拟机

    JSON Patch由IETF在RFC 6902中规范.JavaScript Object Notation (JSON) Patch

    JSON Path是描述JSON文档变化的格式. 使用它可以避免在只需要修改某一部分的时候发送整个文档内容. 当与HTTP PATCH方法混合使用的时候, 它允许在标准规范的基础上使用HTTP APIs进行部分更新.

       A JSON Patch document is a JSON [RFC4627] document that represents an
       array of objects.  Each object represents a single operation to be
       applied to the target JSON document.
    
       The following is an example JSON Patch document, transferred in an
       HTTP PATCH request:
    
       PATCH /my/data HTTP/1.1
       Host: example.org
       Content-Length: 326
       Content-Type: application/json-patch+json
       If-Match: "abc123"
    
       [
         { "op": "test", "path": "/a/b/c", "value": "foo" },
         { "op": "remove", "path": "/a/b/c" },
         { "op": "add", "path": "/a/b/c", "value": [ "foo", "bar" ] },
         { "op": "replace", "path": "/a/b/c", "value": 42 },
         { "op": "move", "from": "/a/b/c", "path": "/a/b/d" },
         { "op": "copy", "from": "/a/b/d", "path": "/a/b/e" }
       ]
    

    (more…)

  • Kubectl 日志输出详细程度

    kubectl 备忘单

    Kubectl 日志输出详细程度是通过 -v 或者 –v 来控制的,参数后跟一个数字表示日志的级别。

    详细程度 描述
    –v=0 用于那些应该 始终 对运维人员可见的信息,因为这些信息一般很有用。
    –v=1 如果您不想要看到冗余信息,此值是一个合理的默认日志级别。
    –v=2 输出有关服务的稳定状态的信息以及重要的日志消息,这些信息可能与系统中的重大变化有关。这是建议大多数系统设置的默认日志级别。
    –v=3 包含有关系统状态变化的扩展信息。
    –v=4 包含调试级别的冗余信息。
    –v=5 跟踪级别的详细程度。
    –v=6 显示所请求的资源。
    –v=7 显示 HTTP 请求头。
    –v=8 显示 HTTP 请求内容。
    –v=9 显示 HTTP 请求内容而且不截断内容。

    (more…)