Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
f06f423d
authored
Feb 20, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
one: more consistent host names
parent
cfd5ca86
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
one/models.py
+5
-2
No files found.
one/models.py
View file @
f06f423d
...
...
@@ -476,6 +476,7 @@ class Instance(models.Model):
out
=
""
inst
=
Instance
(
pw
=
pwgen
(),
template
=
template
,
owner
=
owner
,
share
=
share
)
inst
.
save
()
hostname
=
u"cloud-
%
d"
%
(
inst
.
id
,
)
with
tempfile
.
NamedTemporaryFile
(
delete
=
False
)
as
f
:
os
.
chmod
(
f
.
name
,
stat
.
S_IRUSR
|
stat
.
S_IWUSR
|
stat
.
S_IRGRP
|
stat
.
S_IROTH
)
token
=
signing
.
dumps
(
inst
.
id
,
salt
=
'activate'
)
...
...
@@ -497,7 +498,7 @@ class Instance(models.Model):
</NIC>
<CONTEXT>
<SOURCE>web</SOURCE>
<HOSTNAME>
cloud-$VMID
</HOSTNAME>
<HOSTNAME>
%(hostname)
s
</HOSTNAME>
<NEPTUN>
%(neptun)
s</NEPTUN>
<USERPW>
%(pw)
s</USERPW>
<SMBPW>
%(smbpw)
s</SMBPW>
...
...
@@ -511,6 +512,7 @@ class Instance(models.Model):
"disk"
:
template
.
disk
.
id
,
"net"
:
template
.
network
.
id
,
"pw"
:
escape
(
inst
.
pw
),
"hostname"
:
escape
(
hostname
),
"smbpw"
:
escape
(
details
.
smb_password
),
"sshkey"
:
escape
(
details
.
ssh_private_key
),
"neptun"
:
escape
(
owner
.
username
),
...
...
@@ -527,6 +529,7 @@ class Instance(models.Model):
try
:
x
=
parseString
(
out
)
except
:
inst
.
delete
()
raise
Exception
(
"Unable to create VM instance."
)
inst
.
one_id
=
int
(
x
.
getElementsByTagName
(
"ID"
)[
0
]
.
childNodes
[
0
]
.
nodeValue
)
...
...
@@ -538,7 +541,7 @@ class Instance(models.Model):
inst
.
update_state
()
host
=
Host
(
vlan
=
Vlan
.
objects
.
get
(
name
=
template
.
network
.
name
),
owner
=
owner
,
shared_ip
=
True
)
host
.
hostname
=
u"id-
%
d_user-
%
s"
%
(
inst
.
id
,
owner
.
username
)
host
.
hostname
=
hostname
host
.
mac
=
x
.
getElementsByTagName
(
"MAC"
)[
0
]
.
childNodes
[
0
]
.
nodeValue
host
.
ipv4
=
inst
.
ip
host
.
pub_ipv4
=
Vlan
.
objects
.
get
(
name
=
template
.
network
.
name
)
.
snat_ip
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment