def main(): """By default, this script will only cleanup unused cached images. Options: --all_cached - Destroy all cached images instead of just unused cached images. --dry_run - Don't actually destroy the VDIs. """ config.parse_args(sys.argv) utils.monkey_patch() _session = session.XenAPISession(CONF.xenserver.connection_url, CONF.xenserver.connection_username, CONF.xenserver.connection_password) sr_ref = vm_utils.safe_find_sr(_session) destroyed = vm_utils.destroy_cached_images(_session, sr_ref, all_cached=CONF.all_cached, dry_run=CONF.dry_run) if '--verbose' in sys.argv: print('\n'.join(destroyed)) print("Destroyed %d cached VDIs" % len(destroyed))
def main(): config.parse_args(sys.argv) utils.monkey_patch() xenapi = xenapi_driver.XenAPIDriver() session = xenapi._session sr_ref = vm_utils.safe_find_sr(session) destroyed = vm_utils.destroy_cached_images(session, sr_ref, all_cached=CONF.all_cached, dry_run=CONF.dry_run) if "--verbose" in sys.argv: print "\n".join(destroyed) print "Destroyed %d cached VDIs" % len(destroyed)
def main(): config.parse_args(sys.argv) utils.monkey_patch() _session = session.XenAPISession( CONF.xenserver.connection_url, CONF.xenserver.connection_username, CONF.xenserver.connection_password ) sr_ref = vm_utils.safe_find_sr(_session) destroyed = vm_utils.destroy_cached_images(_session, sr_ref, all_cached=CONF.all_cached, dry_run=CONF.dry_run) if "--verbose" in sys.argv: print("\n".join(destroyed)) print("Destroyed %d cached VDIs" % len(destroyed))
def main(): config.parse_args(sys.argv) utils.monkey_patch() xenapi = xenapi_driver.XenAPIDriver() session = xenapi._session sr_ref = vm_utils.safe_find_sr(session) destroyed = vm_utils.destroy_cached_images( session, sr_ref, all_cached=CONF.all_cached, dry_run=CONF.dry_run) if '--verbose' in sys.argv: print '\n'.join(destroyed) print "Destroyed %d cached VDIs" % len(destroyed)
def main(): config.parse_args(sys.argv) _session = session.XenAPISession(CONF.xenserver.connection_url, CONF.xenserver.connection_username, CONF.xenserver.connection_password) sr_ref = vm_utils.safe_find_sr(_session) destroyed = vm_utils.destroy_cached_images( _session, sr_ref, all_cached=CONF.all_cached, dry_run=CONF.dry_run, keep_days=CONF.keep_days) if '--verbose' in sys.argv: print('\n'.join(destroyed)) print("Destroyed %d cached VDIs" % len(destroyed))
def main(): flags.parse_args(sys.argv) utils.monkey_patch() xenapi = xenapi_driver.XenAPIDriver() session = xenapi._session sr_ref = vm_utils.safe_find_sr(session) destroyed = vm_utils.destroy_cached_images( session, sr_ref, all_cached=FLAGS.all_cached, dry_run=FLAGS.dry_run) if '--verbose' in sys.argv: print '\n'.join(destroyed) print "Destroyed %d cached VDIs" % len(destroyed)