Ejemplo n.º 1
0
import sys
import wc_daemonize

def propagate(vm_name, common, async, images):
    if not images.lengthy_obtain():
        c.log.warn("Propagation asked for but it is not required.")
        return
        
    args = [vm_name, common, async, images]
    
    wc_daemonize.daemonize(common, propagate_under_daemonization, args)
    
# The following method is called in two (known) circumstances
# 1. Directly under the daemonization harness
# 2. As part of the create+propagate logic in the wc_core_creation module,
#    another function drives the process under the daemonization harness and
#    then calls this as needed.  That expects the local_file_set return value.

def propagate_under_daemonization(vm_name, common, async, images):
    local_file_set = None
    try:
        local_file_set = images.obtain()
    except Exception,e:
        common.log.error("Problem propagating.")
        common.log.exception(e)
        
        exception_type = sys.exc_type
        try:
            exceptname = exception_type.__name__ 
        except AttributeError:
            exceptname = exception_type
Ejemplo n.º 2
0
    """

    c.log.debug("_propagate_then_create()")

    if not images.lengthy_obtain():
        c.log.info("Propagation asked for but it is not required.")
        return

    func = _propagate_then_create_under_daemonization

    args = [
        vm_name, p, c, async, editing, images, kernels, localnet, netbootstrap,
        netlease, netsecurity, persistence, platform
    ]

    wc_daemonize.daemonize(c, func, args)


# the following function runs directly under the daemonization harness
def _propagate_then_create_under_daemonization(vm_name, p, c, async, editing,
                                               images, kernels, localnet,
                                               netbootstrap, netlease,
                                               netsecurity, persistence,
                                               platform):

    local_file_set = wc_core_propagation.propagate_under_daemonization(
        vm_name, c, async, images)

    if not local_file_set:
        c.log.error("propagation failed, cannot propagate+create, exiting")
        return
Ejemplo n.º 3
0
def _propagate_then_create(vm_name, p, c, async, editing, images, kernels, localnet, netbootstrap, netlease, netsecurity, persistence, platform):
    """This returns quickly, all work (for both create and propagate)
       happens under daemonization.
    """
    
    c.log.debug("_propagate_then_create()")
    
    if not images.lengthy_obtain():
        c.log.info("Propagation asked for but it is not required.")
        return
        
    func = _propagate_then_create_under_daemonization
    
    args = [vm_name, p, c, async, editing, images, kernels, localnet, netbootstrap, netlease, netsecurity, persistence, platform]
    
    wc_daemonize.daemonize(c, func, args)
    
# the following function runs directly under the daemonization harness
def _propagate_then_create_under_daemonization(vm_name, p, c, async, editing, images, kernels, localnet, netbootstrap, netlease, netsecurity, persistence, platform):
    
    local_file_set = wc_core_propagation.propagate_under_daemonization(vm_name, c, async, images)
    
    if not local_file_set:
        c.log.error("propagation failed, cannot propagate+create, exiting")
        return
    
    try:
        _common(local_file_set, vm_name, p, c, editing, kernels, localnet, netbootstrap, netlease, netsecurity, persistence, platform)
    except Exception,e:
        c.log.error("Problem with create during daemonized propagate+create")
        c.log.exception(e)