1. 23 1月, 2015 1 次提交
    • E
      conf: virDomainDefMaybeAddController tweak return code · 852cea52
      Erik Skultety 提交于
      Previously the function returned either -1 in case of an error or 0 on
      success. However, we should also distinguish between a case we
      successfully added a controller and a case there wasn't a need to add any
      controller
      852cea52
  2. 16 1月, 2015 6 次提交
  3. 14 1月, 2015 3 次提交
    • M
      conf: Increase virNetDevBandwidthParse intelligence · a605025c
      Michal Privoznik 提交于
      There's this function virNetDevBandwidthParse which parses the
      bandwidth XML snippet. But it's not clever much. For the
      following XML it allocates the virNetDevBandwidth structure even
      though it's completely empty:
      
          <bandwidth>
          </bandwidth>
      
      Later in the code there are some places where we check if
      bandwidth was set or not. And since we obtained pointer from the
      parsing function we think that it is when in fact it isn't.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      a605025c
    • D
      Give virDomainDef parser & formatter their own flags · 0ecd6851
      Daniel P. Berrange 提交于
      The virDomainDefParse* and virDomainDefFormat* methods both
      accept the VIR_DOMAIN_XML_* flags defined in the public API,
      along with a set of other VIR_DOMAIN_XML_INTERNAL_* flags
      defined in domain_conf.c.
      
      This is seriously confusing & error prone for a number of
      reasons:
      
       - VIR_DOMAIN_XML_SECURE, VIR_DOMAIN_XML_MIGRATABLE and
         VIR_DOMAIN_XML_UPDATE_CPU are only relevant for the
         formatting operation
       - Some of the VIR_DOMAIN_XML_INTERNAL_* flags only apply
         to parse or to format, but not both.
      
      This patch cleanly separates out the flags. There are two
      distint VIR_DOMAIN_DEF_PARSE_* and VIR_DOMAIN_DEF_FORMAT_*
      flags that are used by the corresponding methods. The
      VIR_DOMAIN_XML_* flags received via public API calls must
      be converted to the VIR_DOMAIN_DEF_FORMAT_* flags where
      needed.
      
      The various calls to virDomainDefParse which hardcoded the
      use of the VIR_DOMAIN_XML_INACTIVE flag change to use the
      VIR_DOMAIN_DEF_PARSE_INACTIVE flag.
      0ecd6851
    • D
      Decouple CPU XML formatting from domain XML public API flags · e34473c1
      Daniel P. Berrange 提交于
      The virCPUDefFormat* methods were relying on the VIR_DOMAIN_XML_*
      flag definitions. It is not desirable for low level internal
      functions to be coupled to flags for the public API, since they
      may need to be called from several different contexts where the
      flags would not be appropriate.
      e34473c1
  4. 13 1月, 2015 1 次提交
  5. 09 1月, 2015 1 次提交
    • L
      conf: Correctly format controller's driver · 97fac17c
      Luyao Huang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1179684
      
      The way that we currently generate the <driver/> for <controller/> is
      just madness:
      
          <controller type='scsi' index='0' model='virtio-scsi'>
            <driver queues='12'/>
            <driver cmd_per_lun='123'/>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
          </controller>
      
      It's obvious that we should be aiming at the following:
      
          <controller type='scsi' index='0' model='virtio-scsi'>
            <driver queues='12' cmd_per_lun='123'/>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
          </controller>
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      97fac17c
  6. 07 1月, 2015 1 次提交
  7. 06 1月, 2015 4 次提交
  8. 16 12月, 2014 1 次提交
    • M
      conf: Rework virDomainObjListFindByUUID to allow more concurrent APIs · feb1a4d7
      Martin Kletzander 提交于
      Currently, when there is an API that's blocking with locked domain and
      second API that's waiting in virDomainObjListFindByUUID() for the domain
      lock (with the domain list locked) no other API can be executed on any
      domain on the whole hypervisor because all would wait for the domain
      list to be locked.  This patch adds new optional approach to this in
      which the domain is only ref'd (reference counter is incremented)
      instead of being locked and is locked *after* the list itself is
      unlocked.  We might consider only ref'ing the domain in the future and
      leaving locking on particular APIs, but that's no tonight's fairy tale.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      feb1a4d7
  9. 15 12月, 2014 4 次提交
    • W
      qemu: make persistent update of graphics device supported · 9603bce7
      Wang Rui 提交于
      We can change vnc password by using virDomainUpdateDeviceFlags API with
      live flag. But it can't be changed with config flag. Error is reported as
      below.
      
      error: Operation not supported: persistent update of device 'graphics' is not supported
      
      This patch supports the graphics arguments changed with config flag.
      Signed-off-by: NWang Rui <moon.wangrui@huawei.com>
      9603bce7
    • L
      conf: fix virDomainLeaseIndex logic · 046d82d7
      Luyao Huang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1174096
      
      When both parameter have lockspaces present, virDomainLeaseIndex
      always returns -1 even there is a lease the same with the one we
      check. This is due to broken logic in 'if-else' statement.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      046d82d7
    • L
      conf: Fix libvirtd crash matching hostdev XML · 5fc1c517
      Luyao Huang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1174053
      
      Introduced by commit id '17bddc46' - fix a libvirtd crash when
      matching a network iscsi hostdev with a host iscsi hostdev.
      
      When we use attach-device to coldplug a network iscsi hostdev,
      libvirt will check if there is already a device in XML. But if
      the 'b' is a host iscsi hostdev and 'a' is a network iscsi hostdev,
      then libvirtd will crash in virDomainHostdevMatchSubsysSCSIiSCSI
      because 'b' doesn't have a hostname.
      
      Add a check in virDomainHostdevMatchSubsys, if the a's protocol
      and b's protocol is not the same.
      
      Following is the backtrace:
      
      0  0x00007f850d6bc307 in virDomainHostdevMatchSubsysSCSIiSCSI at conf/domain_conf.c:10889
      1  virDomainHostdevMatchSubsys at conf/domain_conf.c:10911
      2  virDomainHostdevMatch at conf/domain_conf.c:10973
      3  virDomainHostdevFind at conf/domain_conf.c:10998
      4  0x00007f84f6a10560 in qemuDomainAttachDeviceConfig at qemu/qemu_driver.c:7223
      5  qemuDomainAttachDeviceFlags at qemu/qemu_driver.c:7554
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      5fc1c517
    • E
      conf: move the check for secondary consoles of targetType serial · d85dcae4
      Erik Skultety 提交于
      For historical reasons, only the first <console> element might be of targetType
      serial, but we checked for other consoles of targetType serial in our post-parse
      callback if and only if we knew the first console was serial, otherwise
      the check was skipped.
      This patch moves the check one level up, so first
      the check for secondary console of type serial is performed and then the
      rest of operations continue unchanged.
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1170092
      d85dcae4
  10. 13 12月, 2014 2 次提交
    • M
      qemu: avoid rare race when undefining domain · c7d1c139
      Martin Kletzander 提交于
      When one domain is being undefined and at the same time started, for
      example, there is a possibility of a rare problem occuring.
      
       - Thread 1 does virDomainUndefine(), has the lock, checks that the
         domain is active and because it's not, calls
         virDomainObjListRemove().
      
       - Thread 2 does virDomainCreate() and tries to lock the domain.
      
       - Thread 1 needs to lock domain list in order to remove the domain from
         it, but must unlock domain first (proper order is to lock domain list
         first and the domain itself second).
      
       - Thread 2 grabs the lock, starts the domain and releases the lock.
      
       - Thread 1 grabs the lock and removes the domain from list.
      
      With this patch:
      
       - The undefining domain gets marked as "to undefine" before it is
          unlocked.
      
       - If domain is found in any of the search APIs, it's returned only if
         it is not marked as "to undefine".  The check is done while the
         domain is locked.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1150505Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      c7d1c139
    • L
      conf: Ignore device address for model=none usb controller and memballon · f6f4bd10
      Luyao Huang 提交于
      It make no sense at all to have it there.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      f6f4bd10
  11. 12 12月, 2014 1 次提交
  12. 10 12月, 2014 1 次提交
  13. 09 12月, 2014 3 次提交
    • L
      conf: forbid negative number in address(like controller, bus, slot...) · a23fefdf
      Luyao Huang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1171582
      
      When we edit a negative controller address number to a device,
      some of them will auto generate a controller with invalid index
      number. This will make guest disappear after restart libvirtd.
      Instead of allowing negative number for controller index, we
      should forbid negative number in these place (we did this before,
      but after f18c02ec, virStrToLong_ui changed to allow negative
      number). Therefore switch to virStrToLong_uip in these places.
      Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      a23fefdf
    • L
      network: store network macTableManager setting in NetDef actual object · 33f4a8bc
      Laine Stump 提交于
      At the time that the network driver allocates a connection to a
      network, the tap device that will be used hasn't yet been created -
      that will be done later by qemu (or lxc or whoever) - but if the
      network has macTableManager='libvirt', then when we do get around to
      creating the tap device, we will need to add an entry for it to the
      network bridge's fdb (forwarding database) *and* turn off learning and
      unicast_flood for that tap device in the bridge's sysfs settings. This
      means that qemu needs to know both the bridge name as well as the
      setting of macTableManager, so we either need to create a new API to
      retrieve that info, or just pass it back in the ActualNetDef that is
      created during networkAllocateActualDevice. We choose the latter
      method, since it's already done for the bridge device, and it has the
      side effect of making the information available in domain status.
      
      (NB: in the future, I think that the tap device should actually be
      created by networkAllocateActualDevice(), as that will solve several
      other problems, but that is a battle for another day, and this
      information will still be useful outside the network driver)
      33f4a8bc
    • L
      network: save bridge name in ActualNetDef when actualType==network too · a3609121
      Laine Stump 提交于
      When the actualType of a virDomainNetDef is "network", it means that
      we are connecting to a libvirt-managed network (routed, natted, or
      isolated) which does use a bridge device (created by libvirt). In the
      past we have required drivers such as qemu to call the public API to
      retrieve the bridge name in this case (even though it is available in
      the NetDef's ActualNetDef if the actualType is "bridge" (i.e., an
      externally-created bridge that isn't managed by libvirt). There is no
      real reason for this difference, and as a matter of fact it
      complicates things for qemu. Also, there is another bridge-related
      attribute (macTableManager) that will need to be available in both
      cases, so this makes things consistent.
      
      In order to avoid problems when restarting libvirtd after an update
      from an older version that *doesn't* store the network's bridgename in
      the ActualNetDef, we also need to put it in place during
      networkNotifyActualDevice() (this function is run for each interface
      of each domain whenever libvirtd is restarted).
      
      Along with making the bridge name available in the internal object, it
      is also now reported in the <source> element of the <interface> state
      XML (or the <actual> subelement in the internally-stored format).
      
      The one oddity about this change is that usually there is a separate
      union for every different "type" in a higher level object (e.g. in the
      case of a virDomainNetDef there are separate "network" and "bridge"
      members of the union that pivots on the type), but in this case
      network and bridge types both have exactly the same attributes, so the
      "bridge" member is used for both type==network and type==bridge.
      a3609121
  14. 02 12月, 2014 2 次提交
  15. 01 12月, 2014 2 次提交
  16. 25 11月, 2014 2 次提交
  17. 24 11月, 2014 1 次提交
  18. 21 11月, 2014 3 次提交
  19. 15 11月, 2014 1 次提交