Revision 8d5795b4

b/snf-cyclades-app/synnefo/api/management/commands/network-create.py
165 165
        if (subnet is None) and (subnet6 is None):
166 166
            raise CommandError("subnet or subnet6 is required")
167 167
        if subnet is None and gateway is not None:
168
            raise CommandError("Can not use gateway without subnet")
168
            raise CommandError("Cannot use gateway without subnet")
169 169
        if subnet6 is None and gateway6 is not None:
170
            raise CommandError("Can not use gateway6 without subnet6")
170
            raise CommandError("Cannot use gateway6 without subnet6")
171 171
        if public and not (backend_ids or floating_ip_pool):
172 172
            raise CommandError("backend-ids is required")
173 173
        if not userid and not public:
b/snf-cyclades-app/synnefo/api/management/commands/network-modify.py
128 128
            floating_ip_pool = parse_bool(floating_ip_pool)
129 129
            if floating_ip_pool is False and network.floating_ip_pool is True:
130 130
                if network.ips.filter(deleted=False, floating_ip=True).exists():
131
                    msg = ("Can not make network a non floating IP pool."
131
                    msg = ("Cannot make network a non floating IP pool."
132 132
                           " There are still reserved floating IPs.")
133 133
                    raise CommandError(msg)
134 134
            network.floating_ip_pool = floating_ip_pool
......
173 173
            backend = get_backend(remove_from_backend)
174 174
            if network.nics.filter(machine__backend=backend,
175 175
                                   machine__deleted=False).exists():
176
                msg = "Can not remove. There are still connected VMs to this"\
176
                msg = "Cannot remove. There are still connected VMs to this"\
177 177
                      " network"
178 178
                raise CommandError(msg)
179 179
            backend_mod.delete_network(network, backend, disconnect=True)
b/snf-cyclades-app/synnefo/api/management/commands/server-import.py
215 215
    jobid = backend_client.ModifyInstance(instance_name, nics=op)
216 216
    (status, error) = wait_for_job(backend_client, jobid)
217 217
    if status != 'success':
218
        raise CommandError("Can not rename instance: %s" % error)
218
        raise CommandError("Cannot rename instance: %s" % error)
219 219

  
220 220

  
221 221
def add_public_nic(instance_name, nic, backend_client, stream=sys.stdout):
......
223 223
    jobid = backend_client.ModifyInstance(instance_name, nics=[('add', nic)])
224 224
    (status, error) = wait_for_job(backend_client, jobid)
225 225
    if status != 'success':
226
        raise CommandError("Can not rename instance: %s" % error)
226
        raise CommandError("Cannot rename instance: %s" % error)
227 227

  
228 228

  
229 229
def shutdown_instance(instance, backend_client, stream=sys.stdout):
......
234 234
        jobid = backend_client.ShutdownInstance(instance_name)
235 235
        (status, error) = wait_for_job(backend_client, jobid)
236 236
        if status != 'success':
237
            raise CommandError("Can not shutdown instance: %s" % error)
237
            raise CommandError("Cannot shutdown instance: %s" % error)
238 238

  
239 239

  
240 240
def rename_instance(old_name, new_name, backend_client, stream=sys.stdout):
......
244 244
                                          ip_check=False, name_check=False)
245 245
    (status, error) = wait_for_job(backend_client, jobid)
246 246
    if status != 'success':
247
        raise CommandError("Can not rename instance: %s" % error)
247
        raise CommandError("Cannot rename instance: %s" % error)
248 248

  
249 249

  
250 250
def startup_instance(name, backend_client, stream=sys.stdout):
......
252 252
    jobid = backend_client.StartupInstance(name)
253 253
    (status, error) = wait_for_job(backend_client, jobid)
254 254
    if status != 'success':
255
        raise CommandError("Can not rename instance: %s" % error)
255
        raise CommandError("Cannot rename instance: %s" % error)
b/snf-cyclades-app/synnefo/api/networks.py
112 112
    if flavor not in Network.FLAVORS.keys():
113 113
        raise api.faults.BadRequest("Invalid network type '%s'" % flavor)
114 114
    if flavor not in settings.API_ENABLED_NETWORK_FLAVORS:
115
        raise api.faults.Forbidden("Can not create network of type '%s'." %
115
        raise api.faults.Forbidden("Cannot create network of type '%s'." %
116 116
                                   flavor)
117 117

  
118 118
    name = api.utils.get_attribute(network_dict, "name", required=False)
......
143 143

  
144 144
    network = util.get_network(network_id, request.user_uniq, for_update=True)
145 145
    if network.public:
146
        raise api.faults.Forbidden("Can not rename the public network.")
146
        raise api.faults.Forbidden("Cannot rename the public network.")
147 147
    network = networks.rename(network, new_name)
148 148
    return render_network(request, network_to_dict(network), 200)
149 149

  
......
154 154
    log.info('delete_network %s', network_id)
155 155
    network = util.get_network(network_id, request.user_uniq, for_update=True)
156 156
    if network.public:
157
        raise api.faults.Forbidden("Can not delete the public network.")
157
        raise api.faults.Forbidden("Cannot delete the public network.")
158 158
    networks.delete(network)
159 159
    return HttpResponse(status=204)
160 160

  
b/snf-cyclades-app/synnefo/api/old_networks.py
166 166
    elif flavor not in Network.FLAVORS.keys():
167 167
        raise faults.BadRequest("Invalid network type '%s'" % flavor)
168 168
    elif flavor not in settings.API_ENABLED_NETWORK_FLAVORS:
169
        raise faults.Forbidden("Can not create network of type '%s'" %
169
        raise faults.Forbidden("Cannot create network of type '%s'" %
170 170
                               flavor)
171 171

  
172 172
    public = d.get("public", False)
173 173
    if public:
174
        raise faults.Forbidden("Can not create a public network.")
174
        raise faults.Forbidden("Cannot create a public network.")
175 175

  
176 176
    dhcp = d.get('dhcp', True)
177 177

  
......
229 229

  
230 230
    network = util.get_network(network_id, request.user_uniq)
231 231
    if network.public:
232
        raise faults.Forbidden('Can not rename the public network.')
232
        raise faults.Forbidden('Cannot rename the public network.')
233 233
    network = networks.rename(network, name)
234 234
    return HttpResponse(status=204)
235 235

  
......
247 247
    log.info('delete_network %s', network_id)
248 248
    network = util.get_network(network_id, request.user_uniq, for_update=True)
249 249
    if network.public:
250
        raise faults.Forbidden('Can not delete the public network.')
250
        raise faults.Forbidden('Cannot delete the public network.')
251 251
    networks.delete(network)
252 252
    return HttpResponse(status=204)
253 253

  
......
265 265

  
266 266
    net = util.get_network(network_id, request.user_uniq)
267 267
    if net.public:
268
        raise faults.Forbidden('Can not modify the public network.')
268
        raise faults.Forbidden('Cannot modify the public network.')
269 269
    if net.deleted:
270 270
        raise faults.BadRequest("Network has been deleted.")
271 271

  
b/snf-cyclades-app/synnefo/api/tests/floating_ips.py
342 342
        network = ip.network
343 343
        network.public = False
344 344
        network.save()
345
        # Can not remove network with floating IPs
345
        # Cannot remove network with floating IPs
346 346
        with mocked_quotaholder():
347 347
            response = self.delete(NETWORKS_URL + "/%s" % self.pool.id,
348 348
                                   self.pool.userid)
b/snf-cyclades-app/synnefo/api/util.py
233 233
        if for_update:
234 234
            objects = objects.select_for_update()
235 235
        # if (port.device_owner != "vm") and for_update:
236
        #     raise faults.BadRequest('Can not update non vm port')
236
        #     raise faults.BadRequest('Cannot update non vm port')
237 237
        return objects.get(id=port_id)
238 238
    except (ValueError, NetworkInterface.DoesNotExist):
239 239
        raise faults.ItemNotFound("Port '%s' not found." % port_id)
b/snf-cyclades-app/synnefo/db/aes_encrypt.py
62 62
    plaintext = plaintext[SALT_LEN:]
63 63

  
64 64
    if salt != pure_salt:
65
        # Can not decrtypt password
66
        raise CorruptedPassword("Can not decrypt password. Check the key")
65
        # Cannot decrtypt password
66
        raise CorruptedPassword("Cannot decrypt password. Check the key")
67 67
    else:
68 68
        return plaintext
69 69

  
b/snf-cyclades-app/synnefo/db/migrations/0052_migrate_pool_entries.py
102 102

  
103 103
    def backwards(self, orm):
104 104
        "Write your backwards methods here."
105
        raise RuntimeError("Can not reverse this migrations")
105
        raise RuntimeError("Cannot reverse this migrations")
106 106

  
107 107
    models = {
108 108
        'db.backend': {
b/snf-cyclades-app/synnefo/db/migrations/0066_add_iv.py
69 69
    plaintext = plaintext[SALT_LEN:]
70 70

  
71 71
    if salt != pure_salt:
72
        # Can not decrtypt password
73
        raise CorruptedPassword("Can not decrypt password. Check the key")
72
        # Cannot decrtypt password
73
        raise CorruptedPassword("Cannot decrypt password. Check the key")
74 74
    else:
75 75
        return plaintext
76 76

  
......
108 108
    plaintext = plaintext[SALT_LEN:]
109 109

  
110 110
    if salt != pure_salt:
111
        # Can not decrtypt password
112
        raise CorruptedPassword("Can not decrypt password. Check the key")
111
        # Cannot decrtypt password
112
        raise CorruptedPassword("Cannot decrypt password. Check the key")
113 113
    else:
114 114
        return plaintext
115 115

  
b/snf-cyclades-app/synnefo/db/models.py
166 166
                first_free = [x for x in xrange(0, 16) if x not in indexes][0]
167 167
                self.index = first_free
168 168
            except IndexError:
169
                raise Exception("Can not create more than 16 backends")
169
                raise Exception("Cannot create more than 16 backends")
170 170

  
171 171
    def use_hotplug(self):
172 172
        return self.hypervisor == "kvm" and snf_settings.GANETI_USE_HOTPLUG
......
755 755
                    ip_pool.put(self.address)
756 756
                    ip_pool.save()
757 757
                    return
758
            log.error("Can not release address %s of NIC %s. Address does not"
758
            log.error("Cannot release address %s of NIC %s. Address does not"
759 759
                      " belong to any of the IP pools of the subnet %s !",
760 760
                      self.address, self.nic, self.subnet_id)
761 761

  
......
904 904

  
905 905
        if backend.offline:
906 906
            log.warning("Trying to connect with offline backend: %s", backend)
907
            raise faults.ServiceUnavailable("Can not connect to offline"
907
            raise faults.ServiceUnavailable("Cannot connect to offline"
908 908
                                            " backend: %s" % backend)
909 909

  
910 910
        b = backend
b/snf-cyclades-app/synnefo/db/pools/__init__.py
168 168
        size = self.pool_size
169 169
        tmp = self.available[(size - bits_num): size]
170 170
        if tmp.count(UNAVAILABLE):
171
            raise Exception("Can not shrink. In use")
171
            raise Exception("Cannot shrink. In use")
172 172
        self.resize(-bits_num)
173 173

  
174 174
    def resize(self, bits_num):
b/snf-cyclades-app/synnefo/logic/allocators/default_allocator.py
42 42
    if len(backends) == 1:
43 43
        return backends[0]
44 44

  
45
    # Filter those that can not host the vm
45
    # Filter those that cannot host the vm
46 46
    capable_backends = [backend for backend in backends
47 47
                        if vm_fits_in_backend(backend, vm)]
48 48

  
b/snf-cyclades-app/synnefo/logic/backend.py
213 213
                                        disk=old_flavor.disk,
214 214
                                        disk_template=old_flavor.disk_template)
215 215
    except Flavor.DoesNotExist:
216
        raise Exception("Can not find flavor for VM")
216
        raise Exception("Cannot find flavor for VM")
217 217
    vm.flavor = new_flavor
218 218
    vm.save()
219 219

  
......
363 363
                                               active=True)
364 364
    except IPAddressLog.MultipleObjectsReturned:
365 365
        logmsg = ("Multiple active log entries for IP %s, Network %s,"
366
                  "Server %s. Can not proceed!"
366
                  "Server %s. Cannot proceed!"
367 367
                  % (ip.address, ip.network, nic.machine))
368 368
        log.error(logmsg)
369 369
        raise
......
451 451
    # Release the resources on the deletion of the Network
452 452
    if deleted:
453 453
        if network.ips.filter(deleted=False, floating_ip=True).exists():
454
            msg = "Can not delete network %s! Floating IPs still in use!"
454
            msg = "Cannot delete network %s! Floating IPs still in use!"
455 455
            log.error(msg % network)
456 456
            raise Exception(msg % network)
457 457
        log.info("Network %r deleted. Releasing link %r mac_prefix %r",
b/snf-cyclades-app/synnefo/logic/callbacks.py
91 91
            log.error("VM for instance %s with id %d not found in DB.",
92 92
                      msg['instance'], vm_id)
93 93
        except Network.InvalidBackendIdError, Network.DoesNotExist:
94
            log.error("Invalid message, can not find network. msg: %s", msg)
94
            log.error("Invalid message, cannot find network. msg: %s", msg)
95 95
    return wrapper
96 96

  
97 97

  
b/snf-cyclades-app/synnefo/logic/dispatcher.py
296 296
    (opts, args) = parse_arguments(sys.argv[1:])
297 297

  
298 298
    # Rename this process so 'ps' output looks like this is a native
299
    # executable.  Can not seperate command-line arguments from actual name of
299
    # executable.  Cannot seperate command-line arguments from actual name of
300 300
    # the executable by NUL bytes, so only show the name of the executable
301 301
    # instead.  setproctitle.setproctitle("\x00".join(sys.argv))
302 302
    setproctitle.setproctitle(sys.argv[0])
b/snf-cyclades-app/synnefo/logic/ips.py
44 44
def allocate_ip(network, userid, address=None, floating_ip=False):
45 45
    """Try to allocate an IP from networks IP pools."""
46 46
    if network.action == "DESTROY":
47
        raise faults.Conflict("Can not allocate IP. Network %s is being"
47
        raise faults.Conflict("Cannot allocate IP. Network %s is being"
48 48
                              " deleted" % network.id)
49 49
    ip_pools = IPPoolTable.objects.select_for_update()\
50 50
        .filter(subnet__network=network)
......
100 100
        if backend is not None:
101 101
            log_msg += " Backend: %s" % backend
102 102
        log.error(log_msg)
103
        exception_msg = "Can not allocate a %s IP address." % ip_type
103
        exception_msg = "Cannot allocate a %s IP address." % ip_type
104 104
        raise faults.Conflict(exception_msg)
105 105

  
106 106

  
......
110 110
        floating_ip = allocate_public_ip(userid, floating_ip=True)
111 111
    else:
112 112
        if not network.floating_ip_pool:
113
            msg = ("Can not allocate floating IP. Network %s is"
113
            msg = ("Cannot allocate floating IP. Network %s is"
114 114
                   " not a floating IP pool.")
115 115
            raise faults.Conflict(msg % network.id)
116 116
        if network.action == "DESTROY":
117
            msg = "Can not allocate floating IP. Network %s is being deleted."
117
            msg = "Cannot allocate floating IP. Network %s is being deleted."
118 118
            raise faults.Conflict(msg % network.id)
119 119

  
120 120
        # Allocate the floating IP
b/snf-cyclades-app/synnefo/logic/management/commands/backend-remove.py
55 55
        write("Trying to remove backend: %s\n" % backend.clustername)
56 56

  
57 57
        if backend.virtual_machines.filter(deleted=False).exists():
58
            raise CommandError('Backend hosts non-deleted vms. Can not delete')
58
            raise CommandError('Backend hosts non-deleted vms. Cannot delete')
59 59

  
60 60
        # Get networks before deleting backend, because after deleting the
61 61
        # backend, all BackendNetwork objects are deleted!
......
64 64
        try:
65 65
            delete_backend(backend)
66 66
        except models.ProtectedError as e:
67
            msg = ("Can not delete backend because it contains"
67
            msg = ("Cannot delete backend because it contains"
68 68
                   "non-deleted VMs:\n%s" % e)
69 69
            raise CommandError(msg)
70 70

  
b/snf-cyclades-app/synnefo/logic/networks.py
73 73
        raise faults.BadRequest("Invalid network type '%s'" % flavor)
74 74

  
75 75
    if mac_prefix is not None and flavor == "MAC_FILTERED":
76
        raise faults.BadRequest("Can not override MAC_FILTERED mac-prefix")
76
        raise faults.BadRequest("Cannot override MAC_FILTERED mac-prefix")
77 77
    if link is not None and flavor == "PHYSICAL_VLAN":
78
        raise faults.BadRequest("Can not override PHYSICAL_VLAN link")
78
        raise faults.BadRequest("Cannot override PHYSICAL_VLAN link")
79 79

  
80 80
    if subnet is None and floating_ip_pool:
81
        raise faults.BadRequest("IPv6 only networks can not be floating"
81
        raise faults.BadRequest("IPv6 only networks cannot be floating"
82 82
                                " pools.")
83 83
    # Check that network parameters are valid
84 84
    subnets.validate_subnet_params(subnet, gateway, subnet6, gateway6)
......
153 153
@network_command("DESTROY")
154 154
def delete(network):
155 155
    if network.nics.exists():
156
        raise faults.Conflict("Can not delete network. There are ports still"
156
        raise faults.Conflict("Cannot delete network. There are ports still"
157 157
                              " configured on network network %s" % network.id)
158 158
    if network.ips.filter(deleted=False, floating_ip=True).exists():
159
        msg = "Can not delete netowrk. Network has allocated floating IPs."
159
        msg = "Cannot delete netowrk. Network has allocated floating IPs."
160 160
        raise faults.Conflict(msg)
161 161

  
162 162
    network.action = "DESTROY"
b/snf-cyclades-app/synnefo/logic/rapi.py
460 460

  
461 461
      conflicts = set(kwargs.iterkeys()) & set(body.iterkeys())
462 462
      if conflicts:
463
        raise GanetiApiError("Required fields can not be specified as"
463
        raise GanetiApiError("Required fields cannot be specified as"
464 464
                             " keywords: %s" % ", ".join(conflicts))
465 465

  
466 466
      body.update((key, value) for key, value in kwargs.iteritems()
b/snf-cyclades-app/synnefo/logic/servers.py
35 35
    if pending_action:
36 36
        if pending_action == "BUILD":
37 37
            raise faults.BuildInProgress("Server '%s' is being build." % vm.id)
38
        raise faults.BadRequest("Can not perform '%s' action while there is a"
38
        raise faults.BadRequest("Cannot perform '%s' action while there is a"
39 39
                                " pending '%s'." % (action, pending_action))
40 40

  
41 41
    # Check if action can be performed to VM's operstate
42 42
    operstate = vm.operstate
43 43
    if operstate == "ERROR":
44
        raise faults.BadRequest("Can not perform '%s' action while server is"
44
        raise faults.BadRequest("Cannot perform '%s' action while server is"
45 45
                                " in 'ERROR' state." % action)
46 46
    elif operstate == "BUILD" and action != "BUILD":
47 47
        raise faults.BuildInProgress("Server '%s' is being build." % vm.id)
......
50 50
         (action == "RESIZE" and operstate != "STOPPED") or\
51 51
         (action in ["CONNECT", "DISCONNECT"] and operstate != "STOPPED"
52 52
          and not settings.GANETI_USE_HOTPLUG):
53
        raise faults.BadRequest("Can not perform '%s' action while server is"
53
        raise faults.BadRequest("Cannot perform '%s' action while server is"
54 54
                                " in '%s' state." % (action, operstate))
55 55
    return
56 56

  
......
275 275
        return None
276 276
    # Check that resize can be performed
277 277
    if old_flavor.disk != flavor.disk:
278
        raise faults.BadRequest("Can not resize instance disk.")
278
        raise faults.BadRequest("Cannot resize instance disk.")
279 279
    if old_flavor.disk_template != flavor.disk_template:
280
        raise faults.BadRequest("Can not change instance disk template.")
280
        raise faults.BadRequest("Cannot change instance disk template.")
281 281

  
282 282
    log.info("Resizing VM from flavor '%s' to '%s", old_flavor, flavor)
283 283
    commission_info = {"cyclades.cpu": flavor.cpu - old_flavor.cpu,
......
401 401

  
402 402
    """
403 403
    if network.state != "ACTIVE":
404
        raise faults.BuildInProgress("Can not create port while network is in"
404
        raise faults.BuildInProgress("Cannot create port while network is in"
405 405
                                     " state %s" % network.state)
406 406
    if network.action == "DESTROY":
407
        msg = "Can not create port. Network %s is being deleted."
407
        msg = "Cannot create port. Network %s is being deleted."
408 408
        raise faults.Conflict(msg % network.id)
409 409
    ipaddress = None
410 410
    if use_ipaddress is not None:
......
493 493

  
494 494
    if port.network.public and not port.ips.filter(floating_ip=True,
495 495
                                                   deleted=False).exists():
496
        raise faults.Forbidden("Can not disconnect from public network.")
496
        raise faults.Forbidden("Cannot disconnect from public network.")
497 497

  
498 498
    if port.machine is not None:
499 499
        vm = disconnect(port.machine, port)
b/snf-cyclades-app/synnefo/logic/tests/networks.py
142 142
        kw = copy(kwargs)
143 143
        kw["gateway6"] = "2001:64q:2ffc:1119::1"
144 144
        self.assertRaises(faults.BadRequest, networks.create, **kw)
145
        # floating_ip_pools can not be ipv6 only
145
        # floating_ip_pools cannot be ipv6 only
146 146
        kw = copy(kwargs)
147 147
        kw["floating_ip_pool"] = True
148 148
        self.assertRaises(faults.BadRequest, networks.create, **kw)
b/snf-cyclades-app/synnefo/quotas/__init__.py
166 166
    to accepted and rejected, according to the state of the
167 167
    QuotaHolderSerial DB table. A pending commission in the quotaholder
168 168
    can exist in the QuotaHolderSerial table and be either accepted or
169
    rejected, or can not exist in this table, so it is rejected.
169
    rejected, or cannot exist in this table, so it is rejected.
170 170

  
171 171
    """
172 172

  

Also available in: Unified diff