mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
Add guest info like:hostname,os,version,kernel. indendation fixes
This commit is contained in:
parent
993a247228
commit
d30e6470e2
13 changed files with 1540 additions and 1460 deletions
|
@ -1,3 +1,4 @@
|
|||
import json
|
||||
import os.path
|
||||
import time
|
||||
|
||||
|
@ -20,6 +21,10 @@ try:
|
|||
VIR_MIGRATE_POSTCOPY,
|
||||
)
|
||||
from libvirt import VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT
|
||||
from libvirt_qemu import (
|
||||
qemuAgentCommand,
|
||||
VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT
|
||||
)
|
||||
except:
|
||||
from libvirt import libvirtError, VIR_DOMAIN_XML_SECURE, VIR_MIGRATE_LIVE
|
||||
|
||||
|
@ -160,6 +165,35 @@ class wvmInstance(wvmConnect):
|
|||
self._ip_cache = None
|
||||
self.instance = self.get_instance(vname)
|
||||
|
||||
def osinfo(self):
|
||||
info_results = qemuAgentCommand(
|
||||
self.instance,
|
||||
'{"execute":"guest-get-osinfo"}',
|
||||
VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT, 0
|
||||
)
|
||||
|
||||
timezone_results = qemuAgentCommand(
|
||||
self.instance,
|
||||
'{"execute":"guest-get-timezone"}',
|
||||
VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT, 0
|
||||
)
|
||||
|
||||
hostname_results = qemuAgentCommand(
|
||||
self.instance,
|
||||
'{"execute":"guest-get-host-name"}',
|
||||
VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT, 0
|
||||
)
|
||||
|
||||
info_results = json.loads(info_results).get('return')
|
||||
|
||||
timezone_results = json.loads(timezone_results).get('return')
|
||||
hostname_results = json.loads(hostname_results).get('return')
|
||||
|
||||
info_results.update(timezone_results)
|
||||
info_results.update(hostname_results)
|
||||
|
||||
return info_results
|
||||
|
||||
def start(self):
|
||||
self.instance.create()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue