def destroy(self): LOG.debug("Virtman: destroy VM instance %s according snapshot_name %s" %(self.instance_name, self.snapshot_name)) #unlink snapshot if os.path.exists(self.snapshot_link): commands.unlink(self.snapshot_link) dmsetup.remove_table(self.snapshot_name) self.snapshot.destroy_snapshot() LOG.debug("Virtman: success!") return True
def create(self): LOG.debug("Virtman: start VM instance %s according origin_path %s" %(self.instance_name, self.origin_path)) snapshot_path, self.snapshot_link = self.snapshot.create_snapshot() self.instance_path = dmsetup.snapshot(self.origin_path, self.snapshot_name, snapshot_path) #change link for OpenStack commands.unlink(self.snapshot_link) if not os.path.exists(self.snapshot_link): commands.link(self.instance_path, self.snapshot_link) LOG.debug("Virtman: success! snapshot_link = %s" % self.snapshot_link) return self.snapshot_link