Esempio n. 1
0
 def refresh_host_space (self):
     if not conf.USE_LVM:
         return
     try:
         extra = 0
         if "LVM_VG_MIN_SPACE" in dir(conf) and conf.LVM_VG_MIN_SPACE:
             extra = int(conf.LVM_VG_MIN_SPACE)
         disk_remain = vps_common.vg_free_space (conf.VPS_LVM_VGNAME) # in g
         disk_remain -= extra
         if disk_remain < 0:
             disk_remain = 0
         xen_inf = get_xen_inf ()
         mem_remain = xen_inf.mem_free () # in m
         trans, client = self.get_client ()
         trans.open ()
         try:
             client.host_refresh (self.host_id, disk_remain, mem_remain)
         finally:
             trans.close ()
         self.logger.info ("send host remain disk:%dG, mem:%dM" % (disk_remain, mem_remain))
     except Exception, e:
         self.logger_err.exception (e)
Esempio n. 2
0
 def refresh_host_space(self):
     if not conf.USE_LVM:
         return
     try:
         extra = 0
         if "LVM_VG_MIN_SPACE" in dir(conf) and conf.LVM_VG_MIN_SPACE:
             extra = int(conf.LVM_VG_MIN_SPACE)
         disk_remain = vps_common.vg_free_space(conf.VPS_LVM_VGNAME)  # in g
         disk_remain -= extra
         if disk_remain < 0:
             disk_remain = 0
         xen_inf = get_xen_inf()
         mem_remain = xen_inf.mem_free()  # in m
         trans, client = self.get_client()
         trans.open()
         try:
             client.host_refresh(self.host_id, disk_remain, mem_remain)
         finally:
             trans.close()
         self.logger.info("send host remain disk:%dG, mem:%dM" %
                          (disk_remain, mem_remain))
     except Exception, e:
         self.logger_err.exception(e)
Esempio n. 3
0
#!/usr/bin/env python

import _env
import conf
from ops.vps_common import vg_free_space
from vps_mgr import VPSMgr

if __name__ == '__main__':
    disk_free = vg_free_space(conf.VPS_LVM_VGNAME)
    print disk_free
    client = VPSMgr()
    client.refresh_host_space()

# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 :
Esempio n. 4
0
#!/usr/bin/env python

import _env
import conf
from ops.vps_common import vg_free_space
from vps_mgr import VPSMgr

if __name__ == '__main__':
    disk_free = vg_free_space (conf.VPS_LVM_VGNAME)
    print disk_free
    client = VPSMgr ()
    client.refresh_host_space ()

# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 :