Lines 42-47
from protocol import Disk, Data_Pool
|
Link Here
|
---|
|
42 |
import os.path |
42 |
import os.path |
43 |
import univention.config_registry as ucr |
43 |
import univention.config_registry as ucr |
44 |
import time |
44 |
import time |
|
|
45 |
from xml.sax.saxutils import escape as xml_escape |
45 |
|
46 |
|
46 |
configRegistry = ucr.ConfigRegistry() |
47 |
configRegistry = ucr.ConfigRegistry() |
47 |
configRegistry.load() |
48 |
configRegistry.load() |
Lines 63-70
def create_storage_pool(conn, dir, pool_name='default'):
|
Link Here
|
---|
|
63 |
</target> |
64 |
</target> |
64 |
</pool> |
65 |
</pool> |
65 |
''' % { |
66 |
''' % { |
66 |
'pool': pool_name, |
67 |
'pool': xml_escape(pool_name), |
67 |
'path': dir, |
68 |
'path': xml_escape(dir), |
68 |
} |
69 |
} |
69 |
try: |
70 |
try: |
70 |
p = conn.storagePoolDefineXML(xml, 0) |
71 |
p = conn.storagePoolDefineXML(xml, 0) |
Lines 127-133
def create_storage_volume(conn, domain, disk):
|
Link Here
|
---|
|
127 |
size = 8 << 30 # GiB |
128 |
size = 8 << 30 # GiB |
128 |
|
129 |
|
129 |
values = { |
130 |
values = { |
130 |
'name': os.path.basename(disk.source), |
131 |
'name': xml_escape(os.path.basename(disk.source)), |
131 |
'size': size, |
132 |
'size': size, |
132 |
} |
133 |
} |
133 |
|
134 |
|
Lines 137-143
def create_storage_volume(conn, domain, disk):
|
Link Here
|
---|
|
137 |
pool_type = doc.firstChild.getAttribute('type') |
138 |
pool_type = doc.firstChild.getAttribute('type') |
138 |
if pool_type in ('dir', 'fs', 'netfs'): |
139 |
if pool_type in ('dir', 'fs', 'netfs'): |
139 |
if hasattr(disk, 'driver_type') and disk.driver_type not in (None, 'iso', 'aio'): |
140 |
if hasattr(disk, 'driver_type') and disk.driver_type not in (None, 'iso', 'aio'): |
140 |
values['type'] = disk.driver_type |
141 |
values['type'] = xml_escape(disk.driver_type) |
141 |
else: |
142 |
else: |
142 |
values['type'] = 'raw' |
143 |
values['type'] = 'raw' |
143 |
# permissions |
144 |
# permissions |