예제 #1
0
def update_volume(volume_name_or_id, **fields):
    Volume.Update(volume_name_or_id, **fields)
    return True
예제 #2
0
    # a user can only update volumes she owns (admin can for anyone)
    if caller_user.owner_id != user.owner_id and not caller_user.is_admin:
        raise Exception("Caller cannot update volume for user %s" %
                        user.owner_id)

    # finally, verify that the name is *not* numeric
    tmp = None
    try:
        tmp = int(volume_cert.name)
    except:
        pass

    if tmp is not None:
        raise Exception("Invalid volume name '%s'" % volume_cert.name)

    volume_key = Volume.Update(volume_name_or_id, volume_cert)
    if volume_key is not None:

        # put the new cert bundle
        rc = VolumeCertBundle.Put(volume.volume_id, cert_bundle_bin)
        if not rc:
            raise Exception("Failed to put cert bundle for volume '%s'" %
                            volume.volume_id)

    return {"result": True}


# ----------------------------------
def delete_volume(volume_name_or_id, **attrs):
    """
   Delete a volume, given its name or ID