'Calculate total amount of data to be transferred
:param instance: the nova.objects.Instance being migrated
:param disk_paths: list of disk paths that are being migrated
with instance
Calculates the total amount of data that needs to be
transferred during the live migration. The actual
amount copied will be larger than this, due to the
guest OS continuing to dirty RAM while the migration
is taking place. So this value represents the minimal
data size possible.
:returns: data size to be copied in GB'

def _live_migration_data_gb(self, instance, disk_paths):

    ram_gb = ((instance.flavor.memory_mb * units.Mi) / units.Gi)
    if (ram_gb < 2):
        ram_gb = 2
    disk_gb = 0
    for path in disk_paths:
        try:
            size = os.stat(path).st_size
            size_gb = (size / units.Gi)
            if (size_gb < 2):
                size_gb = 2
            disk_gb += size_gb
        except OSError as e:
            LOG.warning('Unable    to    stat    %(disk)s:    %(ex)s', {'disk': path, 'ex': e})
    return (ram_gb + disk_gb)
