def _handoff_launch_vm(self, libvirt_xml, base_diskpath, base_mempath, launch_disk, launch_memory, launch_disk_size, launch_memory_size, disk_overlay_map, memory_overlay_map): # We told to FUSE that we have everything ready, so we need to wait # until delta_proc fininshes. we cannot start VM before delta_proc # finishes, because we don't know what will be modified in the future fuse = synthesis.run_fuse(Cloudlet_Const.CLOUDLETFS_PATH, Cloudlet_Const.CHUNK_SIZE, base_diskpath, launch_disk_size, base_mempath, launch_memory_size, resumed_disk=launch_disk, disk_overlay_map=disk_overlay_map, resumed_memory=launch_memory, memory_overlay_map=memory_overlay_map) synthesized_vm = synthesis.SynthesizedVM(launch_disk, launch_memory, fuse, disk_only=False, qemu_args=None, nova_xml=libvirt_xml, nova_conn=self._conn, nova_util=libvirt_utils) synthesized_vm.resume() return synthesized_vm
def handoff_launch_vm(base_diskpath, base_mempath, launch_disk, launch_memory, launch_disk_size, launch_memory_size, disk_overlay_map, memory_overlay_map): fuse = synthesis.run_fuse(Cloudlet_Const.CLOUDLETFS_PATH, Cloudlet_Const.CHUNK_SIZE, base_diskpath, launch_disk_size, base_mempath, launch_memory_size, resumed_disk=launch_disk, disk_overlay_map=disk_overlay_map, resumed_memory=launch_memory, memory_overlay_map=memory_overlay_map) synthesized_vm = synthesis.SynthesizedVM( launch_disk, launch_memory, fuse, disk_only=False, qemu_args=None, ) synthesized_vm.resume() synthesis.connect_vnc(synthesized_vm.machine) # terminate synthesized_vm.monitor.terminate() synthesized_vm.monitor.join() synthesized_vm.terminate() #import pdb;pdb.set_trace() #synthesized_vm.start() #synthesized_vm.join() return synthesized_vm
def handoff_launch_vm(base_diskpath, base_mempath, launch_disk, launch_memory, launch_disk_size, launch_memory_size, disk_overlay_map, memory_overlay_map): # pull chunks out of the map disk_chunks = [ int(chunk.split(':')[0]) for chunk in disk_overlay_map.split(',') ] mem_chunks = [ int(chunk.split(':')[0]) for chunk in memory_overlay_map.split(',') ] valid_bit = int(disk_overlay_map.split(',', 1)[0].split(':')[1]) fuse = synthesis.run_fuse(Cloudlet_Const.CLOUDLETFS_PATH, Cloudlet_Const.CHUNK_SIZE, base_diskpath, launch_disk_size, base_mempath, launch_memory_size, resumed_disk=launch_disk, disk_chunks=disk_chunks, resumed_memory=launch_memory, memory_chunks=mem_chunks, valid_bit=valid_bit) synthesized_vm = synthesis.SynthesizedVM( launch_disk, launch_memory, fuse, disk_only=False, qemu_args=None, ) synthesized_vm.resume() synthesis.connect_vnc(synthesized_vm.machine) # terminate synthesized_vm.monitor.terminate() synthesized_vm.monitor.join() synthesized_vm.terminate() #import pdb;pdb.set_trace() #synthesized_vm.start() #synthesized_vm.join() return synthesized_vm
def _spawn_using_synthesis(self, context, instance, xml, image_meta, overlay_url): # download vm overlay overlay_package = VMOverlayPackage(overlay_url) meta_raw = overlay_package.read_meta() meta_info = msgpack.unpackb(meta_raw) basevm_sha256 = meta_info.get(Cloudlet_Const.META_BASE_VM_SHA256, None) image_properties = image_meta.get("properties", None) if image_properties is None: msg = "image does not have properties for cloudlet metadata" raise exception.ImageNotFound(msg) image_sha256 = image_properties.get(CloudletAPI.PROPERTY_KEY_BASE_UUID) # check basevm if basevm_sha256 != image_sha256: msg = "requested base vm is not compatible with openstack base disk %s != %s" \ % (basevm_sha256, image_sha256) raise exception.ImageNotFound(msg) memory_snap_id = str( image_properties.get(CloudletAPI.IMAGE_TYPE_BASE_MEM)) diskhash_snap_id = str( image_properties.get(CloudletAPI.IMAGE_TYPE_BASE_DISK_HASH)) memhash_snap_id = str( image_properties.get(CloudletAPI.IMAGE_TYPE_BASE_MEM_HASH)) basedisk_path = self._get_cache_image(context, instance, image_meta['id']) basemem_path = self._get_cache_image(context, instance, memory_snap_id) diskhash_path = self._get_cache_image(context, instance, diskhash_snap_id) memhash_path = self._get_cache_image(context, instance, memhash_snap_id) # download blob fileutils.ensure_tree(libvirt_utils.get_instance_path(instance)) decomp_overlay = os.path.join( libvirt_utils.get_instance_path(instance), 'decomp_overlay') meta_info = compression.decomp_overlayzip(overlay_url, decomp_overlay) # recover VM launch_disk, launch_mem, fuse, delta_proc, fuse_proc = \ synthesis.recover_launchVM(basedisk_path, meta_info, decomp_overlay, base_mem=basemem_path, base_diskmeta=diskhash_path, base_memmeta=memhash_path) # resume VM LOG.info(_("Starting VM synthesis"), instance=instance) synthesized_vm = synthesis.SynthesizedVM(launch_disk, launch_mem, fuse, disk_only=False, qemu_args=False, nova_xml=xml, nova_conn=self._conn, nova_util=libvirt_utils) # testing non-thread resume delta_proc.start() fuse_proc.start() delta_proc.join() fuse_proc.join() LOG.info(_("Finish VM synthesis"), instance=instance) synthesized_vm.resume() # rettach NIC synthesis.rettach_nic(synthesized_vm.machine, synthesized_vm.old_xml_str, xml) return synthesized_vm