• 使用virsh 对虚拟机操作 qemu-agent


    要确保qemu-agent 安装成功才可以通讯

    virsh qemu-agent-command centos --cmd '{"execute":"guest-exec","arguments":{"path":"hostnamectl", "arg":["set-hostname","lgj"]}}'  linux系统

    以下是windows系统,改ip地址以及主机名

    改主机名win7没试验成功,改ip地址可以


    qemu-agent-command win --cmd '{"execute":"guest-exec","arguments":{"path":"netsh", "arg":["interface","ip","set","addr","以太网","static","192.168.3.234","255.255.255.0","192.168.3.1"}}'

    qemu-agent-command win --cmd '{"execute":"guest-exec","arguments":{"path":"netsh", "arg":["interface","ip","set","dns","以太网","static","114.114.114.114"]}}'

    这条执行修改不成功
    qemu-agent-command win --cmd '{"execute":"guest-exec","arguments":{"path":"WMIC", "arg":["computersystem","where","caption=DESKTOP-UT2CLND","rename","lgj'"]}}'

    这条win10的16成功了

    qemu-agent-command win --cmd '{"execute":"guest-exec","arguments":{"path":"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe", "arg":["rename-computer","lgj"]}}

     qemu-agent-command win '{"execute": "guest-exec-status", "arguments": { "pid": 904 } }' 查看代码输出 检查命令执行返回结果

  • 相关阅读:
    flask和tornado的区别
    tornado1
    人脸识别
    ocr:img转成pdf,pdf转成pdf
    flask2
    《个人-GIT使用方法》
    课后作业-阅读任务-阅读笔记
    课后作业-阅读任务-阅读提问
    结对-四则运算生成器-设计文档
    团队-手机备忘录-开发环境搭建过程
  • 原文地址:https://www.cnblogs.com/bnsdmmL/p/14124784.html
Copyright © 2020-2023  润新知