projects
/
invirt/packages/invirt-web.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
depend on remctl-client in invirt-base, not invirt-web
[invirt/packages/invirt-web.git]
/
code
/
main.py
diff --git
a/code/main.py
b/code/main.py
index
226a038
..
438144a
100755
(executable)
--- a/
code/main.py
+++ b/
code/main.py
@@
-121,7
+121,7
@@
class Defaults:
if max_memory is not None:
self.memory = min(self.memory, max_memory)
if max_disk is not None:
if max_memory is not None:
self.memory = min(self.memory, max_memory)
if max_disk is not None:
- self.max_disk = min(self.disk, max_disk)
+ self.disk = min(self.disk, max_disk)
for key in kws:
setattr(self, key, kws[key])
for key in kws:
setattr(self, key, kws[key])
@@
-201,8
+201,7
@@
def getListDict(username, state):
checkpoint.checkpoint('Got max mem/disk')
defaults = Defaults(max_memory=max_memory,
max_disk=max_disk,
checkpoint.checkpoint('Got max mem/disk')
defaults = Defaults(max_memory=max_memory,
max_disk=max_disk,
- owner=username,
- cdrom='gutsy-i386')
+ owner=username)
checkpoint.checkpoint('Got defaults')
def sortkey(machine):
return (machine.owner != username, machine.owner, machine.name)
checkpoint.checkpoint('Got defaults')
def sortkey(machine):
return (machine.owner != username, machine.owner, machine.name)
@@
-270,13
+269,16
@@
def getHostname(nic):
XXX this should be merged with the similar logic in DNS and DHCP.
"""
XXX this should be merged with the similar logic in DNS and DHCP.
"""
- if nic.hostname and '.' in nic.hostname:
- return nic.hostname
+ if nic.hostname:
+ hostname = nic.hostname
elif nic.machine:
elif nic.machine:
- return nic.machine.name + '.' + config.dns.domains[0]
+ hostname = nic.machine.name
else:
return None
else:
return None
-
+ if '.' in hostname:
+ return hostname
+ else:
+ return hostname + '.' + config.dns.domains[0]
def getNicInfo(data_dict, machine):
"""Helper function for info, get data on nics for a machine.
def getNicInfo(data_dict, machine):
"""Helper function for info, get data on nics for a machine.
@@
-292,8
+294,7
@@
def getNicInfo(data_dict, machine):
nic_fields = []
for i in range(len(machine.nics)):
nic_fields.extend([(x % i, y % i) for x, y in nic_fields_template])
nic_fields = []
for i in range(len(machine.nics)):
nic_fields.extend([(x % i, y % i) for x, y in nic_fields_template])
- if not i:
- data_dict['nic%s_hostname' % i] = getHostname(machine.nics[i])
+ data_dict['nic%s_hostname' % i] = getHostname(machine.nics[i])
data_dict['nic%s_mac' % i] = machine.nics[i].mac_addr
data_dict['nic%s_ip' % i] = machine.nics[i].ip
if len(machine.nics) == 1:
data_dict['nic%s_mac' % i] = machine.nics[i].mac_addr
data_dict['nic%s_ip' % i] = machine.nics[i].ip
if len(machine.nics) == 1:
@@
-378,6
+379,9
@@
def modifyDict(username, state, fields):
update_acl = True
if hasattr(validate, 'name'):
machine.name = validate.name
update_acl = True
if hasattr(validate, 'name'):
machine.name = validate.name
+ for n in machine.nics:
+ if n.hostname == oldname:
+ n.hostname = validate.name
if hasattr(validate, 'description'):
machine.description = validate.description
if hasattr(validate, 'admin') and validate.admin != machine.administrator:
if hasattr(validate, 'description'):
machine.description = validate.description
if hasattr(validate, 'admin') and validate.admin != machine.administrator:
@@
-522,8
+526,6
@@
def infoDict(username, state, machine):
cpu_time_float = float(main_status.get('cpu_time', 0))
cputime = datetime.timedelta(seconds=int(cpu_time_float))
checkpoint.checkpoint('Status')
cpu_time_float = float(main_status.get('cpu_time', 0))
cputime = datetime.timedelta(seconds=int(cpu_time_float))
checkpoint.checkpoint('Status')
- display_fields = """name uptime memory state cpu_weight on_reboot
- on_poweroff on_crash on_xend_start on_xend_stop bootloader""".split()
display_fields = [('name', 'Name'),
('description', 'Description'),
('owner', 'Owner'),
display_fields = [('name', 'Name'),
('description', 'Description'),
('owner', 'Owner'),
@@
-538,12
+540,6
@@
def infoDict(username, state, machine):
'DISK_INFO',
('state', 'state (xen format)'),
('cpu_weight', 'CPU weight'+helppopup('CPU Weight')),
'DISK_INFO',
('state', 'state (xen format)'),
('cpu_weight', 'CPU weight'+helppopup('CPU Weight')),
- ('on_reboot', 'Action on VM reboot'),
- ('on_poweroff', 'Action on VM poweroff'),
- ('on_crash', 'Action on VM crash'),
- ('on_xend_start', 'Action on Xen start'),
- ('on_xend_stop', 'Action on Xen stop'),
- ('bootloader', 'Bootloader options'),
]
fields = []
machine_info = {}
]
fields = []
machine_info = {}
@@
-682,7
+678,7
@@
def getUser(environ):
if environ.get('AUTH_TYPE') == 'Negotiate':
# Convert the krb5 principal into a krb4 username
if environ.get('AUTH_TYPE') == 'Negotiate':
# Convert the krb5 principal into a krb4 username
- if not user.endswith('@%s' % config.authn[0].realm):
+ if not user.endswith('@%s' % config.kerberos.realm):
return
else:
return user.split('@')[0].replace('/', '.')
return
else:
return user.split('@')[0].replace('/', '.')