14
14
15
15
16
16
class CloudCompute :
17
- """ Provides access to cloud compute features. """
17
+ """ Provides access to cloud compute features """
18
18
19
19
def __init__ (self , context ):
20
- """ Initialize the cloud creator with an existent context. """
20
+ """ Initialize the cloud creator with an existent context """
21
21
self .__context = context .getApiContext ()
22
22
23
23
def create_virtual_datacenter (self , datacenter , enterprise , type ,
24
24
name , netname , netaddress , netmask , netgateway ):
25
- """ Creates a new virtual datacenter. """
25
+ """ Creates a new virtual datacenter """
26
26
log .info ("Creating virtual datacenter %s of type %s..." % (name , type ))
27
27
network = PrivateNetwork .builder (self .__context ) \
28
28
.name (netname ) \
@@ -40,7 +40,7 @@ def create_virtual_datacenter(self, datacenter, enterprise, type,
40
40
return vdc
41
41
42
42
def create_virtual_appliance (self , vdc , name ):
43
- """ Creates a new virtual appliance inside a virtual datacenter. """
43
+ """ Creates a new virtual appliance inside a virtual datacenter """
44
44
log .info ("Creating virtual appliance %s..." % name )
45
45
vapp = VirtualAppliance .builder (self .__context , vdc ) \
46
46
.name (name ) \
@@ -49,21 +49,21 @@ def create_virtual_appliance(self, vdc, name):
49
49
return vapp
50
50
51
51
def create_virtual_machine (self , vapp , template ):
52
- """ Create a virtual machine based on the given template. """
52
+ """ Create a virtual machine based on the given template """
53
53
log .info (("Creating virtual machine from "
54
54
"template: %s..." ) % template .getName ())
55
55
vm = VirtualMachine .builder (self .__context , vapp , template ).build ()
56
56
vm .save ()
57
57
return vm
58
58
59
59
def refresh_template_repository (self , enterprise , datacenter ):
60
- """ Refresh the virtual machines templates in the given repository. """
60
+ """ Refresh the virtual machines templates in the given repository """
61
61
log .info ("Refreshing template repository..." )
62
62
enterprise .refreshTemplateRepository (datacenter )
63
63
64
64
65
65
def find_smallest_template (context , vdc ):
66
- """ Finds the smallest template available to the virtual datacenter. """
66
+ """ Finds the smallest template available to the virtual datacenter """
67
67
log .info ("Looking for the smallest available template..." )
68
68
templates = sorted (vdc .listAvailableTemplates (),
69
69
key = lambda t : t .getDiskFileSize ())
@@ -76,7 +76,7 @@ def find_smallest_template(context, vdc):
76
76
77
77
78
78
def find_template_by_name (context , vdc , name ):
79
- """ Finds the template with the given name. """
79
+ """ Finds the template with the given name """
80
80
template = vdc .findAvailableTemplate (
81
81
VirtualMachineTemplatePredicates .name (name ))
82
82
if template :
@@ -88,7 +88,7 @@ def find_template_by_name(context, vdc, name):
88
88
89
89
90
90
def create_cloud_compute (config , context , dc ):
91
- """ Creates the default cloud compute entities. """
91
+ """ Creates the default cloud compute entities """
92
92
log .info ("### Configuring the cloud ###" )
93
93
cloud = CloudCompute (context )
94
94
# Create it into the 'abiquo' enterprise, to make it easier to use
@@ -111,7 +111,7 @@ def create_cloud_compute(config, context, dc):
111
111
112
112
113
113
def cleanup_cloud_compute (config , context ):
114
- """ Cleans up a previously created cloud compute resources. """
114
+ """ Cleans up a previously created cloud compute resources """
115
115
log .info ("### Cleaning up the cloud ###" )
116
116
cloud = context .getCloudService ()
117
117
for vdc in cloud .listVirtualDatacenters ():
0 commit comments