glennmatthews / cot

Common OVF Tool
MIT License
92 stars 23 forks source link

cot deploy does not add serial port if one doesn't exist in OVF #51

Closed jeffbrl closed 8 years ago

jeffbrl commented 8 years ago

Issue Type: Potentially expected behavior, operator error, or defect

cot version: Common OVF Tool (COT), version 1.7.0+1.gada3935

OS: Ubuntu 14.04.3 LTS

vsphere version: vsphere 6.0

Summary: Serial port is not added to guest if OVF tool does not define a serial port. If the OVF is edited to include a serial port, cot deploy will successfully deploy it. I am pointing cots at the vcenter server.

Steps to reproduce:

  1. Use an OVA/OVF that doesn't include a serial port such as Tiny Core Linux https://communities.vmware.com/docs/DOC-21621). Note: Tiny Core doesn't seem to wire a tty to the serial port; I am using this OVA for testing because of its small size.
  2. Using cots deploy in a manner such as

    (venv)jeffl@ubuntu:~/development/cot-testing$ cot -v deploy tiny-orig.ova esxi "10.10.120.150/DC1/host/host1" -u "jeffl" -p 'pass123' -d "datastore1" -N External-VM-Network=PG_RED -S telnet://:3010,server -n my_tiny
    INFO: COT.vm_factory         Loading 'tiny-orig.ova' as OVF
    VERBOSE: COT.vm_description     Temporary directory for VM created from tiny-orig.ova: /tmp/cotQ4ZozL
    VERBOSE: COT.ovf.ovf            Untarring tiny-orig.ova to working directory /tmp/cotQ4ZozL
    VERBOSE: COT.ovf.ovf            Extracted OVF descriptor from tiny-orig.ova to working dir /tmp/cotQ4ZozL
    VERBOSE: COT.ovf.ovf            Root namespace is http://schemas.dmtf.org/ovf/envelope/1
     INFO: COT.ovf.ovf            OVF version is 1.x
    VERBOSE: COT.ovf.ovf            Current configuration profiles are: []
    VERBOSE: COT.ovf.hardware       OVF contains 10 hardware Item elements describing 10 unique devices
     INFO: COT.ovf.ovf            OVF product class None --> platform GenericPlatform
    tiny-orig.ova configuration 'None' defines only 0 serial ports, but you have given connection information for 1 ports.
    Continue to create additional ports? [y] y
    INFO: COT.deploy_esxi        Deploying VM...
    VERBOSE: COT.helpers.helper     Checking for helper executable ovftool
    VERBOSE: COT.helpers.helper     ovftool is at /usr/bin/ovftool
     INFO: COT.helpers.helper     Calling 'ovftool --net:External-VM-Network=PG_RED --name=my_tiny --datastore=datastore1 tiny-orig.ova vi://jeffl:pass123@10.10.120.150/DC1/host/host1'...
    Opening OVA source: tiny-orig.ova
    The manifest validates
    Opening VI target: vi://jeffl@10.10.120.150:443/DC1/host/host1
    Deploying to VI: vi://jeffl@10.10.120.150:443/DC1/host/host1
    Transfer Completed
    Completed successfully
    INFO: COT.helpers.helper     ...done
    (venv)jeffl@ubuntu:~/development/cot-testing$
  3. Examine vcenter to see if the newly created VM includes a serial port. In my case, it does not.

Workaround: Add serial port to OVF via cot edit-hardware before running cot deploy.

Comments: It appears as though fixup_serial_ports() isn't called in deploy_esxi.py:374 if serial_count[self.configuration] is zero. This makes me wonder if what I am seeing is expected behavior. I can't tell if the pyvomi code is modifying an existing serial port or adding a new one.

By the way, this is fantastic software and I appreciate your sharing it.

glennmatthews commented 8 years ago

Thanks for the bug report and for the very detailed analysis! You've correctly identified the root cause and I'm now working on a fix for this issue.

glennmatthews commented 8 years ago

Fixed in COT 1.7.1.