mirror of
https://github.com/retspen/webvirtcloud
synced 2025-01-12 08:25:18 +00:00
db migrations and storage list allocation info changes
This commit is contained in:
parent
4126ad2591
commit
171f98b232
2 changed files with 40 additions and 3 deletions
20
instances/migrations/0004_auto_20180724_1136.py
Normal file
20
instances/migrations/0004_auto_20180724_1136.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.13 on 2018-07-24 11:36
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('instances', '0003_instance_created'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='instance',
|
||||||
|
name='name',
|
||||||
|
field=models.CharField(max_length=120),
|
||||||
|
),
|
||||||
|
]
|
|
@ -169,6 +169,10 @@ class wvmStorage(wvmConnect):
|
||||||
vol = self.get_volume(name)
|
vol = self.get_volume(name)
|
||||||
return vol.info()[1]
|
return vol.info()[1]
|
||||||
|
|
||||||
|
def get_volume_allocation(self, name):
|
||||||
|
vol = self.get_volume(name)
|
||||||
|
return vol.info()[2]
|
||||||
|
|
||||||
def _vol_XMLDesc(self, name):
|
def _vol_XMLDesc(self, name):
|
||||||
vol = self.get_volume(name)
|
vol = self.get_volume(name)
|
||||||
return vol.XMLDesc(0)
|
return vol.XMLDesc(0)
|
||||||
|
@ -196,6 +200,7 @@ class wvmStorage(wvmConnect):
|
||||||
vol_list.append(
|
vol_list.append(
|
||||||
{'name': volname,
|
{'name': volname,
|
||||||
'size': self.get_volume_size(volname),
|
'size': self.get_volume_size(volname),
|
||||||
|
'allocation': self.get_volume_allocation(volname),
|
||||||
'type': self.get_volume_type(volname)}
|
'type': self.get_volume_type(volname)}
|
||||||
)
|
)
|
||||||
return vol_list
|
return vol_list
|
||||||
|
@ -216,14 +221,20 @@ class wvmStorage(wvmConnect):
|
||||||
<allocation>%s</allocation>
|
<allocation>%s</allocation>
|
||||||
<target>
|
<target>
|
||||||
<format type='%s'/>
|
<format type='%s'/>
|
||||||
|
<permissions>
|
||||||
|
<owner>107</owner>
|
||||||
|
<group>107</group>
|
||||||
|
<mode>0644</mode>
|
||||||
|
<label>virt_image_t</label>
|
||||||
|
</permissions>
|
||||||
</target>
|
</target>
|
||||||
</volume>""" % (name, size, alloc, vol_fmt)
|
</volume>""" % (name, size, alloc, vol_fmt)
|
||||||
self._createXML(xml, metadata)
|
self._createXML(xml, metadata)
|
||||||
|
|
||||||
def clone_volume(self, name, clone, vol_fmt=None, metadata=False):
|
def clone_volume(self, name, target_file, vol_fmt=None, metadata=False):
|
||||||
storage_type = self.get_type()
|
storage_type = self.get_type()
|
||||||
if storage_type == 'dir':
|
if storage_type == 'dir':
|
||||||
clone += '.img'
|
target_file += '.img'
|
||||||
vol = self.get_volume(name)
|
vol = self.get_volume(name)
|
||||||
if not vol_fmt:
|
if not vol_fmt:
|
||||||
vol_fmt = self.get_volume_type(name)
|
vol_fmt = self.get_volume_type(name)
|
||||||
|
@ -234,6 +245,12 @@ class wvmStorage(wvmConnect):
|
||||||
<allocation>0</allocation>
|
<allocation>0</allocation>
|
||||||
<target>
|
<target>
|
||||||
<format type='%s'/>
|
<format type='%s'/>
|
||||||
|
<permissions>
|
||||||
|
<owner>107</owner>
|
||||||
|
<group>107</group>
|
||||||
|
<mode>0644</mode>
|
||||||
|
<label>virt_image_t</label>
|
||||||
|
</permissions>
|
||||||
</target>
|
</target>
|
||||||
</volume>""" % (clone, vol_fmt)
|
</volume>""" % (target_file, vol_fmt)
|
||||||
self._createXMLFrom(xml, vol, metadata)
|
self._createXMLFrom(xml, vol, metadata)
|
||||||
|
|
Loading…
Reference in a new issue