示例#1
0
 def get_info(ctx):
     mem = util.get_xpath(ctx, "/domain/currentMemory")
     mem = int(mem) / 1024
     cur_vcpu = util.get_xpath(ctx, "/domain/vcpu/@current")
     if cur_vcpu:
         vcpu = cur_vcpu
     else:
         vcpu = util.get_xpath(ctx, "/domain/vcpu")
     title = util.get_xpath(ctx, "/domain/title")
     title = title if title else ''
     description = util.get_xpath(ctx, "/domain/description")
     description = description if description else ''
     return (mem, vcpu, title, description)
示例#2
0
 def get_info(doc):
     mem = util.get_xpath(doc, "/domain/currentMemory")
     mem = int(mem) / 1024
     if raw_mem_size:
         mem = int(mem) * (1024 * 1024)
     cur_vcpu = util.get_xpath(doc, "/domain/vcpu/@current")
     if cur_vcpu:
         vcpu = cur_vcpu
     else:
         vcpu = util.get_xpath(doc, "/domain/vcpu")
     title = util.get_xpath(doc, "/domain/title")
     title = title if title else ''
     description = util.get_xpath(doc, "/domain/description")
     description = description if description else ''
     return (mem, vcpu, title, description)
示例#3
0
 def get_info(ctx):
     dev_type = util.get_xpath('/device/capability/@type')
     interface = util.get_xpath('/device/capability/interface')
     return (dev_type, interface)
示例#4
0
 def get_info(doc):
     dev_type = util.get_xpath(doc, '/device/capability/@type')
     interface = util.get_xpath(doc, '/device/capability/interface')
     return dev_type, interface
示例#5
0
 def get_forward(doc):
     forward_mode = util.get_xpath(doc, "/network/forward/@mode")
     return forward_mode or "isolated"
示例#6
0
 def get_forward(doc):
     forward_mode = util.get_xpath(doc, '/network/forward/@mode')
     return forward_mode or 'isolated'