Nir Soffer has posted comments on this change.

Change subject: iscsi: checking image size against VG free space
......................................................................


Patch Set 9:

(5 comments)

Can be refined a little bit.

http://gerrit.ovirt.org/#/c/34940/9/src/plugins/ovirt-hosted-engine-setup/vm/image.py
File src/plugins/ovirt-hosted-engine-setup/vm/image.py:

Line 85:         interactive = self.environment[
Line 86:             ohostedcons.StorageEnv.IMAGE_SIZE_GB
Line 87:         ] is None
Line 88: 
Line 89:         available_gb = None
To avoid confusion between estimate and exact values, lets call this here 
"estimate_gb", and later when you created the vg, "available_gb".
Line 90:         if self.environment[
Line 91:             ohostedcons.StorageEnv.BDEVICE_SIZE_GB
Line 92:         ] is not None:
Line 93:             # conservative estimate, the exact value


Line 91:             ohostedcons.StorageEnv.BDEVICE_SIZE_GB
Line 92:         ] is not None:
Line 93:             # conservative estimate, the exact value
Line 94:             # could be gathered from vginfo but at this point
Line 95:             # it still has to be created
If we name this estimated_gb, we can shorten the comment.
Line 96:             available_gb = int(self.environment[
Line 97:                 ohostedcons.StorageEnv.BDEVICE_SIZE_GB
Line 98:             ]) - int(ohostedcons.Const.STORAGE_DOMAIN_OVERHEAD_GIB)
Line 99: 


Line 94:             # could be gathered from vginfo but at this point
Line 95:             # it still has to be created
Line 96:             available_gb = int(self.environment[
Line 97:                 ohostedcons.StorageEnv.BDEVICE_SIZE_GB
Line 98:             ]) - int(ohostedcons.Const.STORAGE_DOMAIN_OVERHEAD_GIB)
int is not needed here, this is a constant. If the type is incorrect you will 
get a TypeError anyway:

    >>> 10 - "2"
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: unsupported operand type(s) for -: 'int' and 'str'
Line 99: 
Line 100:         valid = False
Line 101:         while not valid:
Line 102:             if interactive:


Line 118:                 ) > available_gb:
Line 119:                     self.logger.warning(
Line 120:                         _(
Line 121:                             'Not enough free space, '
Line 122:                             'only {available} GiB are available'
We don't know how much is available, so better reflect this in the message e.g:

    "about {estimated} GiB are available".
Line 123:                         ).format(
Line 124:                             available=available_gb
Line 125:                         )
Line 126:                     )


Line 187: 
Line 188:         if self.environment[ohostedcons.StorageEnv.DOMAIN_TYPE] in (
Line 189:             ohostedcons.DomainTypes.ISCSI,
Line 190:         ):
Line 191:             # Fine estimate for available VG space on block device 
where
This is not an estimate, this is the *exact* value.
Line 192:             # we have to preallocate the image
Line 193:             vginfo = serv.s.getVGInfo(
Line 194:                 self.environment[ohostedcons.StorageEnv.VG_UUID]
Line 195:             )


-- 
To view, visit http://gerrit.ovirt.org/34940
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I17f861a053f6ac38983967ffb07ecca9ff9b8de1
Gerrit-PatchSet: 9
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Simone Tiraboschi <stira...@redhat.com>
Gerrit-Reviewer: Lev Veyde <lve...@redhat.com>
Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com>
Gerrit-Reviewer: Sandro Bonazzola <sbona...@redhat.com>
Gerrit-Reviewer: Simone Tiraboschi <stira...@redhat.com>
Gerrit-Reviewer: Yedidyah Bar David <d...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to