objects: adding an update method to virtual_interface
Adding a save method to the virtual_interface object and an update method to its database model. Partially implements blueprint virt-device-role-tagging Co-authored-by: Artom Lifshitz <alifshit@redhat.com> Change-Id: I52673fc297cb578995be5c7a075c5693b0793bf5
This commit is contained in:
parent
dcddb9e208
commit
e38be71ca4
@ -636,6 +636,11 @@ def virtual_interface_create(context, values):
|
|||||||
return IMPL.virtual_interface_create(context, values)
|
return IMPL.virtual_interface_create(context, values)
|
||||||
|
|
||||||
|
|
||||||
|
def virtual_interface_update(context, address, values):
|
||||||
|
"""Create a virtual interface record in the database."""
|
||||||
|
return IMPL.virtual_interface_update(context, address, values)
|
||||||
|
|
||||||
|
|
||||||
def virtual_interface_get(context, vif_id):
|
def virtual_interface_get(context, vif_id):
|
||||||
"""Gets a virtual interface from the table."""
|
"""Gets a virtual interface from the table."""
|
||||||
return IMPL.virtual_interface_get(context, vif_id)
|
return IMPL.virtual_interface_get(context, vif_id)
|
||||||
|
@ -1530,6 +1530,15 @@ def _virtual_interface_query(context):
|
|||||||
return model_query(context, models.VirtualInterface, read_deleted="no")
|
return model_query(context, models.VirtualInterface, read_deleted="no")
|
||||||
|
|
||||||
|
|
||||||
|
@require_context
|
||||||
|
@pick_context_manager_writer
|
||||||
|
def virtual_interface_update(context, address, values):
|
||||||
|
vif_ref = virtual_interface_get_by_address(context, address)
|
||||||
|
vif_ref.update(values)
|
||||||
|
vif_ref.save(context.session)
|
||||||
|
return vif_ref
|
||||||
|
|
||||||
|
|
||||||
@require_context
|
@require_context
|
||||||
@pick_context_manager_reader
|
@pick_context_manager_reader
|
||||||
def virtual_interface_get(context, vif_id):
|
def virtual_interface_get(context, vif_id):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user