首页 > 其他分享 >virsh domxxx命令

virsh domxxx命令

时间:2023-09-11 18:33:35浏览次数:35  
标签:-- 虚拟机 hyperhost 命令 domxxx virsh root centos7.6

1. 摘要信息类

1.1 dominfo 获取配置等摘要信息

[root@hyperhost ~]# virsh dominfo --domain centos7.6
Id:             1
Name:           centos7.6
UUID:           11377dd6-bb49-4b9d-8e36-773787858871
OS Type:        hvm
State:          running
CPU(s):         2
CPU time:       503.1s
Max memory:     4194304 KiB
Used memory:    4194304 KiB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: none
Security DOI:   0

1.2domstate 获取虚拟机状态信息及原因

option:
--domain <string>  	domain name, id or uuid
--reason                打印原因

[root@hyperhost ~]# virsh domstate --domain centos7.6 --reason
running (booted)

[root@hyperhost ~]# virsh domstate --domain small --reason
shut off (unknown)

1.3 domuuid\ domid\ domname查找虚拟机的uuid\id\name

# 通过虚拟机的id或者name查找虚拟机的uuid
[root@hyperhost ~]# virsh domuuid 1
11377dd6-bb49-4b9d-8e36-773787858871
[root@hyperhost ~]# virsh domuuid centos7.6
11377dd6-bb49-4b9d-8e36-773787858871

# 通过虚拟机的uuid或者name查找虚拟机的id
[root@hyperhost ~]# virsh domid centos7.6
1
[root@hyperhost ~]# virsh domid 11377dd6-bb49-4b9d-8e36-773787858871
1

# 通过虚拟机的id或者uuid查找虚拟机的name
[root@hyperhost ~]# virsh domname 1
centos7.6
[root@hyperhost ~]# virsh domname 11377dd6-bb49-4b9d-8e36-773787858871
centos7.6

1.4 domuuid\ domid\ domname查找虚拟机的uuid\id\name

# 通过虚拟机的id或者name查找虚拟机的uuid
[root@hyperhost ~]# virsh domuuid 1
11377dd6-bb49-4b9d-8e36-773787858871
[root@hyperhost ~]# virsh domuuid centos7.6
11377dd6-bb49-4b9d-8e36-773787858871

# 通过虚拟机的uuid或者name查找虚拟机的id
[root@hyperhost ~]# virsh domid centos7.6
1
[root@hyperhost ~]# virsh domid 11377dd6-bb49-4b9d-8e36-773787858871
1

# 通过虚拟机的id或者uuid查找虚拟机的name
[root@hyperhost ~]# virsh domname 1
centos7.6
[root@hyperhost ~]# virsh domname 11377dd6-bb49-4b9d-8e36-773787858871
centos7.6

1.5 domdisplay 获得虚拟机vnc\spice\rdb地址

--domain <string>  	domain name, id or uuid
--include-password  	includes the password into the connection URI if available ???
--type <string>  		select particular graphical display (e.g. "vnc", "spice", "rdp")
--all            		show all possible graphical displays

[root@hyperhost ~]# virsh domdisplay centos7.6
spice://127.0.0.1:5900

1.6 domstats 输出虚拟机统计信息(cpu、内存、网络接口、块设备等统计信息)

option:
--state          		返回虚拟机运行状态,原因,类似于virsh domstate guest
--cpu-total      report domain physical cpu usage
--balloon        report domain balloon statistics
    --vcpu           report domain virtual cpu information
    --interface      report domain network interface information
    --block          report domain block device statistics
    --perf           report domain perf event statistics
    --list-active    list only active domains
    --list-inactive  list only inactive domains
    --list-persistent  list only persistent domains
    --list-transient  list only transient domains
    --list-running   list only running domains
    --list-paused    list only paused domains
    --list-shutoff   list only shutoff domains
    --list-other     list only domains in other states
    --raw            do not pretty-print the fields
    --enforce        enforce requested stats parameters
    --backing        add backing chain information to block stats
    --nowait         report only stats that are accessible instantly
    <domain>         list of domains to get stats for


[root@hyperhost ~]# virsh domstats centos7.6 --state
Domain: 'centos7.6'
  state.state=1
  state.reason=1

1.7 domrename 为处于不活跃状态的虚拟机重命名

option:
--domain <string>  		虚拟机的name或者uuid,处于关机的虚拟机没有id
--new-name <string>  	新名称

1.8 domtime 获取/设置虚拟机时间

option:
--domain <string>  	虚拟机 name, id or uuid
--now            		set to the time of the host running virsh(设置虚拟机时间为用户敲击virsh命令的时间)
--pretty         		以友好格式输出虚拟机时间,缺省为自1970年1月1日至现在的秒数(in seconds relative to Epoch of 1970-01-01 in UTC)
--sync           		instead of setting given time, synchronize from domain's RTC
--time <number>  		设置一个给定的时间

[root@hyperhost ~]# virsh domtime centos7.6
Time: 1655865135					# 自1970年1月1日到当前时间的秒数

[root@hyperhost ~]# virsh domtime centos7.6 --pretty
Time: 2022-06-22 02:32:41		# 虚拟机的RTC时间

[root@hyperhost ~]# virsh domtime centos7.6 --time "1655865135"			# 貌似time参数只接受这种格式

[root@hyperhost ~]# virsh domtime centos7.6 --now				# 将用户在主机上敲击virsh命令时的主机时间设置为虚拟机时间

[root@hyperhost ~]# virsh domtime centos7.6 --sync				# 没找到和now的区别,暂时未知作用?

标签:--,虚拟机,hyperhost,命令,domxxx,virsh,root,centos7.6
From: https://www.cnblogs.com/wang272/p/some_virsh_domxxx_commands.html

相关文章

  • linux常用的10个性能检测命令
    1、uptime该命令可以大致的看出计算机的整体负载情况,loadaverage后的数字分别表示计算机在1min、5min、15min内的平均负载。2、dmesg|tail打印内核环形缓存区中的内容,可以用来查看一些错误3、vmstat1打印进程、内存、交换分区、IO和CPU等的统计信息;vmstat第一次输出表示从开机......
  • oracle sql*plus常用命令
    文章转载自:https://www.cnblogs.com/csschn/p/4864653.html一、sys用户和system用户Oracle安装会自动的生成sys用户和system用户(1)、sys用户是超级用户,具有最高权限,具有sysdba角色,有createdatabase的权限,该用户默认的密码是change_on_install(2)、system用户是管理操作员,权......
  • #yyds干货盘点#Linux系统sensors命令 – 检测服务器硬件信息
    sensors命令用于检测服务器硬件信息,例如CPU电压与温度、主板、风扇转速等数据。语法格式 :sensors参考实例检查当前CPU处理器得电压和温度信息[root@linuxcool~]#sensorscoretemp-isa-0000Core0:+48.0°C(high=+87.0°C,crit=+97.0°C)Core1:+46.0......
  • 返璞归真:命令行下逛园子,发布博客园 CLI 预览版
    一边在会员救园,一边我们在码不停蹄地加快园子的建设。为了让大家体验命令行中逛园子的味道,今天发布一个小工具的预览版——博客园命令行工具cnb。该工具用Rust开发,代码开源在github上:https://github.com/cnblogs/cli,帮助文档见readme。预览版0.0.2的CDN下载地址......
  • H3C服务器使用hREST工具命令安装系统
    H3C服务器hREST命令行工具使用Python语言开发,主要基于HTTPs协议和Redfish、RESTful和IPMI接口协议,是一款便于用户管理服务器的客户端工具。用户可通过本工具的查询、设置等命令对服务器进行管理。hREST1.23工具下载地址:http://www.h3c.com/cn/BizPortal/DownLoadAccesso......
  • 查找字符串最长公共子串,请编码实现一个命令行工具,找出指定的2个字符串的最长公共子串
    要求给定两个字符串str1和str2,输出两个字符串的最长公共子串,如果最长公共子串为空,输出-1。输入描述命令行工具接收两个字符串参数。输入字符串的合法字符集为[a-zA-Z0-9],大小写敏感,无需考虑异常输入场景。输出描述输出一行最长公共子串示例输入1ABCD2345G12345EF输出2345解法一:滑......
  • 【Python爬虫实操】 如何在任务中高效处理命令参数
    在今天互联网技术的发展中,以Python为代表的脚本语言在各个领域都广泛应用。而处理命令行参数是Python编程中常见的需求之一。本文将介绍如何在Python中高效处理命令行参数,帮助更好地利用Python进行开发。1.了解命令行参数的基本概念命令行参数是在运行程序时由用户在命令行中输入的......
  • kunyu 工具的常见案例和示例命令
    kunyu工具的常见案例和示例命令:基本主机搜索:执行基本的主机搜索,以获取有关特定域或IP地址的信息。 SearchHostexample.com基本Web搜索:执行基本的Web搜索,以查找与特定查询条件相关的网站。 SearchWeb"vulnerabilitiesinWordPress"SSL证书搜索:搜索与指......
  • 2、linux命令之`chmod`
    目录linux命令之chmod1、语法2、命令中的选项3、模型3.1、文件设定法3.2、数字给定法linux命令之chmodchmod是linux的权限控制命令,可以对linux文件进行权限管控。1、语法chmod[选项][模型][文件]chmod[选项][8进制模型][文件]chmod[选项][文件]2、命令中的选项......
  • 1、linux命令之`df -h`
    linux命令之df-h查看磁盘使用情况df-h输出:FilesystemSizeUsedAvailUse%Mountedondevtmpfs3.8G03.8G0%/devtmpfs3.8G1.2G2.6G32%/dev/shmtmpfs3.8G217M3.6G6%......