'Generate a config drive.
:param instance: The instance object.
:param node: The node object.
:param network_info: Instance network information.
:param extra_md: Optional, extra metadata to be added to the
configdrive.
:param files: Optional, a list of paths to files to be added to
the configdrive.'

def _generate_configdrive(self, context, instance, node, network_info, extra_md=None, files=None):

    if (not extra_md):
        extra_md = {}
    i_meta = instance_metadata.InstanceMetadata(instance, content=files, extra_md=extra_md, network_info=network_info, network_metadata=self._get_network_metadata(node, network_info), request_context=context)
    with tempfile.NamedTemporaryFile() as uncompressed:
        with configdrive.ConfigDriveBuilder(instance_md=i_meta) as cdb:
            cdb.make_drive(uncompressed.name)
        with tempfile.NamedTemporaryFile() as compressed:
            with gzip.GzipFile(fileobj=compressed, mode='wb') as gzipped:
                uncompressed.seek(0)
                shutil.copyfileobj(uncompressed, gzipped)
            compressed.seek(0)
            return base64.b64encode(compressed.read())
