Bug #467
Set language to english before running commands
| Status: | Closed | Start date: | 01/14/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% | ||
| Category: | Drivers - Auth | |||
| Target version: | Release 2.2 | |||
| Resolution: | fixed | Pull request: | ||
| Affected Versions: |
Description
Probes and commands rely on english output of commands so they fail when the OS language is set to other language.
Related issues
Associated revisions
History
#1
Updated by Łukasz Oleś over 10 years ago
Instead of parsing programs output in bash script better idea is to use libvirt and xen api. For example /var/tmp/one/vmm/kvm/poll could be written in that way:
#!/bin/python
import sys
import libvirt
URI = 'qemu:///system'
states = {
libvirt.VIR_DOMAIN_RUNNING : 'a',
libvirt.VIR_DOMAIN_BLOCKED : 'a',
libvirt.VIR_DOMAIN_SHUTDOWN : 'a',
libvirt.VIR_DOMAIN_SHUTOFF : 'a',
libvirt.VIR_DOMAIN_PAUSED : 'p',
libvirt.VIR_DOMAIN_CRASHED : 'c',
}
conn = libvirt.openReadOnly(URI)
if conn == None:
sys.exit(1)
try:
domain = conn.lookupByID(int(sys.argv[1]))
state, max_mem, mem, nr_cpus, time_cpu = domain.info()
state = states.get(state, 'u')
print 'STATE=%s MEMORY=%d' % (state, mem)
except:
print 'STATE=d'
I'm using python bindings here, but of course ruby-bindings also exists.
#2
Updated by Javi Fontan over 10 years ago
- Status changed from New to Closed
- Resolution set to fixed