提交 195fa214 编写于 作者: M Marti Raudsepp 提交者: Eric Blake

qemu: move -name arg to be 1st in "ps x" output

Currently, monitoring QEMU virtual machines with standard Unix
sysadmin tools is harder than it has to be. The QEMU command line is
often miles long and mostly redundant, it's hard to tell which process
is which.

This patch reorders the QEMU -name argument to be the first, so it's
immediately visible in "ps x", htop and "atop -c" output.
上级 6734ce7b
...@@ -238,6 +238,7 @@ Patches have also been contributed by: ...@@ -238,6 +238,7 @@ Patches have also been contributed by:
Dmitry Guryanov <dguryanov@parallels.com> Dmitry Guryanov <dguryanov@parallels.com>
William Jon McCann <william.jon.mccann@gmail.com> William Jon McCann <william.jon.mccann@gmail.com>
David Weber <wb@munzinger.de> David Weber <wb@munzinger.de>
Marti Raudsepp <marti@juffo.org>
[....send patches to get your name here....] [....send patches to get your name here....]
......
...@@ -4184,10 +4184,22 @@ qemuBuildCommandLine(virConnectPtr conn, ...@@ -4184,10 +4184,22 @@ qemuBuildCommandLine(virConnectPtr conn,
break; break;
} }
cmd = virCommandNewArgList(emulator, "-S", NULL); cmd = virCommandNew(emulator);
virCommandAddEnvPassCommon(cmd); virCommandAddEnvPassCommon(cmd);
if (qemuCapsGet(qemuCaps, QEMU_CAPS_NAME)) {
virCommandAddArg(cmd, "-name");
if (driver->setProcessName &&
qemuCapsGet(qemuCaps, QEMU_CAPS_NAME_PROCESS)) {
virCommandAddArgFormat(cmd, "%s,process=qemu:%s",
def->name, def->name);
} else {
virCommandAddArg(cmd, def->name);
}
}
virCommandAddArg(cmd, "-S"); /* freeze CPU */
/* This should *never* be NULL, since we always provide /* This should *never* be NULL, since we always provide
* a machine in the capabilities data for QEMU. So this * a machine in the capabilities data for QEMU. So this
* check is just here as a safety in case the unexpected * check is just here as a safety in case the unexpected
...@@ -4261,16 +4273,6 @@ qemuBuildCommandLine(virConnectPtr conn, ...@@ -4261,16 +4273,6 @@ qemuBuildCommandLine(virConnectPtr conn,
if (qemuBuildNumaArgStr(def, cmd) < 0) if (qemuBuildNumaArgStr(def, cmd) < 0)
goto error; goto error;
if (qemuCapsGet(qemuCaps, QEMU_CAPS_NAME)) {
virCommandAddArg(cmd, "-name");
if (driver->setProcessName &&
qemuCapsGet(qemuCaps, QEMU_CAPS_NAME_PROCESS)) {
virCommandAddArgFormat(cmd, "%s,process=qemu:%s",
def->name, def->name);
} else {
virCommandAddArg(cmd, def->name);
}
}
if (qemuCapsGet(qemuCaps, QEMU_CAPS_UUID)) if (qemuCapsGet(qemuCaps, QEMU_CAPS_UUID))
virCommandAddArgList(cmd, "-uuid", uuid, NULL); virCommandAddArgList(cmd, "-uuid", uuid, NULL);
if (def->virtType == VIR_DOMAIN_VIRT_XEN || if (def->virtType == VIR_DOMAIN_VIRT_XEN ||
......
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
pc -m 214 -smp 1 -name QEMUGuest1 -nographic -nodefaults \ -name QEMUGuest1 -S -M pc -m 214 -smp 1 -nographic -nodefaults \
-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-ide0-0-0,cache=off,\ -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-ide0-0-0,cache=off,\
bps=5000,iops=6000 -device \ bps=5000,iops=6000 -device \
......
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor unix:/tmp/test-monitor,\ -name QEMUGuest1 -S -M pc -m 214 -smp 1 -nographic -monitor \
server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-hda /dev/HostVG/QEMUGuest1 -net none -serial \
none -parallel none -usb none -parallel none -usb
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor unix:/tmp/test-monitor,\ -name QEMUGuest1 -S -M pc -m 214 -smp 1 -nographic -monitor \
server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-hda /dev/HostVG/QEMUGuest1 -net none -serial \
none -parallel none -usb none -parallel none -usb
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
pc -m 214 -smp 2 -name QEMUGuest1 -nographic \ -name QEMUGuest1 -S -M pc -m 214 -smp 2 -nographic \
-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin HOME=/root USER=root LOGNAME=root \ LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin HOME=/root USER=root LOGNAME=root \
/usr/bin/qemu -S -M pc-0.13 -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name \ /usr/bin/qemu -name encryptdisk -S -M pc-0.13 -m 1024 \
encryptdisk -uuid 496898a6-e6ff-f7c8-5dc2-3cf410945ee9 -nographic -nodefconfig \ -smp 1,sockets=1,cores=1,threads=1 -uuid 496898a6-e6ff-f7c8-5dc2-3cf410945ee9 \
-nodefaults -chardev socket,id=monitor,\ -nographic -nodefconfig -nodefaults -chardev socket,id=monitor,\
path=//var/lib/libvirt/qemu/encryptdisk.monitor,server,nowait -mon \ path=//var/lib/libvirt/qemu/encryptdisk.monitor,server,nowait -mon \
chardev=monitor,mode=readline -rtc base=utc -no-acpi -boot c -drive \ chardev=monitor,mode=readline -rtc base=utc -no-acpi -boot c -drive \
file=/storage/guest_disks/encryptdisk,if=none,id=drive-virtio-disk0,boot=on,\ file=/storage/guest_disks/encryptdisk,if=none,id=drive-virtio-disk0,boot=on,\
......
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor unix:/tmp/test-monitor,\ -name QEMUGuest1 -S -M pc -m 214 -smp 1 -nographic -monitor \
server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-hda /dev/HostVG/QEMUGuest1 -net none -serial \
none -parallel none -usb none -parallel none -usb
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor unix:/tmp/test-monitor,\ -name QEMUGuest1 -S -M pc -m 214 -smp 1 -nographic -monitor \
server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-hda /dev/HostVG/QEMUGuest1 -net none -serial \
none -parallel none -usb none -parallel none -usb
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor unix:/tmp/test-monitor,\ -name QEMUGuest1 -S -M pc -m 214 -smp 1 -nographic -monitor \
server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-hda /dev/HostVG/QEMUGuest1 -net none -serial \
none -parallel none -usb none -parallel none -usb
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
pc -m 214 -smp 1 -name QEMUGuest1 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -name QEMUGuest1 -S -M pc -m 214 -smp 1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-nographic -monitor unix:/tmp/test-monitor,server,nowait -boot c -hda \ -nographic -monitor unix:/tmp/test-monitor,server,nowait -boot c -hda \
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor unix:/tmp/test-monitor,\ -name QEMUGuest1 -S -M pc -m 214 -smp 1 -nographic -monitor \
server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-hda /dev/HostVG/QEMUGuest1 -net none -serial \
none -parallel none -usb none -parallel none -usb
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor unix:/tmp/test-monitor,\ -name QEMUGuest1 -S -M pc -m 214 -smp 1 -nographic -monitor \
server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 \ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-hda /dev/HostVG/QEMUGuest1 \
-hdb /dev/HostVG/QEMUGuest2 -net none -serial \ -hdb /dev/HostVG/QEMUGuest2 -net none -serial \
none -parallel none -usb none -parallel none -usb
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor unix:/tmp/test-monitor,\ -name QEMUGuest1 -S -M pc -m 214 -smp 1 -nographic -monitor \
server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-hda /dev/HostVG/QEMUGuest1 -net none -serial \
none -parallel none -usb none -parallel none -usb
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor unix:/tmp/test-monitor,\ -name QEMUGuest1 -S -M pc -m 214 -smp 1 -nographic -monitor \
server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-hda /dev/HostVG/QEMUGuest1 -net none -serial \
none -parallel none -usb none -parallel none -usb
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor unix:/tmp/test-monitor,\ -name QEMUGuest1 -S -M pc -m 214 -smp 1 -nographic \
-monitor unix:/tmp/test-monitor,\
server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \ server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \
none -parallel none -usb none -parallel none -usb
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor unix:/tmp/test-monitor,\ -name QEMUGuest1 -S -M \
server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \ pc -m 214 -smp 1 -nographic -monitor \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-hda /dev/HostVG/QEMUGuest1 -net none -serial \
none -parallel none -usb none -parallel none -usb
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册