Bug #4602

cannot attach NIC if contextualization missing in KVM VM

Added by Georgi Aleksandrov about 5 years ago. Updated almost 5 years ago.

Status:ClosedStart date:06/27/2016
Priority:HighDue date:
Assignee:Javi Fontan% Done:

0%

Category:Drivers - VM
Target version:Release 5.0.2
Resolution:fixed Pull request:
Affected Versions:OpenNebula 5.0

Description

Hi,

If a KVM VM lacks contextualization in its template the following problem occurs:

In file /usr/lib/one/mads/one_vmm_exec.rb attach_nic()'s target_device doesn't get set (lines 861-862).
Thus an empty parameter gets passed to prereconfigure and reconfigure scripts later in the file (lines 914-916 and 928-931), resulting in:

"
[Z0][VMM][I]: Command execution fail: cat << EOT | /var/tmp/one/vmm/kvm/prereconfigure 'one-74' '' 74 onh1
[Z0][VMM][E]: prereconfigure: Command "virsh --connect qemu:///system change-media one-74 --eject --force" failed: error: command 'change-media' requires <path> option
[Z0][VMM][I]: Command execution fail: cat << EOT | /var/tmp/one/vmm/kvm/reconfigure 'one-74' '' '' 74 onh1
[Z0][VMM][E]: reconfigure: Command "virsh --connect qemu:///system change-media one-74 --insert" failed: error: command 'change-media' requires <path> option
"

Leading to a failed attempt to attach a NIC.

We could just wrap the virsh command in a simple check.
Patches for prereconfigure and reconfigure scripts attached.

regards,
Georgi A.

reconfigure.patch Magnifier - /var/lib/one/remotes/vmm/kvm/reconfigure (615 Bytes) Georgi Aleksandrov, 06/27/2016 07:51 PM

prereconfigure.patch Magnifier - /var/lib/one/remotes/vmm/kvm/prereconfigure (551 Bytes) Georgi Aleksandrov, 06/27/2016 07:51 PM

Associated revisions

Revision bda3bf48
Added by Georgi Aleksandrov almost 5 years ago

bug #4602: check before changing context cdrom

Revision e7054faf
Added by Javi Fontan almost 5 years ago

bug #4602: simplify if statements

By: EOLE Team

Revision e174c0d5
Added by Georgi Aleksandrov almost 5 years ago

bug #4602: check before changing context cdrom

(cherry picked from commit bda3bf488143b912170005509176624bab0a8ad9)

Revision dbb24d30
Added by Javi Fontan almost 5 years ago

bug #4602: simplify if statements

By: EOLE Team
(cherry picked from commit e7054fafe113bc38fdd941bf6982defc6c880b45)

History

#1 Updated by EOLE Team about 5 years ago

Hello,

You can replace

[[ ! -z "$VARIABLE" ]]

with

[[ -n "$VARIABLE" ]]

Since -n test if the length of $VARIABLE is nonzero.

Regards.

#2 Updated by EOLE Team about 5 years ago

We just hit this issue:

Tue Jun 28 11:22:33 2016 [Z0][VM][I]: New state is ACTIVE
Tue Jun 28 11:22:33 2016 [Z0][VM][I]: New LCM state is PROLOG
Tue Jun 28 11:22:35 2016 [Z0][VM][I]: New LCM state is BOOT
Tue Jun 28 11:22:35 2016 [Z0][VMM][I]: Generating deployment file: /var/lib/one/vms/22/deployment.0
Tue Jun 28 11:22:35 2016 [Z0][VM][I]: Virtual Machine has no context
Tue Jun 28 11:22:35 2016 [Z0][VMM][I]: ExitCode: 0
Tue Jun 28 11:22:35 2016 [Z0][VMM][I]: Successfully execute network driver operation: pre.
Tue Jun 28 11:22:35 2016 [Z0][VMM][I]: ExitCode: 0
Tue Jun 28 11:22:35 2016 [Z0][VMM][I]: Successfully execute virtualization driver operation: deploy.
Tue Jun 28 11:22:36 2016 [Z0][VMM][I]: post: Executed "sudo ovs-ofctl add-flow nebula in_port=14,dl_src=02:00:c0:a8:00:64,priority=40000,actions=normal".
Tue Jun 28 11:22:36 2016 [Z0][VMM][I]: post: Executed "sudo ovs-ofctl add-flow nebula in_port=14,priority=39000,actions=drop".
Tue Jun 28 11:22:36 2016 [Z0][VMM][I]: ExitCode: 0
Tue Jun 28 11:22:36 2016 [Z0][VMM][I]: Successfully execute network driver operation: post.
Tue Jun 28 11:22:36 2016 [Z0][VM][I]: New LCM state is RUNNING
Tue Jun 28 11:53:18 2016 [Z0][VM][I]: New LCM state is HOTPLUG_NIC
Tue Jun 28 11:53:19 2016 [Z0][VM][I]: Virtual Machine has no context
Tue Jun 28 11:53:19 2016 [Z0][VMM][I]: ExitCode: 0
Tue Jun 28 11:53:19 2016 [Z0][VMM][I]: Successfully execute network driver operation: pre.
Tue Jun 28 11:53:19 2016 [Z0][VMM][I]: ExitCode: 0
Tue Jun 28 11:53:19 2016 [Z0][VMM][I]: Successfully execute virtualization driver operation: attach_nic.
Tue Jun 28 11:53:19 2016 [Z0][VMM][I]: post: Executed "sudo ovs-ofctl add-flow nebula in_port=14,dl_src=02:00:c0:a8:00:64,priority=40000,actions=normal".
Tue Jun 28 11:53:19 2016 [Z0][VMM][I]: post: Executed "sudo ovs-ofctl add-flow nebula in_port=14,priority=39000,actions=drop".
Tue Jun 28 11:53:19 2016 [Z0][VMM][I]: post: Executed "sudo ovs-vsctl set Port one-22-1 tag=4".
Tue Jun 28 11:53:19 2016 [Z0][VMM][I]: post: Executed "sudo ovs-ofctl add-flow rectorat in_port=5,dl_src=02:10:c0:a8:e6:82,priority=40000,actions=normal".
Tue Jun 28 11:53:19 2016 [Z0][VMM][I]: post: Executed "sudo ovs-ofctl add-flow rectorat in_port=5,priority=39000,actions=drop".
Tue Jun 28 11:53:19 2016 [Z0][VMM][I]: ExitCode: 0
Tue Jun 28 11:53:19 2016 [Z0][VMM][I]: Successfully execute network driver operation: post.
Tue Jun 28 11:53:19 2016 [Z0][VMM][I]: Command execution fail: cat << EOT | /var/tmp/one/vmm/kvm/prereconfigure 'one-22' '' 22 grichka
Tue Jun 28 11:53:19 2016 [Z0][VMM][E]: prereconfigure: Command "virsh --connect qemu:///system change-media one-22  --eject --force" failed: error: command 'change-media' requires <path> option
Tue Jun 28 11:53:19 2016 [Z0][VMM][E]: Could not eject CDROM
Tue Jun 28 11:53:19 2016 [Z0][VMM][I]: ExitCode: 1
Tue Jun 28 11:53:19 2016 [Z0][VMM][I]: Failed to execute virtualization driver operation: prereconfigure.
Tue Jun 28 11:53:19 2016 [Z0][VMM][E]: Error attaching new VM NIC: Could not eject CDROM
Tue Jun 28 11:53:20 2016 [Z0][VM][I]: New LCM state is RUNNING
Tue Jun 28 12:14:40 2016 [Z0][VM][I]: New LCM state is SHUTDOWN
Tue Jun 28 12:14:41 2016 [Z0][VMM][I]: ExitCode: 0
Tue Jun 28 12:14:41 2016 [Z0][VMM][I]: Successfully execute virtualization driver operation: cancel.
Tue Jun 28 12:14:41 2016 [Z0][VMM][I]: clean: Executed "sudo ovs-ofctl del-flows nebula in_port=14".
Tue Jun 28 12:14:41 2016 [Z0][VMM][I]: ExitCode: 0
Tue Jun 28 12:14:41 2016 [Z0][VMM][I]: Successfully execute network driver operation: clean.
Tue Jun 28 12:14:41 2016 [Z0][VM][I]: New LCM state is EPILOG
Tue Jun 28 12:14:43 2016 [Z0][VM][I]: New state is DONE
Tue Jun 28 12:14:43 2016 [Z0][VM][I]: New LCM state is LCM_INIT

#3 Updated by Ruben S. Montero about 5 years ago

  • Category set to Drivers - VM
  • Status changed from Pending to New
  • Priority changed from Low to High

#4 Updated by Ruben S. Montero about 5 years ago

  • Target version set to Release 5.2

#5 Updated by Ruben S. Montero about 5 years ago

  • Target version changed from Release 5.2 to Release 5.0.2

#6 Updated by Jaime Melis almost 5 years ago

  • Assignee set to Javi Fontan

#7 Updated by Javi Fontan almost 5 years ago

  • Status changed from New to Closed
  • Resolution set to fixed

Changes added to master an one-5.0 branches.

Thanks!

Also available in: Atom PDF