Exemplo n.º 1
0
def run(name, yes = False):
    device, name = create.get_device_and_vmname(name)
    create.make_sure_device_is_not_being_used(device)

    if not yes:
        if raw_input("Are you sure to remove VM %s on %s? ('yes' if you're sane): " % (name, device)) != "yes": return False

    subprocess.check_call(["lvremove", "-f", device],close_fds=True)
Exemplo n.º 2
0
def run(name, yes=False):
    device, name = create.get_device_and_vmname(name)
    create.make_sure_device_is_not_being_used(device)

    if not yes:
        if raw_input("Are you sure to remove VM %s on %s? ('yes' if you're sane): " % (name, device)) != "yes":
            return False

    subprocess.check_call(["lvremove", "-f", device], close_fds=True)
Exemplo n.º 3
0
def run(name):
    device, name = create.get_device_and_vmname(name)
    config = read_in_text(device)
    editor = os.environ.get("EDITOR") or "vi"
        
    with tempfile.NamedTemporaryFile(delete=True) as tmpfile:
        tmpfile.write(config)
        tmpfile.flush()
        subprocess.call([editor,tmpfile.name])
        tmpfile.seek(0)
        new_config = tmpfile.read()

    vals = {}
    exec new_config in None, vals

    if "memory" not in vals: raise Exception("memory= is mandatory")

    write(device, vals)
Exemplo n.º 4
0
def run(name, newname):
    device, name = create.get_device_and_vmname(name)
    make_sure_newname_is_usable(newname)
    create.make_sure_device_is_not_being_used(device)
    subprocess.check_call(["lvrename", device, newname], close_fds=True)
Exemplo n.º 5
0
def run(name, newname):
    device, name = create.get_device_and_vmname(name)
    make_sure_newname_is_usable(newname)
    create.make_sure_device_is_not_being_used(device)
    subprocess.check_call(["lvrename",device,newname],close_fds=True)