Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host cpu_match attr is ignored if Global cpu_mode attr is set #11

Closed
tcooper opened this issue Dec 21, 2014 · 3 comments
Closed

Host cpu_match attr is ignored if Global cpu_mode attr is set #11

tcooper opened this issue Dec 21, 2014 · 3 comments
Assignees

Comments

@tcooper
Copy link
Contributor

tcooper commented Dec 21, 2014

If the global attribute, cpu_mode, is set then the host attribute, cpu_match, is ignored/overwritten when generating the libvirt XML configuration for a KVM guest.

  • List the default cpu related attributes for a KVM guest (set here)...
[root@cluster config]# rocks list host attr vcn-1-11 | egrep "cpu_m"
vcn-1-11: cpu_mode      host-passthrough                                               G
  • Report the default XML configuration for a KVM guest...
[root@cluster config]# rocks report host vm config vcn-1-11 | grep "cpu mode" -B1 -A1
  <vcpu>24</vcpu>
  <cpu mode='host-passthrough'/>
  <cputune>
  • Add a host cpu_match attribute to the KVM guest...
[root@cluster config]# rocks add host attr vcn-1-11 cpu_match \
    value="host-passthrough:<topology sockets='2' cores='12' threads='1'/>"
  • List host attributes of the KVM guest...
[root@cluster config]# rocks list host attr vcn-1-11 | egrep "cpu_m"
vcn-1-11: cpu_match     host-passthrough:<topology sockets='2' cores='12' threads='1'/> 
                                                                                       H
vcn-1-11: cpu_mode      host-passthrough                                               G
  • Report the libvirt XML configuration of the KVM guest...
[root@cluster config]# rocks report host vm config vcn-1-11 | grep "cpu mode" -B1 -A1
  <vcpu>24</vcpu>
  <cpu mode='host-passthrough'/>
  <cputune>

NOTE: The topology configuration is not there.

  • Remove global cpu_mode attribute
[root@cluster config]# rocks remove attr cpu_mode
  • List host attributes of the KVM guest...
[root@cluster config]# rocks list host attr vcn-1-11 | egrep "cpu_m"
vcn-1-11: cpu_match     host-passthrough:<topology sockets='2' cores='12' threads='1'/>
                                                                                       H
  • Report xml config of the KVM guest...
[root@cluster config]# rocks report host vm config vcn-1-11 | grep "cpu mode" -B1 -A2
  <vcpu>24</vcpu>
  <cpu mode='host-passthrough'>
<topology sockets='2' cores='12' threads='1'/>
  </cpu>

NOTE: The topology configuration is now reported

@lclementi
Copy link
Contributor

On Sat, Dec 20, 2014 at 8:00 PM, Trevor Cooper [email protected] wrote:

If the global attribute, cpu_mode, is set then the host attribute, cpu_match, is ignored/overwritten when generating the libvirt XML configuration for a KVM guest.

List the default cpu related attributes for a KVM guest (set here)...

[root@cluster config]# rocks list host attr vcn-1-11 | egrep "cpu_m"
vcn-1-11: cpu_mode host-passthrough G

Report the default XML configuration for a KVM guest...

[root@cluster config]# rocks report host vm config vcn-1-11 | grep "cpu mode" -B1 -A1
24

Add a host cpu_match attribute to the KVM guest...

[root@cluster config]# rocks add host attr vcn-1-11 cpu_match
value="host-passthrough:"

List host attributes of the KVM guest...

[root@cluster config]# rocks list host attr vcn-1-11 | egrep "cpu_m"
vcn-1-11: cpu_match host-passthrough:
H
vcn-1-11: cpu_mode host-passthrough G

Report the libvirt XML configuration of the KVM guest...

[root@cluster config]# rocks report host vm config vcn-1-11 | grep "cpu mode" -B1 -A1
24

NOTE: The topology configuration is not there.

Remove global cpu_mode attribute

[root@cluster config]# rocks remove attr cpu_mode

List host attributes of the KVM guest...

[root@cluster config]# rocks list host attr vcn-1-11 | egrep "cpu_m"
vcn-1-11: cpu_match host-passthrough:
H

Report xml config of the KVM guest...

[root@cluster config]# rocks report host vm config vcn-1-11 | grep "cpu mode" -B1 -A2
24


NOTE: The topology configuration is now reported

That's somehow expected.

The cpu_mode has precedence over the cpu_match, and it doesn't matter
if attributes are declared with global, appliance, or host scope the
one which wins count.

In your case since you have both cpu_match and cpu_mode declared :

[root@cluster config]# rocks list host attr vcn-1-11 | egrep "cpu_m"
vcn-1-11: cpu_match host-passthrough: H
vcn-1-11: cpu_mode host-passthrough
G

cpu_mode wins and set the cpu tag.

I think we can make this a little easier and leave some of the
(useless) complexity out.

My idea is to leave only 1 attribute (let's say cpu_mode) then if its
value does not contain a colon, nothing change (it works exactly like
now) if there is a colon it will behave like cpu_match does now.
So at least we have only 1 attribute to think about and the
documentation gets also easier.

What do you think? Does it sounds easier to you?

Luca

@tcooper
Copy link
Contributor Author

tcooper commented Dec 28, 2014

Can't think of any down-sides as this isn't in production anywhere yet...

  • Easy application 👍
  • Solves problem 👍
  • Makes documentation easier 👍

I'd say add it before release of 6.2 if at all possible.

lclementi added a commit that referenced this issue Jan 6, 2015
The usage fo two attribute was confusing and complex with no
benefit.

This commit leaves only cpu_mode and the colon will be used for the
extra content which might be used insde the cpu tag.

See #11
@lclementi
Copy link
Contributor

4c123a0

fixed

@lclementi lclementi self-assigned this Jan 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants