mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
changing video card model functionality added to options.
This commit is contained in:
parent
60684cc7b1
commit
74eb8004d7
5 changed files with 77 additions and 7 deletions
|
|
@ -480,7 +480,7 @@ class wvmConnect(object):
|
|||
"""Get available image filename extensions"""
|
||||
return ['img', 'qcow', 'qcow2']
|
||||
|
||||
def get_video(self):
|
||||
def get_video_models(self):
|
||||
""" Get available graphics video types """
|
||||
def get_video_list(ctx):
|
||||
result = []
|
||||
|
|
|
|||
|
|
@ -763,6 +763,28 @@ class wvmInstance(wvmConnect):
|
|||
def get_console_keymap(self):
|
||||
return util.get_xml_path(self._XMLDesc(VIR_DOMAIN_XML_SECURE), "/domain/devices/graphics/@keymap") or ''
|
||||
|
||||
def get_video_model(self):
|
||||
""" :return only primary video card"""
|
||||
xml = self._XMLDesc(VIR_DOMAIN_XML_SECURE)
|
||||
tree = etree.fromstring(xml)
|
||||
video_models = tree.xpath("/domain/devices/video/model")
|
||||
for model in video_models:
|
||||
if model.get('primary') == 'yes' or len(video_models) == 1:
|
||||
return model.get('type')
|
||||
|
||||
def set_video_model(self, model):
|
||||
""" Changes only primary video card"""
|
||||
xml = self._XMLDesc(VIR_DOMAIN_XML_SECURE)
|
||||
tree = etree.fromstring(xml)
|
||||
video_models = tree.xpath("/domain/devices/video/model")
|
||||
video_xml = "<model type='{}'/>".format(model)
|
||||
for model in video_models:
|
||||
if model.get('primary') == 'yes' or len(video_models) == 1:
|
||||
parent = model.getparent()
|
||||
parent.remove(model)
|
||||
parent.append(etree.fromstring(video_xml))
|
||||
self._defineXML(etree.tostring(tree))
|
||||
|
||||
def resize(self, cur_memory, memory, cur_vcpu, vcpu, disks=[]):
|
||||
"""
|
||||
Function change ram and cpu on vds.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue