Skip to content

Commit 726770b

Browse files
author
Ignasi Barrera
committed
Upgraded environment and machine plugins to Abiquo 2.4
1 parent c600aed commit 726770b

File tree

9 files changed

+27
-14
lines changed

9 files changed

+27
-14
lines changed

kahuna/plugins/environment/cloud/compute.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
from org.jclouds.abiquo.domain.cloud import VirtualMachine
99
from org.jclouds.abiquo.domain.network import PrivateNetwork
1010
from org.jclouds.abiquo.predicates.enterprise import EnterprisePredicates
11-
from org.jclouds.abiquo.predicates.cloud import VirtualMachineTemplatePredicates
11+
from org.jclouds.abiquo.predicates.cloud \
12+
import VirtualMachineTemplatePredicates
1213

1314
log = logging.getLogger('kahuna')
1415

kahuna/plugins/environment/infrastructure/compute.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/usr/bin/env jython
22

33
import logging
4-
from kahuna.plugins.environment.infrastructure.network import cleanup_infrastructure_network
5-
from kahuna.plugins.environment.infrastructure.storage import cleanup_infrastructure_storage
4+
from kahuna.plugins.environment.infrastructure.network \
5+
import cleanup_infrastructure_network
6+
from kahuna.plugins.environment.infrastructure.storage \
7+
import cleanup_infrastructure_storage
68
from com.abiquo.model.enumerator import HypervisorType
79
from org.jclouds.abiquo.config import AbiquoEdition
810
from org.jclouds.abiquo.domain.infrastructure import Datacenter
@@ -56,10 +58,11 @@ def create_machine(self, rack, hyp, address, user, password,
5658

5759
# Verify that the desired datastore and virtual switch exist
5860
datastore = machine.findDatastore(datastore)
61+
nst = datacenter.defaultNetworkServiceType()
5962
vswitch = machine.findAvailableVirtualSwitch(vswitch)
6063

6164
datastore.setEnabled(True)
62-
machine.setVirtualSwitch(vswitch)
65+
vswitch.setNetworkServiceType(nst)
6366
machine.setRack(rack)
6467

6568
machine.save()

kahuna/plugins/environment/infrastructure/storage.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import logging
44
from ConfigParser import NoOptionError
55
from org.jclouds.abiquo.domain.infrastructure import StorageDevice
6-
from org.jclouds.abiquo.predicates.infrastructure import StorageDeviceMetadataPredicates
6+
from org.jclouds.abiquo.predicates.infrastructure \
7+
import StorageDeviceMetadataPredicates
78
from org.jclouds.abiquo.predicates.infrastructure import StoragePoolPredicates
89

910
log = logging.getLogger('kahuna')

kahuna/plugins/machine.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,11 @@ def create(self, args):
186186
if not vs:
187187
print "Missing virtual switch %s in machine" % vswitch
188188
return
189+
nst = dc.defaultNetworkServiceType()
190+
vs.setNetworkServiceType(nst)
189191

190192
# saving machine
191193
machine.setRack(rack)
192-
machine.setVirtualSwitch(vs)
193194
machine.save()
194195
log.debug("Machine saved")
195196
pprint_machines([machine])

kahuna/plugins/storage/helper.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ def get_attached_vm(context, volume):
3232
if link:
3333
name = link.getTitle()
3434
cloud = context.getCloudService()
35-
return cloud.findVirtualMachine(VirtualMachinePredicates.internalName(name))
35+
return cloud.findVirtualMachine(
36+
VirtualMachinePredicates.internalName(name))

kahuna/plugins/template.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from optparse import OptionParser
44
from kahuna.abstract import AbsPlugin
55
from kahuna.utils.prettyprint import pprint_templates
6-
from org.jclouds.abiquo.predicates.cloud import VirtualMachineTemplatePredicates
6+
from org.jclouds.abiquo.predicates.cloud \
7+
import VirtualMachineTemplatePredicates
78
from org.jclouds.abiquo.domain.exception import AbiquoException
89
from org.jclouds.rest import AuthorizationException
910

kahuna/plugins/virtualmachine/helper.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
from org.jclouds.abiquo.domain.cloud import VirtualDatacenter
66
from org.jclouds.abiquo.domain.network import PrivateNetwork
77
from org.jclouds.abiquo.predicates.cloud import VirtualDatacenterPredicates
8-
from org.jclouds.abiquo.predicates.cloud import VirtualMachineTemplatePredicates
8+
from org.jclouds.abiquo.predicates.cloud \
9+
import VirtualMachineTemplatePredicates
910
from org.jclouds.abiquo.domain.exception import AbiquoException
1011

1112
log = logging.getLogger('kahuna')

kahuna/plugins/vm.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ def deploy(self, args):
8484
# Once user input has been read, find the VM
8585
try:
8686
cloud = self._context.getCloudService()
87-
vm = cloud.findVirtualMachine(VirtualMachinePredicates.internalName(name))
87+
vm = cloud.findVirtualMachine(
88+
VirtualMachinePredicates.internalName(name))
8889
if vm:
8990
vm = helper.deploy_vm(self._context, vm)
9091
pprint_vms([vm])
@@ -108,7 +109,8 @@ def undeploy(self, args):
108109
# Once user input has been read, find the virtual machine
109110
try:
110111
cloud = self._context.getCloudService()
111-
vm = cloud.findVirtualMachine(VirtualMachinePredicates.internalName(name))
112+
vm = cloud.findVirtualMachine(
113+
VirtualMachinePredicates.internalName(name))
112114
if vm:
113115
vm = helper.undeploy_vm(self._context, vm)
114116
pprint_vms([vm])
@@ -195,7 +197,8 @@ def delete(self, args):
195197

196198
try:
197199
cloud = self._context.getCloudService()
198-
vm = cloud.findVirtualMachine(VirtualMachinePredicates.internalName(name))
200+
vm = cloud.findVirtualMachine(
201+
VirtualMachinePredicates.internalName(name))
199202
if vm:
200203
state = vm.getState()
201204
if not options.undeploy and state.existsInHypervisor():
@@ -236,7 +239,8 @@ def __change_state(self, state_name, new_state, args):
236239

237240
try:
238241
cloud = self._context.getCloudService()
239-
vm = cloud.findVirtualMachine(VirtualMachinePredicates.internalName(name))
242+
vm = cloud.findVirtualMachine(
243+
VirtualMachinePredicates.internalName(name))
240244
if vm:
241245
helper.change_state_vm(self._context, vm, new_state)
242246
pprint_vms([vm])

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<properties>
99
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
10-
<jclouds.version>1.5.2</jclouds.version>
10+
<jclouds.version>1.6.0-SNAPSHOT</jclouds.version>
1111
</properties>
1212

1313
<repositories>

0 commit comments

Comments
 (0)