1. 21 7月, 2011 6 次提交
    • W
      Introduce the function virCgroupForVcpu · 8e64f873
      Wen Congyang 提交于
      Introduce the function virCgroupForVcpu() to create sub directory for each vcpu.
      8e64f873
    • L
      qemu: send-key: Implement the driver methods · e4072577
      Lai Jiangshan 提交于
      qemu driver just accept xt_kbd codeset's keycode, so the lib virtkey
      is used for translating keycodes from other codesets
      e4072577
    • L
      util: add virtkeycode module · 0bbf87e9
      Lai Jiangshan 提交于
      Add virtkey lib for usage-improvment and keycode translating.
      Add 4 internal API for the aim
      
      const char *virKeycodeSetTypeToString(int codeset);
      int virKeycodeSetTypeFromString(const char *name);
      int virKeycodeValueFromString(virKeycodeSet codeset, const char *keyname);
      int virKeycodeValueTranslate(virKeycodeSet from_codeset,
                                   virKeycodeSet to_offset,
                                   int key_value);
      
      * include/libvirt/libvirt.h.in: extend virKeycodeSet enum
      * src/Makefile.am: add new virtkeycode module and rule to generate
        virkeymaps.h
      * src/util/virkeycode.c src/util/virkeycode.h: new module
      * src/util/virkeycode-mapgen.py: python generator for virkeymaps.h
        out of keymaps.csv
      * src/libvirt_private.syms: extend private symbols for new module
      * .gitignore: add generated virkeymaps.h
      0bbf87e9
    • L
      util: Add keymaps.csv · 1151f0ee
      Lai Jiangshan 提交于
      Should keep it as the same as:
      http://git.gnome.org/browse/gtk-vnc/commit/src/keymaps.csv
      
      All master  keymaps are defined in a CSV file. THis covers
      Linux keycodes, OSX keycodes, AT set1, 2 & 3, XT keycodes,
      the XT encoding used by the Linux KBD driver, USB keycodes,
      Win32 keycodes, the XT encoding used by Xorg on Cygwin,
      the XT encoding used by Xorg on Linux with kbd driver.
      
      * src/Makefile.am: added to EXTRA_DIST
      * src/util/keymaps.csv: new file
      1151f0ee
    • E
      maint: fix typos on guaranteed · a7143405
      Eric Blake 提交于
      * src/conf/domain_event.c (virDomainEventDispatch): Fix typo.
      * src/internal.h (ATTRIBUTE_FMT_PRINTF): Likewise.
      * src/libvirt.c (virStreamEventUpdateCallback): Likewise.
      * src/remote/remote_driver.c (doRemoteOpen): Likewise.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Likewise.
      * src/util/virterror.c (virConnCopyLastError, virCopyLastError):
      Likewise.
      * src/xen/xend_internal.h (xend_wait_for_devices): Likewise.
      a7143405
    • C
      rpc: Pass through DISPLAY so ssh can launch askpass · e0a21dfe
      Cole Robinson 提交于
      Though we prefer users to have SSH keys setup, virt-manager users still
      depend on remote SSH connections to launch a password dialog. This fixes
      launch ssh-askpass
      
      Fix suggested by danpb
      e0a21dfe
  2. 20 7月, 2011 13 次提交
  3. 19 7月, 2011 12 次提交
    • D
      Add sanity checking of basic constraints, key purpose & key usage · 79591d4f
      Daniel P. Berrange 提交于
      Gnutls requires that certificates have basic constraints present
      to be used as a CA certificate. OpenSSL doesn't add this data
      by default, so add a sanity check to catch this situation. Also
      validate that the key usage and key purpose constraints contain
      correct data
      
      * src/rpc/virnettlscontext.c: Add sanity checking of certificate
        constraints
      79591d4f
    • D
      Add some basic sanity checking of certificates before use · 543c266d
      Daniel P. Berrange 提交于
      If the libvirt daemon or libvirt client is configured with bogus
      certificates, it is very unhelpful to only find out about this
      when a TLS connection is actually attempted. Not least because
      the error messages you get back for failures are incredibly
      obscure.
      
      This adds some basic sanity checking of certificates at the
      time the virNetTLSContext object is created. This is at libvirt
      startup, or when creating a virNetClient instance.
      
      This checks that the certificate expiry/start dates are valid
      and that the certificate is actually signed by the CA that is
      loaded.
      
      * src/rpc/virnettlscontext.c: Add certificate sanity checks
      543c266d
    • D
      Fix reporting of errors for p2p migration · 789fc4ae
      Daniel P. Berrange 提交于
      Starting/ending jobs when closing the connection may reset any
      error which was reported earlier in p2p migration. We must
      save the original error before doing so. This means we can also
      just call virConnectClose as normal, instead of virUnrefConnect
      
      * src/qemu/qemu_migration.c: Preserve errors in p2p migration
      789fc4ae
    • D
      Add an explicit virNetClientClose method · e06c8ede
      Daniel P. Berrange 提交于
      Since the I/O callback registered against virNetSocket will
      hold a reference on the virNetClient, we can't rely on the
      virNetClientFree to be able to close the network connection.
      The last reference will only go away when the event callback
      fires (likely due to EOF from the server).
      
      This is sub-optimal and can potentially cause a leak of the
      virNetClient object if the server were to not explicitly
      close the socket itself
      
      * src/remote/remote_driver.c: Explicitly close the client
        object when disconnecting
      * src/rpc/virnetclient.c, src/rpc/virnetclient.h: Add a
        virNetClientClose method
      e06c8ede
    • D
      Use a virFreeCallback on virNetSocket to ensure safe release · 7ea2ef4c
      Daniel P. Berrange 提交于
      When unregistering an I/O callback from a virNetSocket object,
      there is still a chance that an event may come in on the callback.
      In this case it is possible that the virNetSocket might have been
      freed already. Make use of a virFreeCallback when registering
      the I/O callbacks and hold a reference for the entire time the
      callback is set.
      
      * src/rpc/virnetsocket.c: Register a free function for the
        file handle watch
      * src/rpc/virnetsocket.h, src/rpc/virnetserverservice.c,
        src/rpc/virnetserverclient.c, src/rpc/virnetclient.c: Add
        a free function for the socket I/O watches
      7ea2ef4c
    • D
      Add mutex locking and reference counting to virNetSocket · 6198f3a1
      Daniel P. Berrange 提交于
      Remove the need for a virNetSocket object to be protected by
      locks from the object using it, by introducing its own native
      locking and reference counting
      
      * src/rpc/virnetsocket.c: Add locking & reference counting
      6198f3a1
    • D
      Add some debugging for virNetClient reference counting · 06c0d184
      Daniel P. Berrange 提交于
      * src/rpc/virnetclient.c: Add debugging of ref counts
      06c0d184
    • A
      util: avoid fds leak when virEventPollAddHandle fail · 463e8c2f
      Alex Jia 提交于
      * src/util/event_poll.c: avoid file descriptors leak when
        virEventPollAddHandle fail on virEventPollInit function.
      463e8c2f
    • D
      Unregister event callback if a fatal error occurs during dispatch · 07b39a94
      Daniel P. Berrange 提交于
      If we get an I/O error in the async event callback for an RPC
      client, we might not have consumed all pending data off the
      wire. This could result in the callback being immediately
      invoked again. At which point the same I/O might occur. And
      we're invoked again. And again...And again...
      
      Unregistering the async event callback if an error occurs is
      a good safety net. The real error will be seen when the next
      RPC method is invoked
      
      * src/rpc/virnetclient.c: Unregister event callback on error
      07b39a94
    • D
      Quieten build & ensure API build scripts exit with non-zero status · 8665f855
      Daniel P. Berrange 提交于
      The current API build scripts will continue and exit with a zero
      status even if they find problems. This has been the cause of many
      build problems, or hidden build errors, in the past. Change the
      scripts so they always exit with a non-zero status for any problems
      they do not understand. Also turn off all debug output by default
      so they respect $(AM_V_GEN)
      
      * docs/Makefile.am: Use $(AM_V_GEN) for API/HTML scripts
      * docs/apibuild.py, python/generator.py: Exit with non-zero status
        if problems are found. Also be silent, not outputting any debug
        messages.
      * src/Makefile.am: Use $(AM_V_GEN) for ESX generator
      * python/Makefile.am: Tweak rule
      8665f855
    • E
      libvirt: do not mix internal flags into public API · 33ba6e68
      Eric Blake 提交于
      There were two API in driver.c that were silently masking flags
      bits prior to calling out to the drivers, and several others
      that were explicitly masking flags bits.  This is not
      forward-compatible - if we ever have that many flags in the
      future, then talking to an old server that masks out the
      flags would be indistinguishable from talking to a new server
      that can honor the flag.  In general, libvirt.c should forward
      _all_ flags on to drivers, and only the drivers should reject
      unknown flags.
      
      In the case of virDrvSecretGetValue, the solution is to separate
      the internal driver callback function to have two parameters
      instead of one, with only one parameter affected by the public
      API.  In the case of virDomainGetXMLDesc, it turns out that
      no one was ever mixing VIR_DOMAIN_XML_INTERNAL_STATUS with
      the dumpxml path in the first place; that internal flag was
      only used in saving and restoring state files, which happened
      to be in functions internal to a single file, so there is no
      mixing of the internal flag with a public flags argument.
      Additionally, virDomainMemoryStats passed a flags argument
      over RPC, but not to the driver.
      
      * src/driver.h (VIR_DOMAIN_XML_FLAGS_MASK)
      (VIR_SECRET_GET_VALUE_FLAGS_MASK): Delete.
      (virDrvSecretGetValue): Separate out internal flags.
      (virDrvDomainMemoryStats): Provide missing flags argument.
      * src/driver.c (verify): Drop unused check.
      * src/conf/domain_conf.h (virDomainObjParseFile): Delete
      declaration.
      (virDomainXMLInternalFlags): Move...
      * src/conf/domain_conf.c: ...here.  Delete redundant include.
      (virDomainObjParseFile): Make static.
      * src/libvirt.c (virDomainGetXMLDesc, virSecretGetValue): Update
      clients.
      (virDomainMemoryPeek, virInterfaceGetXMLDesc)
      (virDomainMemoryStats, virDomainBlockPeek, virNetworkGetXMLDesc)
      (virStoragePoolGetXMLDesc, virStorageVolGetXMLDesc)
      (virNodeNumOfDevices, virNodeListDevices, virNWFilterGetXMLDesc):
      Don't mask unknown flags.
      * src/interface/netcf_driver.c (interfaceGetXMLDesc): Reject
      unknown flags.
      * src/secret/secret_driver.c (secretGetValue): Update clients.
      * src/remote/remote_driver.c (remoteSecretGetValue)
      (remoteDomainMemoryStats): Likewise.
      * src/qemu/qemu_process.c (qemuProcessGetVolumeQcowPassphrase):
      Likewise.
      * src/qemu/qemu_driver.c (qemudDomainMemoryStats): Likewise.
      * daemon/remote.c (remoteDispatchDomainMemoryStats): Likewise.
      33ba6e68
    • J
      build: Fix protocol-structs check in VPATH build · 40798fb0
      Jiri Denemark 提交于
      $@ already included $(srcdir)
      40798fb0
  4. 18 7月, 2011 1 次提交
    • D
      Fix now dead cleanup of VMs on libvirtd restart · 80cafba3
      Daniel P. Berrange 提交于
      When libvirtd restarts it will attempt to reconnect to existing
      LXC containers. If it loads a XML state file for the container
      the container will appear running. If we fail to read the PID
      file, or fail to connect to the LXC monitor, we should be killing
      off the guest, but if the VMs cgroup does not exist any more,
      cleanup will get skipped. Reading the PID file is also pointless
      since the PID is in the XML statefile
      
      In lxcReconnectVM we do not need to read the PID file. If part
      of the reconnect process fails we need to run the VM terminate
      code as a safety net.
      
      In lxcVMTerminate, if we can't obtain the VM cgroup, we know
      the process has died, but we must still run lxcVMCleanup to
      clear out the virDomainObjPtr live state
      
      * src/lxc/lxc_driver.c: Fix cleanup of dead VMs on restart
      80cafba3
  5. 17 7月, 2011 1 次提交
    • O
      rpc: Fix typos in rpc generator scripts · 92f0a7f5
      Osier Yang 提交于
      These typos are introduced by file renaming in commit b17b4afa.
      
      src/remote/qemu_protocol.x \
      src/remote/remote_protocol.x \
      src/rpc/gendispatch.pl:
          s/remote_generator/gendispatch/
      
      src/rpc/genprotocol.pl:
          s/remote\/remote_protocol/remote_protocol/
      92f0a7f5
  6. 16 7月, 2011 7 次提交
    • O
      qemu: Fix a regression of attaching device · fab4f0c6
      Osier Yang 提交于
      The regression is introduced by Commit da1eba6b, the new
      codes with this commit doesn't reset "ret" to "-1" when
      it fails on parsing the device XML (live device attachment)
      
      This patch changes the codes to reset the "ret" and "-1",
      and also changes the codes so that it don't modify "ret"
      for condition checking.
      
      How to reproduce:
      
      % cat test.xml
      <disk type='oops' device='disk'>
        <driver name='qemu' type='raw'/>
        <source file='/var/lib/libvirt/images/test.img'/>
        <target dev='vda' bus='virtio'/>
      </disk>
      
      % virsh attach-device $domain test.xml
      Device attached successfully
      
      The device attachment failed actually with error "unknown disk type 'oops'",
      however, it reports success.
      fab4f0c6
    • E
      build: also track RPC on-wire enum values · 703d4ed5
      Eric Blake 提交于
      As long as we guarantee RPC struct layout stability, we might as
      well also guarantee RPC enum value constancy.
      
      * src/Makefile.am (r1, r2, PDWTAGS): Adjust rule to pick up named
      and anonymous enums.
      * src/remote_protocol-structs: Add enum values.
      * src/qemu_protocol-structs: Likewise.
      * src/virnetprotocol-structs: Likewise.
      703d4ed5
    • E
      docs: document dxml argument to migrate2 · aea883ab
      Eric Blake 提交于
      Commit 13555416 introduced a nice feature without documenting it.
      
      * src/libvirt.c (virDomainMigrate2): Add paragraph.
      aea883ab
    • E
      build: add syntax check for proper flags use · 761bbb17
      Eric Blake 提交于
      Enforce the recent flags cleanups - we want to use 'unsigned int flags'
      in any of our APIs (except where backwards compatibility is important,
      in the public migration APIs), and that all flags are checked for
      validity (except when there are stub functions that completely
      ignore the flags argument).
      
      There are a few minor tweaks done here to avoid false positives:
      signed arguments passed to open() are renamed oflags, and flags
      arguments that are legitimately ignored are renamed flags_unused.
      
      * cfg.mk (sc_flags_usage): New rule.
      (exclude_file_name_regexp--sc_flags_usage): And a few exemptions.
      (sc_flags_debug): Tweak wording.
      * src/util/iohelper.c (runIO, main): Rename variable.
      * src/util/util.c (virSetInherit): Likewise.
      * src/fdstream.h (virFDStreamOpenFile, virFDStreamCreateFile):
      Likewise.
      * src/fdstream.c (virFDStreamOpenFileInternal)
      (virFDStreamOpenFile, virFDStreamCreateFile): Likewise.
      * src/util/command.c (virExecWithHook) [WIN32]: Likewise.
      * src/util/util.c (virFileOpenAs, virDirCreate) [WIN32]: Likewise.
      * src/locking/lock_manager.c (virLockManagerPluginNew)
      [!HAVE_DLFCN_H]: Likewise.
      * src/locking/lock_driver_nop.c (virLockManagerNopNew)
      (virLockManagerNopAddResource, virLockManagerNopAcquire)
      (virLockManagerNopRelease, virLockManagerNopInquire): Likewise.
      761bbb17
    • E
      xen: reject unknown flags · 6a713b31
      Eric Blake 提交于
      Also fix a logic bug in xenXMDomain{Attach,Detach}DeviceFlags,
      where (flags & VIR_DOMAIN_DEVICE_MODIFY_CURRENT) is always false.
      
      * src/xen/xen_driver.c (xenUnifiedDomainXMLFromNative)
      (xenUnifiedDomainXMLToNative, xenUnifiedDomainBlockPeek): Reject
      unknown flags.
      * src/xen/xen_hypervisor.c (xenHypervisorOpen)
      (xenHypervisorGetDomainState): Likewise.
      * src/xen/xen_inotify.c (xenInotifyOpen): Likewise.
      * src/xen/xs_internal.c (xenStoreOpen, xenStoreDomainGetState)
      (xenStoreDomainReboot): Likewise.
      * src/xen/xend_internal.c (xenDaemonOpen, xenDaemonDomainReboot)
      (xenDaemonDomainCoreDump, xenDaemonDomainGetState)
      (xenDaemonDomainMigratePrepare, xenDaemonDomainSetVcpusFlags,
      xenDaemonDomainGetVcpusFlags, xenDaemonAttachDeviceFlags,
      xenDaemonDetachDeviceFlags): Likewise.
      (xenDaemonDomainGetXMLDesc): Prefer unsigned flags.
      * src/xen/xend_internal.h (xenDaemonDomainGetXMLDesc): Likewise.
      * src/xen/xm_internal.h (xenXMDomainGetXMLDesc): Likewise.
      * src/xen/xm_internal.c (xenXMDomainGetXMLDesc): Likewise.
      (xenXMOpen, xenXMDomainGetState, xenXMDomainSetVcpusFlags)
      (xenXMDomainGetVcpusFlags): Reject unknown flags.
      (xenXMDomainAttachDeviceFlags, xenXMDomainDetachDeviceFlags):
      Likewise, and avoid always-false conditional.
      * src/xen/xen_driver.h (XEN_MIGRATION_FLAGS): New define.
      6a713b31
    • E
      esx: reject unknown flags · ca122578
      Eric Blake 提交于
      Silently ignored flags get in the way of new features that
      use those flags.
      
      Regarding ESX migration flags - right now, ESX silently enforces
      VIR_MIGRATE_PERSIST_DEST, VIR_MIGRATE_UNDEFINE_SOURCE, and
      VIR_MIGRATE_LIVE, even if those flags were not supplied; it ignored
      other flags.  This patch does not change the implied bits (it permits
      but does not require them), but enforces only the supported bits.
      If further cleanup is needed to be more particular about migration
      flags, that should be a separate patch.
      
      * src/esx/esx_device_monitor.c (esxDeviceOpen): Reject unknown
      flags.
      * src/esx/esx_driver.c (esxOpen, esxDomainReboot)
      (esxDomainXMLFromNative, esxDomainXMLToNative)
      (esxDomainMigratePrepare, esxDomainMigratePerform)
      (esxDomainMigrateFinish): Likewise.
      * src/esx/esx_interface_driver.c (esxInterfaceOpen): Likewise.
      * src/esx/esx_network_driver.c (esxNetworkOpen): Likewise.
      * src/esx/esx_nwfilter_driver.c (esxNWFilterOpen): Likewise.
      * src/esx/esx_secret_driver.c (esxSecretOpen): Likewise.
      * src/esx/esx_storage_driver.c (esxStorageOpen): Likewise.
      ca122578
    • E
      flags: fix domain_conf migration regression · 20135c70
      Eric Blake 提交于
      Commit 461e0f1a broke migration, because there was a code path
      that tried to enable an internal flag while still going through
      the public function.  Split the internal flag into a separate
      callback, and validate that flags do not overlap.
      
      * src/conf/domain_conf.c (virDomainDefFormat): Split...
      (virDomainDefFormatInternal): ...to separate the flag check.
      (virDomainObjFormat): Adjust caller.
      20135c70