dom0/qmemman: minor fix in mem_set()
Set target/maxmem in more logical order (balloon driver can fail to balloon the first time, but will retry anyway). Force sizes to be integers.
This commit is contained in:
		
							parent
							
								
									41efe076b2
								
							
						
					
					
						commit
						421b13b6c4
					
				@ -58,14 +58,14 @@ class SystemState:
 | 
				
			|||||||
    def mem_set(self, id, val):
 | 
					    def mem_set(self, id, val):
 | 
				
			||||||
        print 'mem-set domain', id, 'to', val
 | 
					        print 'mem-set domain', id, 'to', val
 | 
				
			||||||
        self.domdict[id].last_target = val
 | 
					        self.domdict[id].last_target = val
 | 
				
			||||||
        self.xs.write('', '/local/domain/' + id + '/memory/target', str(val/1024))
 | 
					 | 
				
			||||||
#can happen in the middle of domain shutdown
 | 
					#can happen in the middle of domain shutdown
 | 
				
			||||||
#apparently xc.lowlevel throws exceptions too
 | 
					#apparently xc.lowlevel throws exceptions too
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            self.xc.domain_setmaxmem(int(id), val/1024 + 1024) # LIBXL_MAXMEM_CONSTANT=1024
 | 
					            self.xc.domain_setmaxmem(int(id), int(val/1024) + 1024) # LIBXL_MAXMEM_CONSTANT=1024
 | 
				
			||||||
            self.xc.domain_set_target_mem(int(id), val/1024)
 | 
					            self.xc.domain_set_target_mem(int(id), int(val/1024))
 | 
				
			||||||
        except:
 | 
					        except:
 | 
				
			||||||
            pass
 | 
					            pass
 | 
				
			||||||
 | 
					        self.xs.write('', '/local/domain/' + id + '/memory/target', str(int(val/1024)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def mem_set_obsolete(self, id, val):
 | 
					    def mem_set_obsolete(self, id, val):
 | 
				
			||||||
        uuid = self.domdict[id].uuid
 | 
					        uuid = self.domdict[id].uuid
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user