26 from cm.utils.decorators
import ci_log
27 from cm.models.node
import Node
28 from cm.utils
import log
29 from cm.utils.exception
import CMException
30 from common.states
import vm_states
41 node = Node.objects.get(address=remote_ip)
43 log.error(0,
'Cannot find node: %s' % remote_ip)
44 raise CMException(
'node_not_found')
46 vms = node.vm_set.filter(state__in=[vm_states[
'running'], vm_states[
'running ctx'], vm_states[
'init']]).all()
49 for lease
in vm.lease_set.all():
50 if lease.publicip_set.count() != 0:
53 d[
'private_lease'] = lease.vm_address
54 d[
'public_lease'] = lease.publicip_set.all()[0].address
55 public_leases.append(d)