Skip to content

Commit

Permalink
after_vm_start hook: migrate to the new jsonrpc client
Browse files Browse the repository at this point in the history
remove jsonrpcvdscli commands from the hook and
migrate to the new jsonrpc client

Change-Id: I5ef3438a310c1875fa0bf651360b218303f61a61
Signed-off-by: Irit goihman <[email protected]>
  • Loading branch information
Irit Goihman authored and dankenigsberg committed Dec 19, 2016
1 parent 090a16a commit b0437ad
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions vdsm_hooks/openstacknet/after_vm_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
Where:
VM_ID should be replaced with the vm id.'''

from contextlib import closing
import libvirt
import os
import time
import traceback
import hooking
from openstacknet_utils import MARK_FOR_UNPAUSE_PATH
from openstacknet_utils import VM_ID_KEY
from vdsm import jsonrpcvdscli

from vdsm import client
from vdsm.config import config
from vdsm import utils


OPENSTACK_NIC_WAIT_TIME = 15
Expand All @@ -27,8 +29,10 @@
def resume_paused_vm(vm_id):
unpause_file = MARK_FOR_UNPAUSE_PATH % vm_id
if os.path.isfile(unpause_file):
with closing(jsonrpcvdscli.connect()) as server:
server.cont(vm_id)
use_tls = config.getboolean('vars', 'ssl')
cli = client.connect('localhost', use_tls=use_tls)
with utils.closing(cli):
cli.VM.cont(vmID=vm_id)
os.remove(unpause_file)


Expand Down

0 comments on commit b0437ad

Please sign in to comment.