Commit e58b4331 by cloud

fix

parent cf92ed49
......@@ -241,7 +241,7 @@ class VmDetailView(CheckedDetailView):
'new_name': self.__set_name,
'new_description': self.__set_description,
'new_tag': self.__add_tag,
'deploy_locall': self.donothing,
'deploy_local': self.__deploy_local,
'to_remove': self.__remove_tag,
'port': self.__add_port,
'new_network_vlan': self.__new_network,
......@@ -250,9 +250,6 @@ class VmDetailView(CheckedDetailView):
if request.POST.get(k) is not None:
return v(request)
def donothing(self, request):
pass
def __deploy_local(self, request):
self.object = self.get_object()
if not self.object.has_level(request.user, 'owner'):
......
......@@ -31,6 +31,7 @@ from .node import Node, Trait
import random
import string
import socket
logger = getLogger(__name__)
pre_state_changed = Signal(providing_args=["new_state"])
......@@ -792,7 +793,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
queue=queue_name
).get(timeout=timeout)
def __deployii_local_vm(self, act, timeout=15):
def __deploy_local_vm(self, act, timeout=15):
"""Local deploy the virtual machine.
:param self: The virtual machine.
......@@ -803,10 +804,15 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
# create hardlink
hlinkname = ''.join(random.choice(string.ascii_uppercase +
string.digits) for _ in range(20))
remotedest = '/home/gergo/vmdisks/' + hlinkname
remotedest = hlinkname
localsrc = descriptor['disk_list'][0]['source']
descriptor['disk_list'][0]['source'] = remotedest
return ""
originalname = localsrc.split("/")
originalname = originalname[len(originalname)-1]
hlmakersocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
hlmakersocket.connect(('localhost', 40000))
hlmakersocket.send(originalname + "/" + hlinkname)
return descriptor
def deploy_local(self, user=None, task_uuid=None):
"""Deploy new virtual machine with network
......@@ -831,8 +837,7 @@ ecuted
with instance_activity(code_suffix='local_deploy', instance=self,
on_commit=__on_commit, task_uuid=task_uuid,
user=user) as act:
return ""
# return self.__deploy_local_vm(act)
return self.__deploy_local_vm(act)
def migrate_vm(self, to_node, timeout=120):
queue_name = self.get_remote_queue_name('vm')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment