Projet

Général

Profil

Révision 17f78427

ID17f784270ae966ee9a13e9f5104a5b8f925b639e
Parent ef851f0c
Enfant d4320aea, 5b2396a9

Ajouté par Lars Kruse il y a plus de 7 ans

Whitespace cleanup

  • remove trailing whitespace
  • remove empty lines at the end of files

Voir les différences:

plugins/libvirt/kvm_io
37 37
        print "%s_read.info I/O used by virtual machine %s" % (vm, vm)
38 38
        print "%s_write.label %s" % (vm, vm)
39 39
        print "%s_write.type COUNTER" % vm
40
        print "%s_write.min 0" % vm        
40
        print "%s_write.min 0" % vm
41 41
        print "%s_write.draw LINE1" % vm
42 42
        print "%s_write.negative %s_read" % (vm, vm)
43 43
        print "%s_write.info I/O used by virtual machine %s" % (vm, vm)
......
53 53
        vm_name = re.sub(suffix,'',vm_name)
54 54

  
55 55
    return re.sub(r"[^a-zA-Z0-9_]", "_", vm_name)
56
    
56

  
57 57
def fetch(vms):
58 58
    ''' Fetch values for a list of pids
59 59
    @param dictionnary {kvm_pid: cleaned vm name}
......
64 64
        for line in f.readlines():
65 65
            if "read_bytes" in line:
66 66
                read = line.split()[1]
67
                print "%s_read.value %s" % (vms[pid], read) 
67
                print "%s_read.value %s" % (vms[pid], read)
68 68
            if "write_bytes" in line:
69 69
                write = line.split()[1]
70
                print "%s_write.value %s" % (vms[pid], write) 
71
                break            
70
                print "%s_write.value %s" % (vms[pid], write)
71
                break
72 72
        f.close()
73 73

  
74 74
def detect_kvm():
......
87 87
        cmdline = open("/proc/%s/cmdline" % pid, "r")
88 88
        result[pid] = clean_vm_name(re.sub(r"^.*-name\x00([a-zA-Z0-9.-_-]*)\x00\-.*$",r"\1", cmdline.readline()))
89 89
    return result
90
    
90

  
91 91
def list_pids():
92 92
    ''' Find the pid of kvm processes
93 93
    @return a list of pids from running kvm
94 94
    '''
95 95
    pid = Popen("pidof qemu-kvm qemu-system-x86_64 kvm", shell=True, stdout=PIPE)
96 96
    return pid.communicate()[0].split()
97
    
97

  
98 98
if __name__ == "__main__":
99 99
    if len(sys.argv) > 1:
100 100
        if sys.argv[1] in ['autoconf', 'detect']:

Formats disponibles : Unified diff