[libvirt] [PATCH 0/4] Add new APIs and virsh commands to get/set cpu mode

Hello. This patchset adds new APIs virDomainGetCPUMode and virDomainSetCPUMode, and adds new virsh commands cpu-getmode and cpu-setmode by using these APIs. virDomainGetCPUMode allows to get cpu mode of a running or persistent domain. virDomainSetCPUMode allows to set cpu mode of a persistent domain. These APIs and virsh commands are useful because: - No longer need to mess around with XML for changing cpu mode. - People who want more performance can change cpu mode easily. - If there is a person who has a trouble with host-mode and host-passthrough, we can help easily by one-liner like "# virsh cpu-setmode <domain> custom" Then, default cpu is used after next boot. Ken ICHIKAWA (4): API: Introduce new public APIs virDomainGetCPUMode and virDomainSetCPUMode qemu: Add support for virDomainGetCPUMode and virDomainSetCPUMode remote: Add support for virDomainGetCPUMode and virDomainSetCPUMode virsh: Add cpu-getmode and cpu-setmode command include/libvirt/libvirt.h.in | 9 +++ src/driver.h | 11 ++++ src/libvirt.c | 112 +++++++++++++++++++++++++++++++++++++ src/libvirt_private.syms | 1 + src/libvirt_public.syms | 2 + src/qemu/qemu_driver.c | 129 +++++++++++++++++++++++++++++++++++++++++++ src/remote/remote_driver.c | 2 + src/remote/remote_protocol.x | 19 ++++++- src/remote_protocol-structs | 14 +++++ tools/virsh-domain.c | 109 ++++++++++++++++++++++++++++++++++++ tools/virsh.pod | 19 +++++++ 11 files changed, 426 insertions(+), 1 deletion(-) -- 1.7.11.7

On 12/10/2012 06:19 AM, Ichikawa, Ken wrote:
Hello.
This patchset adds new APIs virDomainGetCPUMode and virDomainSetCPUMode, and adds new virsh commands cpu-getmode and cpu-setmode by using these APIs.
virDomainGetCPUMode allows to get cpu mode of a running or persistent domain. virDomainSetCPUMode allows to set cpu mode of a persistent domain.
These APIs and virsh commands are useful because: - No longer need to mess around with XML for changing cpu mode. - People who want more performance can change cpu mode easily. - If there is a person who has a trouble with host-mode and host-passthrough, we can help easily by one-liner like "# virsh cpu-setmode <domain> custom" Then, default cpu is used after next boot.
Specifying custom mode without allowing to either provide the full CPU XML element or additional arguments like cpu model, features, matching policy, etc..,, doesn't seem to be right. On the other hand, allowing this would reduce the benefit of your proposal. Since this is an operation that works only on the persistent configuration I would maintain that it is acceptable to modify the domain definition, e.g. by means of virsh edit. -- Mit freundlichen Grüßen/Kind Regards Viktor Mihajlovski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On Mon, Dec 10, 2012 at 09:28:06 +0100, Viktor Mihajlovski wrote:
On 12/10/2012 06:19 AM, Ichikawa, Ken wrote:
This patchset adds new APIs virDomainGetCPUMode and virDomainSetCPUMode, and adds new virsh commands cpu-getmode and cpu-setmode by using these APIs.
virDomainGetCPUMode allows to get cpu mode of a running or persistent domain. virDomainSetCPUMode allows to set cpu mode of a persistent domain.
This proposal does not make any sense to me. In general, we don't provide APIs that duplicate what we can already do by changing domain XML. Since virDomainSetCPUMode can only affect persistent config (you cannot unplug the old CPU and plug the new one while the domain is running), the API does not add anything what could not be done with virDomainDefineXML.
These APIs and virsh commands are useful because: - No longer need to mess around with XML for changing cpu mode. - People who want more performance can change cpu mode easily.
There's libvirt-gconfig for those who don't want to mess with XML.
- If there is a person who has a trouble with host-mode and host-passthrough, we can help easily by one-liner like "# virsh cpu-setmode <domain> custom" Then, default cpu is used after next boot.
However, default CPU is most likely not what anyone would want. It's better to use one of the predefined models that. Anyway, if an easy way to change the CPU mode is required, a patch implementing new virsh command that would fetch domain XML, update it, and define back could be acceptable (I think we have some of these in virsh already), but NACK to these new APIs. BTW, next time, please send individual patches in a series as replies to cover letter. Jirka

On Mon, Dec 10, 2012 at 02:52:33PM +0100, Jiri Denemark wrote:
On Mon, Dec 10, 2012 at 09:28:06 +0100, Viktor Mihajlovski wrote:
On 12/10/2012 06:19 AM, Ichikawa, Ken wrote:
This patchset adds new APIs virDomainGetCPUMode and virDomainSetCPUMode, and adds new virsh commands cpu-getmode and cpu-setmode by using these APIs.
virDomainGetCPUMode allows to get cpu mode of a running or persistent domain. virDomainSetCPUMode allows to set cpu mode of a persistent domain.
This proposal does not make any sense to me. In general, we don't provide APIs that duplicate what we can already do by changing domain XML. Since virDomainSetCPUMode can only affect persistent config (you cannot unplug the old CPU and plug the new one while the domain is running), the API does not add anything what could not be done with virDomainDefineXML.
These APIs and virsh commands are useful because: - No longer need to mess around with XML for changing cpu mode. - People who want more performance can change cpu mode easily.
There's libvirt-gconfig for those who don't want to mess with XML.
- If there is a person who has a trouble with host-mode and host-passthrough, we can help easily by one-liner like "# virsh cpu-setmode <domain> custom" Then, default cpu is used after next boot.
However, default CPU is most likely not what anyone would want. It's better to use one of the predefined models that.
Anyway, if an easy way to change the CPU mode is required, a patch implementing new virsh command that would fetch domain XML, update it, and define back could be acceptable (I think we have some of these in virsh already), but NACK to these new APIs.
Agreed, NACK to this proposal Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

(2012/12/10 22:52), Jiri Denemark wrote:
On Mon, Dec 10, 2012 at 09:28:06 +0100, Viktor Mihajlovski wrote:
On 12/10/2012 06:19 AM, Ichikawa, Ken wrote:
This patchset adds new APIs virDomainGetCPUMode and virDomainSetCPUMode, and adds new virsh commands cpu-getmode and cpu-setmode by using these APIs.
virDomainGetCPUMode allows to get cpu mode of a running or persistent domain. virDomainSetCPUMode allows to set cpu mode of a persistent domain.
This proposal does not make any sense to me. In general, we don't provide APIs that duplicate what we can already do by changing domain XML. Since virDomainSetCPUMode can only affect persistent config (you cannot unplug the old CPU and plug the new one while the domain is running), the API does not add anything what could not be done with virDomainDefineXML.
These APIs and virsh commands are useful because: - No longer need to mess around with XML for changing cpu mode. - People who want more performance can change cpu mode easily.
There's libvirt-gconfig for those who don't want to mess with XML.
Thank you for the info.
- If there is a person who has a trouble with host-mode and host-passthrough, we can help easily by one-liner like "# virsh cpu-setmode <domain> custom" Then, default cpu is used after next boot.
However, default CPU is most likely not what anyone would want. It's better to use one of the predefined models that.
I would also make commands that allow to change CPU model if this patch was accepted.
Anyway, if an easy way to change the CPU mode is required, a patch implementing new virsh command that would fetch domain XML, update it, and define back could be acceptable (I think we have some of these in virsh already), but NACK to these new APIs.
Thank you for advice. I know it's able to modify CPU mode by using "virsh edit" but it needs to edit XML by hand. If there are virsh commands like this patchset's command to modify persistent config, they are useful to automate modification of persistent config easily using simple shellscript without any xml utilities. And I also think ordinary users don't want to edit XML. So, now I'm thinking to make virsh commands to change CPU mode, model, and other things(if needed) without using new APIs.
BTW, next time, please send individual patches in a series as replies to cover letter.
I'm very sorry. I will do so from next time. Ken Ichikawa
participants (5)
-
Daniel P. Berrange
-
Ichikawa, Ken
-
Jiri Denemark
-
Ken ICHIKAWA
-
Viktor Mihajlovski