Commit f2876140 by Karsa Zoltán István

hotplug bugfix

parent 46c893d2
...@@ -102,8 +102,8 @@ urlpatterns = [ ...@@ -102,8 +102,8 @@ urlpatterns = [
path('acpi/interface/<int:pk>/', GetInterfaceREST.as_view()), path('acpi/interface/<int:pk>/', GetInterfaceREST.as_view()),
path('acpi/ftusers/', InstanceFTforUsersREST.as_view()), path('acpi/ftusers/', InstanceFTforUsersREST.as_view()),
path('acpi/ftusersid/', InstanceFTforUsersIdREST.as_view()), path('acpi/ftusersid/', InstanceFTforUsersIdREST.as_view()),
path('acpi/vm/<int:pk>/hotplugmem/', HotplugVCPUSetREST.as_view()), path('acpi/vm/<int:pk>/hotplugmem/', HotplugMemSetREST.as_view()),
path('acpi/vm/<int:pk>/hotplugvcpu/', HotplugMemSetREST.as_view()), path('acpi/vm/<int:pk>/hotplugvcpu/', HotplugVCPUSetREST.as_view()),
path('acpi/vm/<int:pk>/downloaddisk/', DownloadDiskREST.as_view()), path('acpi/vm/<int:pk>/downloaddisk/', DownloadDiskREST.as_view()),
path('acpi/vm/<int:vm_id>/port/<int:vlan_id>/', SetupPortREST.as_view()), path('acpi/vm/<int:vm_id>/port/<int:vlan_id>/', SetupPortREST.as_view()),
path('acpi/vm/<int:vm_id>/rules/<int:vlan_id>/', RulesREST.as_view()), path('acpi/vm/<int:vm_id>/rules/<int:vlan_id>/', RulesREST.as_view()),
......
...@@ -195,8 +195,8 @@ class HotplugMemSetREST(APIView): ...@@ -195,8 +195,8 @@ class HotplugMemSetREST(APIView):
def put(self, request, pk, format=None): def put(self, request, pk, format=None):
instance = Instance.objects.get(pk=pk) instance = Instance.objects.get(pk=pk)
data = JSONParser().parse(request) data = JSONParser().parse(request)
ram_size = int(data["ram_size"]) ram_size = int(data["ram_size"])
instance.hotplug_mem(user=request.user, memory=ram_size) instance.hotplug_mem(user=request.user, memory=ram_size*1024 )
instance.ram_size = ram_size instance.ram_size = ram_size
instance.save() instance.save()
serializer = InstanceSerializer(instance) serializer = InstanceSerializer(instance)
......
...@@ -1466,6 +1466,10 @@ class HotPlugMem(RemoteInstanceOperation): ...@@ -1466,6 +1466,10 @@ class HotPlugMem(RemoteInstanceOperation):
accept_states = ('RUNNING',) accept_states = ('RUNNING',)
task = vm_tasks.hotplug_memset task = vm_tasks.hotplug_memset
def _get_remote_args(self, **kwargs):
return (super(HotPlugMem, self)._get_remote_args(**kwargs) + [kwargs["memory"]] )
@register_operation @register_operation
class HotPlugVCPU(RemoteInstanceOperation): class HotPlugVCPU(RemoteInstanceOperation):
id = 'hotplug_vcpu' id = 'hotplug_vcpu'
...@@ -1476,6 +1480,9 @@ class HotPlugVCPU(RemoteInstanceOperation): ...@@ -1476,6 +1480,9 @@ class HotPlugVCPU(RemoteInstanceOperation):
accept_states = ('RUNNING',) accept_states = ('RUNNING',)
task = vm_tasks.hotplug_vcpuset task = vm_tasks.hotplug_vcpuset
def _get_remote_args(self, **kwargs):
return (super(HotPlugMem, self)._get_remote_args(**kwargs) + [kwargs["num_cores"]] )
@register_operation @register_operation
class RecoverOperation(InstanceOperation): class RecoverOperation(InstanceOperation):
......
...@@ -188,9 +188,9 @@ def screenshot(params): ...@@ -188,9 +188,9 @@ def screenshot(params):
pass pass
@celery.task(name='vmdriver.hotplug_memset') @celery.task(name='vmdriver.hotplug_memset')
def hotplug_memset(name, memory): def hotplug_memset(params):
pass pass
@celery.task(name='vmdriver.hotplug_vcpuset') @celery.task(name='vmdriver.hotplug_vcpuset')
def hotplug_vcpuset(name, vcpu): def hotplug_vcpuset(params):
pass pass
\ No newline at end of file
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