コード例 #1
0
def delete_vm_info(vm_identity):

    vm_details = db(db.vm_data.vm_identity == vm_identity).select().first()

    # updating the used entry of database
    if vm_details.HDD != None:
        db(db.datastore.id == vm_details.datastore_id).update(used = int(vm_details.datastore_id.used) -  \
                                                                         (int(vm_details.HDD) + int(vm_details.template_id.hdd)))

    if vm_details.public_ip != None:
        remove_mapping(vm_details.public_ip, vm_details.private_ip)
    #this will delete vm_data entry and also its references
    db(db.vm_data.id == vm_details.id).delete()

    return
コード例 #2
0
ファイル: sanity_model.py プロジェクト: azhariitd/baadal2.0
def delete_vm_info(vm_identity):

    vm_details = db(db.vm_data.vm_identity == vm_identity).select().first()

    # updating the used entry of database
    if vm_details.HDD != None:
        db(db.datastore.id == vm_details.datastore_id).update(used = int(vm_details.datastore_id.used) -  \
                                                                         (int(vm_details.HDD) + int(vm_details.template_id.hdd)))

    if vm_details.public_ip != None:
        remove_mapping(vm_details.public_ip.public_ip, vm_details.private_ip.private_ip)
    #this will delete vm_data entry and also its references
    db(db.vm_data.id == vm_details.id).delete()
    
    return
コード例 #3
0
ファイル: sanity_model.py プロジェクト: code-hippo/baadal2.0
def delete_vm_info(vm_identity):
    """
    For undefined VMs, VM info and references are deleted from the database.
    Public IP mapping is removed, if present
    """
    vm_details = db(db.vm_data.vm_identity == vm_identity).select().first()

    # updating the used entry of database
    if vm_details.HDD != None:
        db(db.datastore.id == vm_details.datastore_id).update(used = int(vm_details.datastore_id.used) -  \
                                                                         (int(vm_details.HDD) + int(vm_details.template_id.hdd)))

    if vm_details.public_ip != None:
        remove_mapping(vm_details.public_ip.public_ip, vm_details.private_ip.private_ip)
    #this will delete vm_data entry and also its references
    db(db.vm_data.id == vm_details.id).delete()
    
    return
コード例 #4
0
def delete_vm_info(vm_identity):
    """
    For undefined VMs, VM info and references are deleted from the database.
    Public IP mapping is removed, if present
    """
    vm_details = db(db.vm_data.vm_identity == vm_identity).select().first()

    # updating the used entry of database
    if vm_details.HDD != None:
        db(db.datastore.id == vm_details.datastore_id).update(used = int(vm_details.datastore_id.used) -  \
                                                                         (int(vm_details.HDD) + int(vm_details.template_id.hdd)))

    if vm_details.public_ip != None:
        remove_mapping(vm_details.public_ip.public_ip,
                       vm_details.private_ip.private_ip)
    #this will delete vm_data entry and also its references
    db(db.vm_data.id == vm_details.id).delete()

    return