Exemple #1
0
// retrieves the uuid of the appliance vm to create a unique vsphere extension name
func (d *Dispatcher) GenerateExtensionName(conf *metadata.VirtualContainerHostConfigSpec) error {
	defer trace.End(trace.Begin(conf.ExtensionName))

	// must be called after appliance VM is created
	vm, err := d.findAppliance(conf)

	if err != nil {
		return errors.Errorf("Could not find appliance at extension creation time; failed with error: %s", err)
	}

	var o mo.VirtualMachine
	err = vm.Properties(d.ctx, vm.Reference(), []string{"config.uuid"}, &o)
	if err != nil {
		return errors.Errorf("Could not get VM UUID from appliance VM due to error: %s", err)
	}

	conf.ExtensionName = "com.vmware.vic." + o.Config.Uuid
	return nil
}