[libvirt] [PATCH] virsh: Return false if only '--wipe-storage' is assigned when undefine a domain

2014-05-14 Thread Li Yang
For now, if only '--wipe-storage' is assigned, user can undefine a
domain normally. But actually '--wipe-storage' doesn't work, this
may confuse user. And since '--wipe-storage' wipes data on the
removed volumes, if no removed volume storage assigned, we'd better
raise an error message.

Before:
$ virsh undefine virt-tests-vm1 --wipe-storage
Domain virt-tests-vm1 has been undefined

After:
$ virsh undefine virt-tests-vm1 --wipe-storage
error: '--wipe-storage' needs storage volume deletion: '--stroage string' or 
'--remove-all-storage' is necessary.

Signed-off-by: Li Yang liyang.f...@cn.fujitsu.com
---
 tools/virsh-domain.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 3a7c260..25236a0 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2982,6 +2982,14 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
 
 ignore_value(vshCommandOptString(cmd, storage, vol_string));
 
+if (!(vol_string || remove_all_storage)  wipe_storage) {
+vshError(ctl,
+ _('--wipe-storage' needs storage volume deletion: 
+   '--stroage string' or '--remove-all-storage' 
+   is necessary.));
+return false;
+}
+
 if (managed_save) {
 flags |= VIR_DOMAIN_UNDEFINE_MANAGED_SAVE;
 managed_save_safe = true;
-- 
1.7.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v4 1/1] migration: add support for migrateURI configuration

2014-05-14 Thread Chen Fan
For now, we set the migration URI via command line '--migrate_uri' or
construct the URI by looking up the dest host's hostname which could be
solved by DNS automatically.

But in cases the dest host have two or more NICs to reach, we may need to
send the migration data over a specific NIC which is different from the
automatically resloved one for some reason like performance, security, etc.
thus we must explicitly specify the migrateuri in command line everytime,
but it is too troublesome if there are many such hosts(and don't forget
virt-manager).

This patches add a configuration file option on dest host to save the
default migrate uri which explicitly specify which of this host's
addresses is used for transferring data, thus user doesn't boring
to specify it in command line everytime.

Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com
---

v3-v4: move up the default uri_in setting to
   qemuDomainMigratePrepare3Params()

 src/qemu/qemu.conf | 6 +-
 src/qemu/qemu_conf.c   | 1 +
 src/qemu/qemu_conf.h   | 1 +
 src/qemu/qemu_driver.c | 2 +-
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index f0e802f..6b443d0 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -449,7 +449,11 @@
 #
 #seccomp_sandbox = 1
 
-
+# Override the migration URI for specifying one of host's IP addresses
+# to transfer the migration data stream.
+# Defaults to hostname, both IPv4 and IPv6 addresses are accepted.
+#
+#migrate_uri = tcp://192.168.0.1
 
 # Override the listen address for all incoming migrations. Defaults to
 # 0.0.0.0, or :: if both host and qemu are capable of IPv6.
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 198ee2f..43361dc 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -574,6 +574,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
 
 GET_VALUE_LONG(seccomp_sandbox, cfg-seccompSandbox);
 
+GET_VALUE_STR(migrate_uri, cfg-migrateUri);
 GET_VALUE_STR(migration_address, cfg-migrationAddress);
 
 ret = 0;
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index a36ea63..f99c56e 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -163,6 +163,7 @@ struct _virQEMUDriverConfig {
 
 int seccompSandbox;
 
+char *migrateUri;
 /* The default for -incoming */
 char *migrationAddress;
 int migrationPortMin;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fca1a91..56c24b5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10888,7 +10888,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
 virDomainDefPtr def = NULL;
 const char *dom_xml = NULL;
 const char *dname = NULL;
-const char *uri_in = NULL;
+const char *uri_in = cfg-migrateUri;
 const char *listenAddress = cfg-migrationAddress;
 char *origname = NULL;
 int ret = -1;
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] Prevent guest be paused when do external system checkpoint snapshot

2014-05-14 Thread Shanzhi Yu
https://bugzilla.redhat.com/show_bug.cgi?id=1097503

Guest will be paused when do external system checkpoint snapshot with
invalid compression format.

Signed-off-by: Shanzhi Yu s...@redhat.com
---
 src/qemu/qemu_driver.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a5c7f4f..0761760 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13207,13 +13207,13 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr 
conn,
 virReportError(VIR_ERR_OPERATION_FAILED, %s,
_(Invalid snapshot image format specified 
  in configuration file));
-goto cleanup;
+goto endjob;
 }
 if (!qemuCompressProgramAvailable(compressed)) {
 virReportError(VIR_ERR_OPERATION_FAILED, %s,
_(Compression program for image format 
  in configuration file isn't available));
-goto cleanup;
+goto endjob;
 }
 }
 
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] qemu: snapshot: Terminate job when memory compression program isn't found

2014-05-14 Thread Peter Krempa
If the compression program for external snapshot memory image isn't
found we exitted the function without terminating the domain job. This
caused the domain to be unusable.

The problem was introduced in commit 7df5093f.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1097503
---
 src/qemu/qemu_driver.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a5c7f4f..52ca47c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13207,13 +13207,14 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr 
conn,
 virReportError(VIR_ERR_OPERATION_FAILED, %s,
_(Invalid snapshot image format specified 
  in configuration file));
-goto cleanup;
+goto endjob;
 }
+
 if (!qemuCompressProgramAvailable(compressed)) {
 virReportError(VIR_ERR_OPERATION_FAILED, %s,
_(Compression program for image format 
  in configuration file isn't available));
-goto cleanup;
+goto endjob;
 }
 }

-- 
1.9.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] Don't log an internal error when the guest hasn't updated balloon stats

2014-05-14 Thread Ján Tomko
If virDomainMemoryStats is called too soon after domain startup,
QEMU returns:
error:{class:GenericError,desc:guest hasn't updated any stats yet}
when we try to query balloon stats.

Check for this reply and log it as OPERATION_INVALID instead of
INTERNAL_ERROR. This means the daemon only logs it at the debug level,
without polluting system logs.

Reported by Laszlo Pal:
https://www.redhat.com/archives/libvirt-users/2014-May/msg00023.html
---
 src/qemu/qemu_monitor_json.c | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index f8ab975..88f6b6c 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -1460,26 +1460,38 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon,
 goto cleanup;
 
 if (!(cmd = qemuMonitorJSONMakeCommand(qom-get,
s:path, balloonpath,
s:property, guest-stats,
NULL)))
 goto cleanup;
 
 ret = qemuMonitorJSONCommand(mon, cmd, reply);
 
-if (ret == 0)
-ret = qemuMonitorJSONCheckError(cmd, reply);
-
 if (ret  0)
 goto cleanup;
 
+if ((data = virJSONValueObjectGet(reply, error))) {
+const char *klass = virJSONValueObjectGetString(data, class);
+const char *desc = virJSONValueObjectGetString(data, desc);
+
+if (STREQ_NULLABLE(klass, GenericError) 
+STREQ_NULLABLE(desc, guest hasn't updated any stats yet)) {
+virReportError(VIR_ERR_OPERATION_INVALID, %s,
+   _(the guest hasn't updated any stats yet));
+ret = -1;
+goto cleanup;
+}
+}
+
+ret = qemuMonitorJSONCheckError(cmd, reply);
+
 if (!(data = virJSONValueObjectGet(reply, return))) {
 virReportError(VIR_ERR_INTERNAL_ERROR, %s,
_(qom-get reply was missing return data));
 goto cleanup;
 }
 
 if (!(statsdata = virJSONValueObjectGet(data, stats))) {
 VIR_DEBUG(data does not include 'stats');
 goto cleanup;
 }
-- 
1.8.3.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 1/4] conf: use typedefs for enums in src/conf/{node_device_conf, nwfilter_params}.h

2014-05-14 Thread Christophe Fergeau
On Mon, May 12, 2014 at 04:49:39PM -0600, Eric Blake wrote:
 On 05/12/2014 03:32 PM, Eric Blake wrote:
 
 Another helpful action: when resending an updated patch, use 'git
 send-email --subject-prefix=PATCHv2' to make it obvious in the subject
 line that it is a resend, 

-v2 does the same and is less typing ;)

Christophe

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] qemu: snapshot: Terminate job when memory compression program isn't found

2014-05-14 Thread Jiri Denemark
On Wed, May 14, 2014 at 09:50:16 +0200, Peter Krempa wrote:
 If the compression program for external snapshot memory image isn't
 found we exitted the function without terminating the domain job. This
 caused the domain to be unusable.
 
 The problem was introduced in commit 7df5093f.
 
 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1097503
 ---
  src/qemu/qemu_driver.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

ACK

Jirka

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] qemu: snapshot: Terminate job when memory compression program isn't found

2014-05-14 Thread Peter Krempa
On 05/14/14 10:15, Jiri Denemark wrote:
 On Wed, May 14, 2014 at 09:50:16 +0200, Peter Krempa wrote:
 If the compression program for external snapshot memory image isn't
 found we exitted the function without terminating the domain job. This
 caused the domain to be unusable.

 The problem was introduced in commit 7df5093f.

 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1097503
 ---
  src/qemu/qemu_driver.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
 
 ACK
 
 Jirka
 

Pushed; Thanks.

Peter



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [RFC] require for suggestions on support for ivshmem device

2014-05-14 Thread Wangrui (K)
Hi,

Libvirt does not support ivshmem(Inter-VM Shared Memory) device recently, 
thus, I would like to know if there's any plan to support it in the future?
If not, I would like to contribute a serial of patches to do so.

On Jan 28, Wangyufei (James) asked about this question, and Daniel replied with 
2 suggestions:
1. Libvirt should be capable of configuring the guest's xml on ivshmem.
2.An ivshmem daemon is needed to run on the host to support it, libvirt is 
recommended to provide such a daemon.
Please refer to  
https://www.redhat.com/archives/libvir-list/2014-January/msg01335.html for 
details.

What I'll do later is the 1st suggestion, the 2nd one is left to be 
accomplished by someone else.

Here is the detailed work I'll do to support configuration of the guest in 
libvirt:
virDomainDefParseXML: parse ivshmem device xml when defining 
dom.xml
virDomainDeviceInfoIterateInternal:   iterate ivshmem devices
qemuAssignDevicePCISlots:  assign ivshmem device pci slots
virDomainDefFormatInternal: format ivshmem device xml (Eg. virsh 
edit dom)
virDomainDefFree: free ivshmem device def

qemuBuildCommandLine:   build ivshmem device command line when vm 
starts
qemuAssignDeviceAliases:  assign ivshmem device aliases when vm 
starts

virDomainDeviceDefParse:   attach and parse ivshmem device xml
qemuDomainAttachDeviceConfig: attach ivshmem device xml persistently
qemuDomainAttachDeviceLive:   attach ivshmem device online

qemuDomainDetachDeviceConfig: detach ivshmem device xml persistently
qemuDomainDetachDeviceLive:   detach ivshmem device online


There are two ways to use ivshmem with qemu 
(please refer to http://qemu.weilnetz.de/qemu-doc.html#pcsys_005fother_005fdevs 
):
1.Guests map a POSIX shared memory region into the guest as a PCI device
that enables zero-copy communication to the application level of the guests, 
The basic syntax is:

  qemu-system-i386-device ivshmem, size = size in format accepted by -m [, 
shm = shm name] 

2.If desired, interrupts can be sent between guest VMs accessing the same 
shared memory region.
Interrupt support requires using a shared memory server and using a chardev 
socket to connect to it. 
An example syntax when using the shared memory server is: 

  qemu-system-i386-device ivshmem, size = size in format accepted by -m [, 
chardev = id] [, msi = on]
   [, ioeventfd = on] [, vectors = n] [, role = 
peer | master] 
  qemu-system-i386-chardev socket, path = path, id = id

The respective xml configuration for the above 2 qemu command lines are shown 
as below:

Example1: automatically attach device with KVM

  devices
ivshmem role='master'
  memory name='dom-ivshmem' size='2'/
/ivshmem
  /devices

NOTE: size means ivshmem size in unit MB, name means shm name
  role is optional, it may be set to master or peer, the default one 
is master

Example2: manually attach device with static PCI slot 4 requested 

  devices
ivshmem role='master'
  memory name='dom-ivshmem' size='2'/
  address type='pci' domain='0x' bus='0x00' slot='0x04' 
function='0x0'/
/ivshmem
  /devices

Example3: automatically attach device with KVM

  devices
ivshmem role='master' type='unix'
  source mode='connect' path='/tmp/ivshmem'/
  memory name='dom-ivshmem' size='2'/
/ivshmem
  /devices

NOTE: path means shared memory socket path which is set by the daemon.
   source mode  and type is similar with vmchannel.


I'm looking forward to your suggestions, thank you very much.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 1/3] qemu: Make qemuDomainObjBeginNestedJob static

2014-05-14 Thread Peter Krempa
On 05/13/14 15:44, Jiri Denemark wrote:
 It's only used within qemu_domain.c.
 
 Signed-off-by: Jiri Denemark jdene...@redhat.com
 ---
  src/qemu/qemu_domain.c | 2 +-
  src/qemu/qemu_domain.h | 4 
  2 files changed, 1 insertion(+), 5 deletions(-)
 

ACK,

Peter




signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 2/3] qemuDomainObjBeginNestedJob: Return -2 for temporary failures

2014-05-14 Thread Peter Krempa
On 05/13/14 15:44, Jiri Denemark wrote:
 If job queue is full or waiting for a job times out, the function
 returns -2 so that it can be handled in a different way by callers.
 
 The change is safe since all existing callers of

There's just one :)

 qemuDomainObjBeginNestedJob check the return value to be less than zero.
 
 Signed-off-by: Jiri Denemark jdene...@redhat.com
 ---
  src/qemu/qemu_domain.c | 29 -
  1 file changed, 20 insertions(+), 9 deletions(-)
 

ACK,

Peter




signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] network: Defer online of macvtap during qemu migration

2014-05-14 Thread Laine Stump
On 05/14/2014 08:19 AM, Wangrui (K) wrote:

 -Original Message-
 From: sendmail [mailto:justsendmailnothinge...@gmail.com] On Behalf Of
 Laine Stump
 Sent: Tuesday, May 13, 2014 10:11 PM
 To: Matthew Rosato; libvir-list@redhat.com
 Cc: Wangrui (K)
 Subject: Re: [libvirt] [PATCH] network: Defer online of macvtap during qemu
 migration

 On 05/13/2014 04:31 PM, Matthew Rosato wrote:
 On 05/05/2014 12:33 PM, Matthew Rosato wrote:
 On 05/05/2014 12:26 PM, Matthew Rosato wrote:
 When generating macvtaps via
 virNetDevMacVLanCreateWithVPortProfile,
 the macvtap device is unconditionally set to the up state.  However,
 during migration, this results in a case where both the source and
 target system are simultaneously up with the same MAC address.  This
 patch defers bringing the target macvtap up until later in the
 migration to shrink this window.

 Signed-off-by: Matthew Rosato mjros...@linux.vnet.ibm.com
 Forgot to mention that this patch is associated with what Wangrui
 reported here:

 http://www.redhat.com/archives/libvir-list/2014-March/msg01054.html

 and follows Viktor's suggested solution mentioned here:

 http://www.redhat.com/archives/libvir-list/2014-March/msg01654.html


 Ping.
 Thanks for fix the issue that I reported.
 I think it can be considered that all types of netdevs are brought up until 
 migration finish, not only macvtap.

Good idea! Although not necessary for any functional reason, that does
sound like a nice simplification of the code, similar to my idea
(mis-stated below) that this delay in bringing up the devices can be
done *any time* a guest is being brought up, not just when a guest is
being brought up as the destination of a migration. The fewer special
cases we have, 1) the fewer chances there will be for mistakes in logic,
and 2) the easier it will be to split the network device code out from
the hypervisor driver and make a separate public API for it so that an
unprivileged libvirt can take advantage of network device types that
require privileged libvirt.


 Review coming up. Sorry for the delay. (I'm looking to see if the fix
 can be simplified to bring up the macvtap interfaces *always*, rather
 than just during migration.)

 BTW, there is an open BZ for this:

 https://bugzilla.redhat.com/show_bug.cgi?id=1081461


 I haven't seen the open BZ until Laine mentioned.
 Next time I will search the open BZs before report a new issue.

Actually, you originally reported the issue before David filed the BZ
:-) It was due to your earlier report on the mailing list that I
immediately recognized his problem when he asked about it on IRC, and
told him that's been reported before; you should file a BZ to make sure
we take care of it.


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 3/3] qemu: Ignore temporary job errors when checking migration status

2014-05-14 Thread Peter Krempa
On 05/13/14 15:44, Jiri Denemark wrote:
 When qemu driver is polling for migration to finish (in
 qemuMigrationWaitForCompletion), it may happen that another job allowed
 during migration is running and if it does not finish within 30 seconds,
 migration would be cancelled because of that. However, we can just
 ignore the timeout and let the waiting loop try again later.
 
 If an event fired at the end of migration is ever implemented in QEMU,
 we can just wait for the event instead of polling for migration status
 and libvirt will behave consistently, i.e., migration won't be cancelled
 in case another job started during migration takes long time to finish.
 
 For bug https://bugzilla.redhat.com/show_bug.cgi?id=1083238
 
 Signed-off-by: Jiri Denemark jdene...@redhat.com
 ---
  src/qemu/qemu_domain.c| 10 ++
  src/qemu/qemu_migration.c |  7 ---
  2 files changed, 10 insertions(+), 7 deletions(-)
 

The code in this patch looks good, but while inspecting the callers of
qemuDomainObjEnterMonitorAsync I found two other places that store the
value of the call and then possibly return it. I think that
qemuProcessStartCPUs() and qemuProcessStopCPUs() should convert the
value back to -2 so that we don't have to make sure that everything
deals okay with that.

Peter



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] Prevent guest be paused when do external system checkpoint snapshot

2014-05-14 Thread Peter Krempa
On 05/14/14 09:40, Shanzhi Yu wrote:
 https://bugzilla.redhat.com/show_bug.cgi?id=1097503
 
 Guest will be paused when do external system checkpoint snapshot with
 invalid compression format.
 
 Signed-off-by: Shanzhi Yu s...@redhat.com
 ---
  src/qemu/qemu_driver.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

I've already pushed:

commit 71802685ba49a80326d69fd446d2f25844526ba8
Author: Peter Krempa pkre...@redhat.com
Date:   Wed May 14 09:43:52 2014 +0200

qemu: snapshot: Terminate job when memory compression program isn't
found

that fixes the same issue.

Peter





signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] Don't log an internal error when the guest hasn't updated balloon stats

2014-05-14 Thread Nehal J Wani
On Wed, May 14, 2014 at 1:19 PM, Ján Tomko jto...@redhat.com wrote:
 If virDomainMemoryStats is called too soon after domain startup,
 QEMU returns:
 error:{class:GenericError,desc:guest hasn't updated any stats yet}
 when we try to query balloon stats.

 Check for this reply and log it as OPERATION_INVALID instead of
 INTERNAL_ERROR. This means the daemon only logs it at the debug level,
 without polluting system logs.

 Reported by Laszlo Pal:
 https://www.redhat.com/archives/libvirt-users/2014-May/msg00023.html
 ---
  src/qemu/qemu_monitor_json.c | 18 +++---
  1 file changed, 15 insertions(+), 3 deletions(-)


ACK

-- 
Nehal J Wani

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] qemu: Fix specifying char devs for PPC

2014-05-14 Thread Olivia Yin
QEMU ppce500 board uses the old style -serial options.

Other PPC boards don't give any way to explicitly wire in a -chardev
except pseries which uses -device spapr-vty with -chardev.

---
 src/qemu/qemu_capabilities.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index b491f58..fe5dd19 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3460,13 +3460,17 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def,
 !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
 return false;
 
-if ((def-os.arch != VIR_ARCH_ARMV7L)  (def-os.arch != 
VIR_ARCH_AARCH64))
+if ((def-os.arch != VIR_ARCH_ARMV7L)  (def-os.arch != VIR_ARCH_AARCH64)
+ (def-os.arch != VIR_ARCH_PPC)  (def-os.arch != VIR_ARCH_PPC64))
 return true;
 
 /* This may not be true for all ARM machine types, but at least
  * the only supported non-virtio serial devices of vexpress and versatile
- * don't have the -chardev property wired up. */
+ * don't have the -chardev property wired up.
+ * For PPC machines, only pserial need -device spapr-vty with -chardev */
 return (chr-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO ||
 (chr-deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE 
- chr-targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO));
+ chr-targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) ||
+(chr-deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL 
+ chr-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO));
 }
-- 
1.8.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2.5/3] qemu: Make qemuProcess{Start, Stop}CPUs easier to follow

2014-05-14 Thread Jiri Denemark
As a side effect, the return value of qemuDomainObjEnterMonitorAsync is
not directly used as the return value of qemuProcess{Start,Stop}CPUs.

Signed-off-by: Jiri Denemark jdene...@redhat.com
---
 src/qemu/qemu_process.c | 53 +++--
 1 file changed, 29 insertions(+), 24 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 606478e..a83780f 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2747,23 +2747,26 @@ qemuProcessStartCPUs(virQEMUDriverPtr driver, 
virDomainObjPtr vm,
 }
 VIR_FREE(priv-lockState);
 
-ret = qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob);
-if (ret == 0) {
-ret = qemuMonitorStartCPUs(priv-mon, conn);
-qemuDomainObjExitMonitor(driver, vm);
-}
+if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob)  0)
+goto release;
 
-if (ret == 0) {
-virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, reason);
-} else {
-if (virDomainLockProcessPause(driver-lockManager, vm, 
priv-lockState)  0)
-VIR_WARN(Unable to release lease on %s, vm-def-name);
-VIR_DEBUG(Preserving lock state '%s', NULLSTR(priv-lockState));
-}
+ret = qemuMonitorStartCPUs(priv-mon, conn);
+qemuDomainObjExitMonitor(driver, vm);
+
+if (ret  0)
+goto release;
+
+virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, reason);
 
  cleanup:
 virObjectUnref(cfg);
 return ret;
+
+ release:
+if (virDomainLockProcessPause(driver-lockManager, vm, priv-lockState)  
0)
+VIR_WARN(Unable to release lease on %s, vm-def-name);
+VIR_DEBUG(Preserving lock state '%s', NULLSTR(priv-lockState));
+goto cleanup;
 }
 
 
@@ -2771,24 +2774,26 @@ int qemuProcessStopCPUs(virQEMUDriverPtr driver, 
virDomainObjPtr vm,
 virDomainPausedReason reason,
 enum qemuDomainAsyncJob asyncJob)
 {
-int ret;
+int ret = -1;
 qemuDomainObjPrivatePtr priv = vm-privateData;
 
 VIR_FREE(priv-lockState);
 
-ret = qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob);
-if (ret == 0) {
-ret = qemuMonitorStopCPUs(priv-mon);
-qemuDomainObjExitMonitor(driver, vm);
-}
+if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob)  0)
+goto cleanup;
 
-if (ret == 0) {
-virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, reason);
-if (virDomainLockProcessPause(driver-lockManager, vm, 
priv-lockState)  0)
-VIR_WARN(Unable to release lease on %s, vm-def-name);
-VIR_DEBUG(Preserving lock state '%s', NULLSTR(priv-lockState));
-}
+ret = qemuMonitorStopCPUs(priv-mon);
+qemuDomainObjExitMonitor(driver, vm);
 
+if (ret  0)
+goto cleanup;
+
+virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, reason);
+if (virDomainLockProcessPause(driver-lockManager, vm, priv-lockState)  
0)
+VIR_WARN(Unable to release lease on %s, vm-def-name);
+VIR_DEBUG(Preserving lock state '%s', NULLSTR(priv-lockState));
+
+ cleanup:
 return ret;
 }
 
-- 
1.9.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 3/3] qemu: Ignore temporary job errors when checking migration status

2014-05-14 Thread Jiri Denemark
On Wed, May 14, 2014 at 11:08:28 +0200, Peter Krempa wrote:
 On 05/13/14 15:44, Jiri Denemark wrote:
  When qemu driver is polling for migration to finish (in
  qemuMigrationWaitForCompletion), it may happen that another job allowed
  during migration is running and if it does not finish within 30 seconds,
  migration would be cancelled because of that. However, we can just
  ignore the timeout and let the waiting loop try again later.
  
  If an event fired at the end of migration is ever implemented in QEMU,
  we can just wait for the event instead of polling for migration status
  and libvirt will behave consistently, i.e., migration won't be cancelled
  in case another job started during migration takes long time to finish.
  
  For bug https://bugzilla.redhat.com/show_bug.cgi?id=1083238
  
  Signed-off-by: Jiri Denemark jdene...@redhat.com
  ---
   src/qemu/qemu_domain.c| 10 ++
   src/qemu/qemu_migration.c |  7 ---
   2 files changed, 10 insertions(+), 7 deletions(-)
  
 
 The code in this patch looks good, but while inspecting the callers of
 qemuDomainObjEnterMonitorAsync I found two other places that store the
 value of the call and then possibly return it. I think that
 qemuProcessStartCPUs() and qemuProcessStopCPUs() should convert the
 value back to -2 so that we don't have to make sure that everything
 deals okay with that.

Oops, I somehow overlooked these two instances. New patch 2.5/3 should
fix them.

Jirka

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 2.5/3] qemu: Make qemuProcess{Start, Stop}CPUs easier to follow

2014-05-14 Thread Peter Krempa
On 05/14/14 13:29, Jiri Denemark wrote:
 As a side effect, the return value of qemuDomainObjEnterMonitorAsync is
 not directly used as the return value of qemuProcess{Start,Stop}CPUs.
 
 Signed-off-by: Jiri Denemark jdene...@redhat.com
 ---
  src/qemu/qemu_process.c | 53 
 +++--
  1 file changed, 29 insertions(+), 24 deletions(-)
 

ACK,

Peter




signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 3/3] qemu: Ignore temporary job errors when checking migration status

2014-05-14 Thread Peter Krempa
On 05/14/14 13:30, Jiri Denemark wrote:
 On Wed, May 14, 2014 at 11:08:28 +0200, Peter Krempa wrote:
 On 05/13/14 15:44, Jiri Denemark wrote:
 When qemu driver is polling for migration to finish (in
 qemuMigrationWaitForCompletion), it may happen that another job allowed
 during migration is running and if it does not finish within 30 seconds,
 migration would be cancelled because of that. However, we can just
 ignore the timeout and let the waiting loop try again later.

 If an event fired at the end of migration is ever implemented in QEMU,
 we can just wait for the event instead of polling for migration status
 and libvirt will behave consistently, i.e., migration won't be cancelled
 in case another job started during migration takes long time to finish.

 For bug https://bugzilla.redhat.com/show_bug.cgi?id=1083238

 Signed-off-by: Jiri Denemark jdene...@redhat.com
 ---
  src/qemu/qemu_domain.c| 10 ++
  src/qemu/qemu_migration.c |  7 ---
  2 files changed, 10 insertions(+), 7 deletions(-)


 The code in this patch looks good, but while inspecting the callers of
 qemuDomainObjEnterMonitorAsync I found two other places that store the
 value of the call and then possibly return it. I think that
 qemuProcessStartCPUs() and qemuProcessStopCPUs() should convert the
 value back to -2 so that we don't have to make sure that everything
 deals okay with that.
 
 Oops, I somehow overlooked these two instances. New patch 2.5/3 should
 fix them.

Yep, ACK to this patch as 2.5 fixes the stuff.


 
 Jirka
 

Peter




signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCHv4 1/3] Introduce virDomain{Get,Set}Time APIs

2014-05-14 Thread Ján Tomko
On 05/07/2014 10:19 AM, Michal Privoznik wrote:
 These APIs allow users to get or set time in a domain, which may come
 handy if the domain has been resumed just recently and NTP is not
 configured or hasn't kicked in yet and the guest is running
 something time critical. In addition, NTP may refuse to re-set the clock
 if the skew is too big.
 
 In addition, new ACL attribute is introduced 'set_time'.
 
 Signed-off-by: Michal Privoznik mpriv...@redhat.com
 ---
  daemon/remote.c  | 37 +
  include/libvirt/libvirt.h.in | 14 +++
  src/access/viraccessperm.c   |  2 +-
  src/access/viraccessperm.h   |  7 +++-
  src/driver.h | 14 +++
  src/libvirt.c| 94 
 
  src/libvirt_public.syms  |  2 +
  src/remote/remote_driver.c   | 35 +
  src/remote/remote_protocol.x | 31 ++-
  src/remote_protocol-structs  | 16 
  10 files changed, 249 insertions(+), 3 deletions(-)
 

ACK

Jan




signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCHv4 3/3] qemu: Implement virDomain{Get,Set}Time

2014-05-14 Thread Ján Tomko
On 05/07/2014 10:19 AM, Michal Privoznik wrote:
 One caveat though, qemu-ga is expecting time and returning time
 in nanoseconds. With all the buffering and propagation delay, the
 time is already wrong once it gets to the qemu-ga, but there's
 nothing we can do about it.
 
 Signed-off-by: Michal Privoznik mpriv...@redhat.com
 ---
  src/qemu/qemu_agent.c  |  99 
  src/qemu/qemu_agent.h  |   8 
  src/qemu/qemu_driver.c | 109 
 +
  3 files changed, 216 insertions(+)

Jan

 
 diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
 index 4082331..80a820e 100644
 --- a/src/qemu/qemu_agent.c
 +++ b/src/qemu/qemu_agent.c
 @@ -1646,3 +1646,102 @@ qemuAgentUpdateCPUInfo(unsigned int nvcpus,
  
  return 0;
  }
 +
 +
 +int
 +qemuAgentGetTime(qemuAgentPtr mon,
 + long long *seconds,
 + unsigned int *nseconds)
 +{
 +int ret = -1;
 +unsigned long long json_time;
 +virJSONValuePtr cmd;
 +virJSONValuePtr reply = NULL;
 +
 +cmd = qemuAgentMakeCommand(guest-get-time,
 +   NULL);
 +if (!cmd)
 +return ret;
 +
 +if (qemuAgentCommand(mon, cmd, reply, true,
 + VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK)  0)
 +goto cleanup;
 +

 +if (!reply || qemuAgentCheckError(cmd, reply)  0)
 +goto cleanup;
 +

Here too.

 +if (virJSONValueObjectGetNumberUlong(reply, return, json_time)  0) {
 +virReportError(VIR_ERR_INTERNAL_ERROR, %s,
 +   _(malformed return value));
 +goto cleanup;
 +}
 +

...

 +
 +
 +/**
 + * qemuAgentSetTime:
 + * @setTime: time to set
 + * @sync: let guest agent to read domain's RTC (@setTime is ignored)
 + */
 +int
 +qemuAgentSetTime(qemuAgentPtr mon,
 +long long seconds,
 +unsigned int nseconds,
 +bool sync)
 +{
 +int ret = -1;
 +virJSONValuePtr cmd;
 +virJSONValuePtr reply = NULL;
 +

...

 +
 +if (!cmd)
 +return ret;
 +
 +if (qemuAgentCommand(mon, cmd, reply, true,
 + VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK)  0)
 +goto cleanup;
 +

 +if (!reply || qemuAgentCheckError(cmd, reply)  0)
 +goto cleanup;

This should be checked by qemuAgentCommand already.

 +
 +ret = 0;
 + cleanup:
 +virJSONValueFree(cmd);
 +virJSONValueFree(reply);
 +return ret;
 +}

 @@ -16717,6 +16824,8 @@ static virDriver qemuDriver = {
  .domainMigrateFinish3Params = qemuDomainMigrateFinish3Params, /* 1.1.0 */
  .domainMigrateConfirm3Params = qemuDomainMigrateConfirm3Params, /* 1.1.0 
 */
  .connectGetCPUModelNames = qemuConnectGetCPUModelNames, /* 1.1.3 */
 +.domainGetTime = qemuDomainGetTime, /* 1.2.4 */
 +.domainSetTime = qemuDomainSetTime, /* 1.2.4 */

1.2.5

  };
  
  
 



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCHv4 2/3] virsh: Expose virDomain{Get,Set}Time

2014-05-14 Thread Ján Tomko
On 05/07/2014 10:19 AM, Michal Privoznik wrote:
 These APIs are exposed under new virsh command 'domtime' which both gets
 and sets (not at the same time of course :)).
 
 Signed-off-by: Michal Privoznik mpriv...@redhat.com
 ---
  tools/virsh-domain-monitor.c | 132 
 +++
  tools/virsh.pod  |  16 ++
  2 files changed, 148 insertions(+)
 
 diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
 index 18d551a..31fa8de 100644
 --- a/tools/virsh-domain-monitor.c
 +++ b/tools/virsh-domain-monitor.c
 @@ -1356,6 +1356,132 @@ cmdDomstate(vshControl *ctl, const vshCmd *cmd)
  }
  
  /*
 + * domtime command
 + */
 +static const vshCmdInfo info_domtime[] = {
 +{.name = help,
 + .data = N_(domain time)
 +},
 +{.name = desc,
 + .data = N_(Gets or sets a domain time)

s/a domain time/the domain's system time/ would be more accurate IMO
or even 'the domain time'

 +},
 +{.name = NULL}
 +};
 +
 +static const vshCmdOptDef opts_domtime[] = {
 +{.name = domain,
 + .type = VSH_OT_DATA,
 + .flags = VSH_OFLAG_REQ,
 + .help = N_(domain name, id or uuid)
 +},
 +{.name = now,
 + .type = VSH_OT_BOOL,
 + .help = N_(set current host time)

We are setting the guest's time, not the host's time.
How about 'set to the time of the host running virsh'? :)


 +},
 +{.name = pretty,
 + .type = VSH_OT_BOOL,
 + .help = N_(print domain's time in human readable form)
 +},
 +{.name = sync,
 + .type = VSH_OT_BOOL,
 + .help = N_(instead of setting given time, synchronize from domain's 
 RTC),
 +},
 +{.name = time,
 + .type = VSH_OT_INT,
 + .help = N_(time to set)
 +},
 +{.name = NULL}
 +};
 +
 +static bool
 +cmdDomTime(vshControl *ctl, const vshCmd *cmd)
 +{
 +virDomainPtr dom;
 +bool ret = false;
 +bool now = vshCommandOptBool(cmd, now);
 +bool pretty = vshCommandOptBool(cmd, pretty);
 +bool sync = vshCommandOptBool(cmd, sync);
 +long long seconds = 0;
 +unsigned int nseconds = 0;
 +unsigned int flags = 0;
 +bool doSet = false;
 +int rv;
 +
 +if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
 +return false;
 +
 +rv = vshCommandOptLongLong(cmd, time, seconds);
 +
 +if (rv  0) {
 +/* invalid integer format */
 +vshError(ctl, %s,
 + _(Unable to parse integer parameter to --time.));
 +goto cleanup;
 +} else if (rv  0) {

 +/* --time is used, so set time instead of get time.
 + * However, --time and --now are mutually exclusive. */
 +if (now) {
 +vshError(ctl, _(--time and --now are mutually exclusive));
 +goto cleanup;
 +}
 +
 +/* Neither is --time and --sync */
 +if (sync) {
 +vshError(ctl, _(--time and --sync are mutually exclusive));
 +goto cleanup;
 +
 +}

You can use the VSH_EXCLUSIVE_OPTIONS macros for these checks.

 +doSet = true;
 +}
 +
 +if (sync  now) {
 +vshError(ctl, _(--sync and --now are mutually exclusive));
 +goto cleanup;
 +}
 +

 +/* --now or --sync means setting */
 +doSet |= now | sync;

how about using doSet || now || sync in the if condition?

 +
 +if (doSet) {
 +if (now  ((seconds = time(NULL)) == (time_t) -1)) {
 +vshError(ctl, _(Unable to get current time));
 +goto cleanup;
 +}
 +
 +if (sync)
 +flags |= VIR_DOMAIN_TIME_SYNC;
 +
 +if (virDomainSetTime(dom, seconds, nseconds, flags)  0)
 +goto cleanup;
 +
 +} else {
 +if (virDomainGetTime(dom, seconds, nseconds, flags)  0)
 +goto cleanup;
 +
 +if (pretty) {
 +char timestr[100];
 +time_t cur_time = seconds;
 +struct tm time_info;
 +
 +if (!gmtime_r(cur_time, time_info)) {
 +vshError(ctl, _(Unable to format time));
 +goto cleanup;
 +}
 +strftime(timestr, sizeof(timestr), %Y-%m-%d %H:%M:%S, 
 time_info);
 +
 +vshPrint(ctl, _(Time: %s), timestr);
 +} else {
 +vshPrint(ctl, _(Time: %lld), seconds);
 +}
 +}
 +
 +ret = true;
 + cleanup:
 +virDomainFree(dom);
 +return ret;
 +}
 +
 +/*
   * list command
   */
  static const vshCmdInfo info_list[] = {
 @@ -1911,6 +2037,12 @@ const vshCmdDef domMonitoringCmds[] = {
   .info = info_domstate,
   .flags = 0
  },
 +{.name = domtime,
 + .handler = cmdDomTime,
 + .opts = opts_domtime,
 + .info = info_domtime,
 + .flags = 0
 +},
  {.name = list,
   .handler = cmdList,
   .opts = opts_list,
 diff --git a/tools/virsh.pod b/tools/virsh.pod
 index 9104804..623f94d 100644
 --- a/tools/virsh.pod
 +++ b/tools/virsh.pod
 @@ -994,6 +994,22 @@ Returns state of an interface to VMM used to control a 
 

Re: [libvirt] [PATCH 1/4] conf: use typedefs for enums in src/conf/{node_device_conf, nwfilter_params}.h

2014-05-14 Thread Eric Blake
On 05/14/2014 02:13 AM, Christophe Fergeau wrote:
 On Mon, May 12, 2014 at 04:49:39PM -0600, Eric Blake wrote:
 On 05/12/2014 03:32 PM, Eric Blake wrote:

 Another helpful action: when resending an updated patch, use 'git
 send-email --subject-prefix=PATCHv2' to make it obvious in the subject
 line that it is a resend, 
 
 -v2 does the same and is less typing ;)

Wow, learned something new.

[I _hate_ that 'git send-email --help' does NOT document the options
that it inherits from 'git format-patch']

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 2/4] conf: use typedefs for enums in src/conf/nwfilter_conf.h

2014-05-14 Thread Eric Blake
On 05/11/2014 09:08 AM, Julio Faracco wrote:
 In src/conf/ there are many enumeration (enum) declarations. Similar to the 
 recent cleanup to src/util directory, it's better to use a typedef for 
 variable types, function types and other usages. Other enumeration and 
 folders will be changed to typedef's in the future. Most of the files changed 
 in this commit are related to network filter (nwfilter_conf) enums.

Rewrapped,

 
 Signed-off-by: Julio Faracco jcfara...@gmail.com
 Signed-off-by: Eric Blake ebl...@redhat.com
 ---
  src/conf/nwfilter_conf.c |8 
  src/conf/nwfilter_conf.h |   44 ++--
  2 files changed, 26 insertions(+), 26 deletions(-)

ACK and applied.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] submitted patch, don't see in pending.

2014-05-14 Thread vikhyath reddy
Hi all,

I had a question regarding submitting patches for libvirt. I submitted a
hyperv patch about two weeks back using the tips mentioned in

http://libvirt.org/hacking.html#patches

using

git send-email


But I dont see the patch in the pending list at
http://libvirt.org/pending.html

(Is there something I missed or something failed to work as expected) OR
(is the pending list not real time)?

Thanks guys for all your help!
Vik.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 3/4] conf: use typedefs for enums in src/conf/storage_conf.h

2014-05-14 Thread Eric Blake
On 05/11/2014 09:08 AM, Julio Faracco wrote:
 In src/conf/ there are many enumeration (enum) declarations. Similar to the 
 recent cleanup to src/util directory, it's better to use a typedef for 
 variable types, function types and other usages. Other enumeration and 
 folders will be changed to typedef's in the future. Most of the files changed 
 in this commit are related to storage (storage_conf) enums.

Rewrapped,

 
 Signed-off-by: Julio Faracco jcfara...@gmail.com
 Signed-off-by: Eric Blake ebl...@redhat.com
 ---
  src/conf/storage_conf.h  |   48 
 +-
  src/qemu/qemu_conf.c |2 +-
  src/storage/storage_driver.c |4 ++--
  tools/virsh-pool.c   |2 +-
  4 files changed, 28 insertions(+), 28 deletions(-)

I also updated the patch to clean up lots of comments.  (Hmm,
util/virstoragefile.h would be another candidate for a cleanup).

ACK and pushed as amended:

diff --git i/src/conf/domain_conf.h w/src/conf/domain_conf.h
index a92f0f3..63c4577 100644
--- i/src/conf/domain_conf.h
+++ w/src/conf/domain_conf.h
@@ -607,7 +607,7 @@ struct _virDomainDiskDef {
 int removable; /* enum virDomainFeatureState */

 char *mirror;
-int mirrorFormat; /* enum virStorageFileFormat */
+int mirrorFormat; /* virStorageFileFormat */
 bool mirroring;

 struct {
@@ -776,7 +776,7 @@ struct _virDomainFSDef {
 int fsdriver; /* enum virDomainFSDriverType */
 int accessmode; /* enum virDomainFSAccessMode */
 int wrpolicy; /* enum virDomainFSWrpolicy */
-int format; /* enum virStorageFileFormat */
+int format; /* virStorageFileFormat */
 unsigned long long usage; /* in bytes */
 char *src;
 char *dst;
diff --git i/src/conf/storage_conf.h w/src/conf/storage_conf.h
index 8c3bc57..b10d4f2 100644
--- i/src/conf/storage_conf.h
+++ w/src/conf/storage_conf.h
@@ -51,7 +51,7 @@ struct _virStorageVolSource {
 int nextent;
 virStorageVolSourceExtentPtr extents;

-int partType; /* enum virStorageVolTypeDisk, only used by disk
+int partType; /* virStorageVolTypeDisk, only used by disk
* backend for partition type creation */
 };

@@ -61,7 +61,7 @@ typedef virStorageVolDef *virStorageVolDefPtr;
 struct _virStorageVolDef {
 char *name;
 char *key;
-int type; /* enum virStorageVolType */
+int type; /* virStorageVolType */

 unsigned int building;
 unsigned int in_use;
@@ -167,7 +167,7 @@ typedef virStoragePoolSourceDeviceExtent
*virStoragePoolSourceDeviceExtentPtr;
 struct _virStoragePoolSourceDeviceExtent {
 unsigned long long start;
 unsigned long long end;
-int type; /* enum virStorageFreeType */
+int type; /* virStorageFreeType */
 };

 typedef struct _virStoragePoolSourceInitiatorAttr
virStoragePoolSourceInitiatorAttr;
@@ -208,7 +208,7 @@ VIR_ENUM_DECL(virStoragePoolSourceAdapterType)

 typedef struct _virStoragePoolSourceAdapter virStoragePoolSourceAdapter;
 struct _virStoragePoolSourceAdapter {
-int type; /* enum virStoragePoolSourceAdapterType */
+int type; /* virStoragePoolSourceAdapterType */

 union {
 char *name;
@@ -273,7 +273,7 @@ typedef virStoragePoolDef *virStoragePoolDefPtr;
 struct _virStoragePoolDef {
 char *name;
 unsigned char uuid[VIR_UUID_BUFLEN];
-int type; /* enum virStoragePoolType */
+int type; /* virStoragePoolType */

 unsigned long long allocation; /* bytes */
 unsigned long long capacity; /* bytes */
diff --git i/src/util/virstoragefile.h w/src/util/virstoragefile.h
index 6072409..e32389e 100644
--- i/src/util/virstoragefile.h
+++ w/src/util/virstoragefile.h
@@ -150,7 +150,7 @@ typedef virStorageNetHostDef *virStorageNetHostDefPtr;
 struct _virStorageNetHostDef {
 char *name;
 char *port;
-int transport; /* enum virStorageNetHostTransport */
+int transport; /* virStorageNetHostTransport */
 char *socket;  /* path to unix socket */
 };

@@ -182,10 +182,10 @@ typedef struct _virStorageSourcePoolDef
virStorageSourcePoolDef;
 struct _virStorageSourcePoolDef {
 char *pool; /* pool name */
 char *volume; /* volume name */
-int voltype; /* enum virStorageVolType, internal only */
-int pooltype; /* enum virStoragePoolType, internal only */
-int actualtype; /* enum virStorageType, internal only */
-int mode; /* enum virStorageSourcePoolMode */
+int voltype; /* virStorageVolType, internal only */
+int pooltype; /* virStoragePoolType, internal only */
+int actualtype; /* virStorageType, internal only */
+int mode; /* virStorageSourcePoolMode */
 };
 typedef virStorageSourcePoolDef *virStorageSourcePoolDefPtr;

@@ -208,15 +208,15 @@ typedef virStorageSource *virStorageSourcePtr;
  * backing chains, multiple source disks join to form a single guest
  * view.  */
 struct _virStorageSource {
-int type; /* enum virStorageType */
+int type; /* virStorageType */
 char *path;
-int protocol; /* enum virStorageNetProtocol 

Re: [libvirt] submitted patch, don't see in pending.

2014-05-14 Thread Peter Krempa
On 05/14/14 18:08, vikhyath reddy wrote:
 Hi all,

Hi,

 
 I had a question regarding submitting patches for libvirt. I submitted a
 hyperv patch about two weeks back using the tips mentioned in 
 
 http://libvirt.org/hacking.html#patches
 
 using
 
 git send-email
 
 
 But I dont see the patch in the pending list at
 http://libvirt.org/pending.html

I can't find a patch sent from your address or anything regarding hyperv
from a unknown (to me) address on the list. It's possible that the patch
didn't make it to the list.

Please check the mailing list archives at
http://www.redhat.com/archives/libvir-list/ whether the patch is there.
If the patch isn't in the archives it probably wasn't delivered properly.

 
 (Is there something I missed or something failed to work as expected) OR
 (is the pending list not real time)?
 
 Thanks guys for all your help!
 Vik.

Peter





signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] submitted patch, don't see in pending.

2014-05-14 Thread vikhyath reddy
I can't find a patch sent from your address or anything regarding hyperv
from a unknown (to me) address on the list. It's possible that the patch
didn't make it to the list.
Please check the mailing list archives at
http://www.redhat.com/archives/libvir-list/ whether the patch is there.
If the patch isn't in the archives it probably wasn't delivered properly.


Well looks like something went amiss. Will give it another try today.

Thanks guys!
Vik.


On Wed, May 14, 2014 at 9:18 AM, Peter Krempa pkre...@redhat.com wrote:

 On 05/14/14 18:08, vikhyath reddy wrote:
  Hi all,

 Hi,

 
  I had a question regarding submitting patches for libvirt. I submitted a
  hyperv patch about two weeks back using the tips mentioned in
 
  http://libvirt.org/hacking.html#patches
 
  using
 
  git send-email
 
 
  But I dont see the patch in the pending list at
  http://libvirt.org/pending.html

 I can't find a patch sent from your address or anything regarding hyperv
 from a unknown (to me) address on the list. It's possible that the patch
 didn't make it to the list.

 Please check the mailing list archives at
 http://www.redhat.com/archives/libvir-list/ whether the patch is there.
 If the patch isn't in the archives it probably wasn't delivered properly.

 
  (Is there something I missed or something failed to work as expected) OR
  (is the pending list not real time)?
 
  Thanks guys for all your help!
  Vik.

 Peter




--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 4/4] conf: use typedefs for enums in src/conf/snapshot_conf.h

2014-05-14 Thread Eric Blake
On 05/11/2014 09:08 AM, Julio Faracco wrote:
 In src/conf/ there are many enumeration (enum) declarations. Similar to the 
 recent cleanup to src/util directory, it's better to use a typedef for 
 variable types, function types and other usages. Other enumeration and 
 folders will be changed to typedef's in the future. Most of the files changed 
 in this commit are related to snapshot (snapshot_conf) enums.

Wrapped,

 
 Signed-off-by: Julio Faracco jcfara...@gmail.com
 Signed-off-by: Eric Blake ebl...@redhat.com
 ---
  src/conf/snapshot_conf.h |8 
  1 file changed, 4 insertions(+), 4 deletions(-)

ACK and pushed.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] virsh: Return false if only '--wipe-storage' is assigned when undefine a domain

2014-05-14 Thread Eric Blake
On 05/14/2014 12:15 AM, Li Yang wrote:

Long subject line; it's better to keep subject under 60 columns, for the
sake of 'git shortlog' in an 80-column window.  I went with:

virsh: reject undefine --wipe-storage without also naming storage

 For now, if only '--wipe-storage' is assigned, user can undefine a
 domain normally. But actually '--wipe-storage' doesn't work, this

More that it silently does nothing, not that it doesn't work.

 may confuse user. And since '--wipe-storage' wipes data on the
 removed volumes, if no removed volume storage assigned, we'd better
 raise an error message.
 
 Before:
 $ virsh undefine virt-tests-vm1 --wipe-storage
 Domain virt-tests-vm1 has been undefined
 
 After:
 $ virsh undefine virt-tests-vm1 --wipe-storage
 error: '--wipe-storage' needs storage volume deletion: '--stroage string' 
 or '--remove-all-storage' is necessary.

s/stroage/storage/

 
 Signed-off-by: Li Yang liyang.f...@cn.fujitsu.com
 ---
  tools/virsh-domain.c |8 
  1 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
 index 3a7c260..25236a0 100644
 --- a/tools/virsh-domain.c
 +++ b/tools/virsh-domain.c
 @@ -2982,6 +2982,14 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
  
  ignore_value(vshCommandOptString(cmd, storage, vol_string));
  
 +if (!(vol_string || remove_all_storage)  wipe_storage) {
 +vshError(ctl,
 + _('--wipe-storage' needs storage volume deletion: 
 +   '--stroage string' or '--remove-all-storage' 
 +   is necessary.));

We tend to avoid trailing '.' in error messages (although we aren't
consistent).  This is also long-winded and has a typo.

ACK to the idea, so I'm pushing with this modification:

diff --git i/tools/virsh-domain.c w/tools/virsh-domain.c
index a5ddb93..84a6706 100644
--- i/tools/virsh-domain.c
+++ w/tools/virsh-domain.c
@@ -2979,14 +2979,12 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
 size_t i;
 size_t j;

-
 ignore_value(vshCommandOptString(cmd, storage, vol_string));

 if (!(vol_string || remove_all_storage)  wipe_storage) {
 vshError(ctl,
- _('--wipe-storage' needs storage volume deletion: 
-   '--stroage string' or '--remove-all-storage' 
-   is necessary.));
+ _('--wipe-storage' requires '--storage string' or 
+   '--remove-all-storage'));
 return false;
 }



-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 3/3] security_dac: Fix indentation

2014-05-14 Thread Jim Fehlig

Signed-off-by: Jim Fehlig jfeh...@suse.com
---
 src/security/security_dac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 39bd6cb..ed79857 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -750,7 +750,7 @@ virSecurityDACRestoreChardevLabel(virSecurityManagerPtr mgr 
ATTRIBUTE_UNUSED,
 if (virFileExists(in)  virFileExists(out)) {
 if ((virSecurityDACRestoreSecurityFileLabel(out)  0) ||
 (virSecurityDACRestoreSecurityFileLabel(in)  0)) {
-goto done;
+goto done;
 }
 } else if (virSecurityDACRestoreSecurityFileLabel(dev-data.file.path) 
 0) {
 goto done;
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2/3] security_dac: Remove unnecessary curly braces

2014-05-14 Thread Jim Fehlig

Signed-off-by: Jim Fehlig jfeh...@suse.com
---
 src/security/security_dac.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 3dc1504..39bd6cb 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -1042,9 +1042,8 @@ virSecurityDACGenLabel(virSecurityManagerPtr mgr,
 virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
 
 seclabel = virDomainDefGetSecurityLabelDef(def, SECURITY_DAC_NAME);
-if (seclabel == NULL) {
+if (seclabel == NULL)
 return rc;
-}
 
 if (seclabel-imagelabel) {
 virReportError(VIR_ERR_INTERNAL_ERROR, %s,
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/3] security_dac: Remove unnecessary ATTRIBUTE_UNUSED

2014-05-14 Thread Jim Fehlig
Remove ATTRIBUTE_UNUSED on several function parameters that are
actually used.

Signed-off-by: Jim Fehlig jfeh...@suse.com
---
 src/security/security_dac.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 8512767..3dc1504 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -880,7 +880,7 @@ virSecurityDACRestoreSecurityAllLabel(virSecurityManagerPtr 
mgr,
 
 
 static int
-virSecurityDACSetChardevCallback(virDomainDefPtr def ATTRIBUTE_UNUSED,
+virSecurityDACSetChardevCallback(virDomainDefPtr def,
  virDomainChrDefPtr dev,
  void *opaque)
 {
@@ -984,7 +984,7 @@ virSecurityDACRestoreSavedStateLabel(virSecurityManagerPtr 
mgr,
 
 static int
 virSecurityDACSetProcessLabel(virSecurityManagerPtr mgr,
-  virDomainDefPtr def ATTRIBUTE_UNUSED)
+  virDomainDefPtr def)
 {
 uid_t user;
 gid_t group;
@@ -1007,7 +1007,7 @@ virSecurityDACSetProcessLabel(virSecurityManagerPtr mgr,
 
 static int
 virSecurityDACSetChildProcessLabel(virSecurityManagerPtr mgr,
-   virDomainDefPtr def ATTRIBUTE_UNUSED,
+   virDomainDefPtr def,
virCommandPtr cmd)
 {
 uid_t user;
@@ -1119,9 +1119,9 @@ virSecurityDACReserveLabel(virSecurityManagerPtr mgr 
ATTRIBUTE_UNUSED,
 
 static int
 virSecurityDACGetProcessLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
-  virDomainDefPtr def ATTRIBUTE_UNUSED,
+  virDomainDefPtr def,
   pid_t pid ATTRIBUTE_UNUSED,
-  virSecurityLabelPtr seclabel ATTRIBUTE_UNUSED)
+  virSecurityLabelPtr seclabel)
 {
 virSecurityLabelDefPtr secdef =
 virDomainDefGetSecurityLabelDef(def, SECURITY_DAC_NAME);
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 0/3] security_dac: trivial cleanups

2014-05-14 Thread Jim Fehlig
A while back, Michal Privoznik posted a small series to honor the
DAC norelabel attribute

https://www.redhat.com/archives/libvir-list/2014-April/msg00196.html

When reviewing patch 1, Jan Tomko noted that trivial whitespace changes and
the like should be separate from changes to the callback parameter passing.
This small series contains the most trivial changes Michal made to patch 1.
By most trivial, I mean these could probably be pushed under the trivail rule,
but posting for a quick review nonetheless.

Jim Fehlig (3):
  security_dac: Remove unnecessary ATTRIBUTE_UNUSED
  security_dac: Remove unnecessary curly braces
  security_dac: Fix indentation

 src/security/security_dac.c | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 0/3] security_dac: trivial cleanups

2014-05-14 Thread Jim Fehlig
Jim Fehlig wrote:
 A while back, Michal Privoznik posted a small series to honor the
 DAC norelabel attribute

 https://www.redhat.com/archives/libvir-list/2014-April/msg00196.html

 When reviewing patch 1, Jan Tomko noted that trivial whitespace changes and
 the like should be separate from changes to the callback parameter passing.
 This small series contains the most trivial changes Michal made to patch 1.
 By most trivial, I mean these could probably be pushed under the trivail 
 rule,
 but posting for a quick review nonetheless.
   

Forgot to mention, I'm working on a V3 of Michal's series, which I hope
to post in the next day or so.

Regards,
Jim

 Jim Fehlig (3):
   security_dac: Remove unnecessary ATTRIBUTE_UNUSED
   security_dac: Remove unnecessary curly braces
   security_dac: Fix indentation

  src/security/security_dac.c | 15 +++
  1 file changed, 7 insertions(+), 8 deletions(-)

   

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 0/3] security_dac: trivial cleanups

2014-05-14 Thread Peter Krempa
On 05/14/14 19:57, Jim Fehlig wrote:
 A while back, Michal Privoznik posted a small series to honor the
 DAC norelabel attribute
 
 https://www.redhat.com/archives/libvir-list/2014-April/msg00196.html
 
 When reviewing patch 1, Jan Tomko noted that trivial whitespace changes and
 the like should be separate from changes to the callback parameter passing.
 This small series contains the most trivial changes Michal made to patch 1.
 By most trivial, I mean these could probably be pushed under the trivail 
 rule,
 but posting for a quick review nonetheless.
 
 Jim Fehlig (3):
   security_dac: Remove unnecessary ATTRIBUTE_UNUSED
   security_dac: Remove unnecessary curly braces
   security_dac: Fix indentation
 
  src/security/security_dac.c | 15 +++
  1 file changed, 7 insertions(+), 8 deletions(-)
 

ACK series.

Peter




signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 0/3] security_dac: trivial cleanups

2014-05-14 Thread Jim Fehlig
Peter Krempa wrote:
 On 05/14/14 19:57, Jim Fehlig wrote:
   
 A while back, Michal Privoznik posted a small series to honor the
 DAC norelabel attribute

 https://www.redhat.com/archives/libvir-list/2014-April/msg00196.html

 When reviewing patch 1, Jan Tomko noted that trivial whitespace changes and
 the like should be separate from changes to the callback parameter passing.
 This small series contains the most trivial changes Michal made to patch 1.
 By most trivial, I mean these could probably be pushed under the trivail 
 rule,
 but posting for a quick review nonetheless.

 Jim Fehlig (3):
   security_dac: Remove unnecessary ATTRIBUTE_UNUSED
   security_dac: Remove unnecessary curly braces
   security_dac: Fix indentation

  src/security/security_dac.c | 15 +++
  1 file changed, 7 insertions(+), 8 deletions(-)

 

 ACK series.
   

Thanks, pushed.

Regards,
Jim

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 0/4] more enum cleanups

2014-05-14 Thread Eric Blake
Inspired by the cleanups contributed by Julio Faracco, I did some
more cleanups of my own.  My end goal is to turn on a syntax-check
rule that forbids 'enum vir' (since we should always be declaring
'typedef enum { ... } vir...;'), but there's still a lot of
violations in the code base, even after this series.

Eric Blake (4):
  vbox: fix stale comment about vdi storage type
  maint: use enum typedef for virstorageencryption.h
  maint: shorten 'TypeType' function names
  maint: prefer enum over int for virstoragefile structs

 src/conf/domain_conf.c | 14 +++---
 src/conf/domain_conf.h |  2 +-
 src/conf/secret_conf.c |  8 
 src/conf/secret_conf.h |  4 ++--
 src/conf/storage_conf.c| 14 +++---
 src/conf/storage_conf.h|  6 +++---
 src/libvirt_private.syms   | 10 +-
 src/lxc/lxc_controller.c   |  2 +-
 src/qemu/qemu_command.c|  8 
 src/qemu/qemu_driver.c |  8 
 src/storage/storage_backend_disk.c |  2 +-
 src/util/virstorageencryption.c|  6 +++---
 src/util/virstorageencryption.h| 10 +-
 src/util/virstoragefile.h  | 19 ++-
 src/vbox/vbox_tmpl.c   | 15 ---
 tools/virsh-secret.c   |  4 ++--
 16 files changed, 67 insertions(+), 65 deletions(-)

-- 
1.9.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 4/4] maint: prefer enum over int for virstoragefile structs

2014-05-14 Thread Eric Blake
For internal structs, we might as well be type-safe and let the
compiler help us with less typing required on our part (getting
rid of casts is always nice).  In trying to use enums directly,
I noticed two problems in virstoragefile.h that can't be fixed
without more invasive refactoring: virStorageSource.format is
used as more of a union of multiple enums in storage volume
code (so it has to remain an int), and virStorageSourcePoolDef
refers to pooltype whose enum is declared in src/conf, but where
src/util can't pull in headers from src/conf.

* src/util/virstoragefile.h (virStorageNetHostDef)
(virStorageSourcePoolDef, virStorageSource): Use enums instead of
int for fields of internal types.
* src/qemu/qemu_command.c (qemuParseCommandLine): Cover all values.
* src/conf/domain_conf.c (virDomainDiskSourceParse)
(virDomainDiskSourceFormat): Simplify clients.
* src/qemu/qemu_driver.c
(qemuDomainSnapshotCreateSingleDiskActive)
(qemuDomainSnapshotPrepareDiskExternalBackingInactive)
(qemuDomainSnapshotPrepareDiskExternalOverlayActive)
(qemuDomainSnapshotPrepareDiskInternal): Likewise.

Signed-off-by: Eric Blake ebl...@redhat.com
---
 src/conf/domain_conf.c|  4 ++--
 src/qemu/qemu_command.c   |  8 
 src/qemu/qemu_driver.c|  8 
 src/util/virstoragefile.h | 19 ++-
 4 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e65b62b..e5ae7c6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4972,7 +4972,7 @@ virDomainDiskSourceParse(xmlNodePtr node,

 memset(host, 0, sizeof(host));

-switch ((virStorageType)src-type) {
+switch (src-type) {
 case VIR_STORAGE_TYPE_FILE:
 src-path = virXMLPropString(node, file);
 break;
@@ -14847,7 +14847,7 @@ virDomainDiskSourceFormat(virBufferPtr buf,
 startupPolicy = virDomainStartupPolicyTypeToString(policy);

 if (src-path || src-nhosts  0 || src-srcpool || startupPolicy) {
-switch ((virStorageType)src-type) {
+switch (src-type) {
 case VIR_STORAGE_TYPE_FILE:
 virBufferAddLit(buf, source);
 virBufferEscapeString(buf,  file='%s', src-path);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index cfd1bcf..9ae1a96 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -11065,6 +11065,14 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
 goto error;

 break;
+case VIR_STORAGE_NET_PROTOCOL_HTTP:
+case VIR_STORAGE_NET_PROTOCOL_HTTPS:
+case VIR_STORAGE_NET_PROTOCOL_FTP:
+case VIR_STORAGE_NET_PROTOCOL_FTPS:
+case VIR_STORAGE_NET_PROTOCOL_TFTP:
+case VIR_STORAGE_NET_PROTOCOL_LAST:
+/* ignored for now */
+break;
 }
 }

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 52ca47c..0c91106 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12368,7 +12368,7 @@ 
qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk)
 return 0;

 case VIR_STORAGE_TYPE_NETWORK:
-switch ((virStorageNetProtocol) disk-src.protocol) {
+switch (disk-src.protocol) {
 case VIR_STORAGE_NET_PROTOCOL_NBD:
 case VIR_STORAGE_NET_PROTOCOL_RBD:
 case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
@@ -12430,7 +12430,7 @@ 
qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr d
 return 0;

 case VIR_STORAGE_TYPE_NETWORK:
-switch ((virStorageNetProtocol) disk-src.protocol) {
+switch (disk-src.protocol) {
 case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
 return 0;

@@ -12575,7 +12575,7 @@ qemuDomainSnapshotPrepareDiskInternal(virConnectPtr 
conn,
 return 0;

 case VIR_STORAGE_TYPE_NETWORK:
-switch ((virStorageNetProtocol) disk-src.protocol) {
+switch (disk-src.protocol) {
 case VIR_STORAGE_NET_PROTOCOL_NBD:
 case VIR_STORAGE_NET_PROTOCOL_RBD:
 case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
@@ -12801,7 +12801,7 @@ 
qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,
 VIR_STRDUP(persistSource, snap-src.path)  0)
 goto cleanup;

-switch ((virStorageType)snap-src.type) {
+switch (snap-src.type) {
 case VIR_STORAGE_TYPE_BLOCK:
 reuse = true;
 /* fallthrough */
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index e32389e..0a19603 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -150,7 +150,7 @@ typedef virStorageNetHostDef *virStorageNetHostDefPtr;
 struct _virStorageNetHostDef {
 char *name;
 char *port;
-int transport; /* virStorageNetHostTransport */
+virStorageNetHostTransport transport;
 char *socket;  /* path to unix socket */
 };

@@ -182,10 +182,10 @@ typedef struct 

[libvirt] [PATCH 1/4] vbox: fix stale comment about vdi storage type

2014-05-14 Thread Eric Blake
The code had some todo's about adding 'vdi' to the list of
virStorageType, but we've already done that.

* src/vbox/vbox_tmpl.c (vboxStorageVolCreateXML)
(vboxStorageVolGetXMLDesc): Use enum value for vdi type.

Signed-off-by: Eric Blake ebl...@redhat.com
---
 src/vbox/vbox_tmpl.c | 15 ---
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index a305fe2..e124e69 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -8763,13 +8763,8 @@ static virStorageVolPtr 
vboxStorageVolCreateXML(virStoragePoolPtr pool,
 (def-type != VIR_STORAGE_VOL_FILE))
 goto cleanup;

-/* TODO: for now only the vmdk, vpc and vdi type harddisk
- * variants can be created, also since there is no vdi
- * type in enum virStorageFileFormat {} the default
- * will be to create vdi if nothing is specified in
- * def-target.format
- */
-
+/* For now only the vmdk, vpc and vdi type harddisk
+ * variants can be created.  For historical reason, we default to vdi */
 if (def-target.format == VIR_STORAGE_FILE_VMDK) {
 VBOX_UTF8_TO_UTF16(VMDK, hddFormatUtf16);
 } else if (def-target.format == VIR_STORAGE_FILE_VPC) {
@@ -9175,13 +9170,11 @@ static char *vboxStorageVolGetXMLDesc(virStorageVolPtr 
vol, unsigned int flags)
 def.target.format = VIR_STORAGE_FILE_VMDK;
 else if (STRCASEEQ(vhd, hddFormatUtf8))
 def.target.format = VIR_STORAGE_FILE_VPC;
+else if (STRCASEEQ(vdi, hddFormatUtf8))
+def.target.format = VIR_STORAGE_FILE_VDI;
 else
 def.target.format = VIR_STORAGE_FILE_RAW;

-/* TODO: need to add vdi to enum virStorageFileFormat {}
- * and then add it here
- */
-
 VBOX_UTF8_FREE(hddFormatUtf8);
 }

-- 
1.9.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2/4] maint: use enum typedef for virstorageencryption.h

2014-05-14 Thread Eric Blake
Continuing the work of consistent enum cleanups; this time in
virstorageencryption.h.

* src/util/virstorageencryption.h (virStorageEncryptionFormat):
Convert to typedef, renaming to avoid collision with function.
(virStorageEncryptionSecret, virStorageEncryption): Directly use
enums.

Signed-off-by: Eric Blake ebl...@redhat.com
---
 src/util/virstorageencryption.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util/virstorageencryption.h b/src/util/virstorageencryption.h
index bf83d34..f146249 100644
--- a/src/util/virstorageencryption.h
+++ b/src/util/virstorageencryption.h
@@ -39,23 +39,23 @@ VIR_ENUM_DECL(virStorageEncryptionSecretType)
 typedef struct _virStorageEncryptionSecret virStorageEncryptionSecret;
 typedef virStorageEncryptionSecret *virStorageEncryptionSecretPtr;
 struct _virStorageEncryptionSecret {
-int type;   /* enum virStorageEncryptionSecretType */
+virStorageEncryptionSecretType type;
 unsigned char uuid[VIR_UUID_BUFLEN];
 };

-enum virStorageEncryptionFormat {
+typedef enum {
 /* default is only valid for volume creation */
 VIR_STORAGE_ENCRYPTION_FORMAT_DEFAULT = 0,
 VIR_STORAGE_ENCRYPTION_FORMAT_QCOW, /* Both qcow and qcow2 */

 VIR_STORAGE_ENCRYPTION_FORMAT_LAST,
-};
+} virStorageEncryptionFormatType;
 VIR_ENUM_DECL(virStorageEncryptionFormat)

 typedef struct _virStorageEncryption virStorageEncryption;
 typedef virStorageEncryption *virStorageEncryptionPtr;
 struct _virStorageEncryption {
-int format;/* enum virStorageEncryptionFormat */
+virStorageEncryptionFormatType format;

 size_t nsecrets;
 virStorageEncryptionSecretPtr *secrets;
-- 
1.9.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 3/4] maint: shorten 'TypeType' function names

2014-05-14 Thread Eric Blake
The VIR_ENUM_DECL/VIR_ENUM_IMPL helper macros already append 'Type'
to the enum name being converted; it looks silly to have functions
with 'TypeType' in their name.  Even though some of our enums have
to have a 'Type' suffix, the corresponding string conversion
functions do not.

* src/conf/secret_conf.h (VIR_ENUM_DECL): Rename virSecretUsageType.
* src/conf/storage_conf.h (VIR_ENUM_DECL): Rename
virStoragePoolAuthType, virStoragePoolSourceAdapterType,
virStoragePartedFsType.
* src/conf/domain_conf.c (virDomainDiskDefParseXML)
(virDomainFSDefParseXML, virDomainFSDefFormat): Update callers.
* src/conf/secret_conf.c (virSecretDefParseUsage)
(virSecretDefFormatUsage): Likewise.
* src/conf/storage_conf.c (virStoragePoolDefParseAuth)
(virStoragePoolDefParseSource, virStoragePoolSourceFormat):
Likewise.
* src/lxc/lxc_controller.c (virLXCControllerSetupLoopDevices):
Likewise.
* src/storage/storage_backend_disk.c
(virStorageBackendDiskPartFormat): Likewise.
* src/util/virstorageencryption.c (virStorageEncryptionSecretParse)
(virStorageEncryptionSecretFormat): Likewise.
* tools/virsh-secret.c (cmdSecretList): Likewise.
* src/libvirt_private.syms (secret_conf.h, storage_conf.h): Export
corrected names.

Signed-off-by: Eric Blake ebl...@redhat.com
---
 src/conf/domain_conf.c | 10 +-
 src/conf/domain_conf.h |  2 +-
 src/conf/secret_conf.c |  8 
 src/conf/secret_conf.h |  4 ++--
 src/conf/storage_conf.c| 14 +++---
 src/conf/storage_conf.h|  6 +++---
 src/libvirt_private.syms   | 10 +-
 src/lxc/lxc_controller.c   |  2 +-
 src/storage/storage_backend_disk.c |  2 +-
 src/util/virstorageencryption.c|  6 +++---
 src/util/virstorageencryption.h|  2 +-
 tools/virsh-secret.c   |  4 ++--
 12 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6c3bdad..e65b62b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -329,7 +329,7 @@ VIR_ENUM_IMPL(virDomainFS, VIR_DOMAIN_FS_TYPE_LAST,
   ram,
   bind)

-VIR_ENUM_IMPL(virDomainFSDriverType, VIR_DOMAIN_FS_DRIVER_TYPE_LAST,
+VIR_ENUM_IMPL(virDomainFSDriver, VIR_DOMAIN_FS_DRIVER_TYPE_LAST,
   default,
   path,
   handle,
@@ -5375,7 +5375,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
 goto error;
 }
 auth_secret_usage =
-virSecretUsageTypeTypeFromString(usageType);
+virSecretUsageTypeFromString(usageType);
 if (auth_secret_usage  0) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_(invalid secret type %s),
@@ -5537,7 +5537,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
 if (auth_secret_usage != -1  auth_secret_usage != expected_secret_usage) 
{
 virReportError(VIR_ERR_INTERNAL_ERROR,
_(invalid secret type '%s'),
-   virSecretUsageTypeTypeToString(auth_secret_usage));
+   virSecretUsageTypeToString(auth_secret_usage));
 goto error;
 }

@@ -6313,7 +6313,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
 }

 if (fsdriver) {
-if ((def-fsdriver = virDomainFSDriverTypeTypeFromString(fsdriver)) = 
0) {
+if ((def-fsdriver = virDomainFSDriverTypeFromString(fsdriver)) = 0) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_(unknown fs driver type '%s'), fsdriver);
 goto error;
@@ -15327,7 +15327,7 @@ virDomainFSDefFormat(virBufferPtr buf,
 {
 const char *type = virDomainFSTypeToString(def-type);
 const char *accessmode = 
virDomainFSAccessModeTypeToString(def-accessmode);
-const char *fsdriver = virDomainFSDriverTypeTypeToString(def-fsdriver);
+const char *fsdriver = virDomainFSDriverTypeToString(def-fsdriver);
 const char *wrpolicy = virDomainFSWrpolicyTypeToString(def-wrpolicy);

 if (!type) {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9c80096..bde303c 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2554,7 +2554,7 @@ VIR_ENUM_DECL(virDomainControllerModelPCI)
 VIR_ENUM_DECL(virDomainControllerModelSCSI)
 VIR_ENUM_DECL(virDomainControllerModelUSB)
 VIR_ENUM_DECL(virDomainFS)
-VIR_ENUM_DECL(virDomainFSDriverType)
+VIR_ENUM_DECL(virDomainFSDriver)
 VIR_ENUM_DECL(virDomainFSAccessMode)
 VIR_ENUM_DECL(virDomainFSWrpolicy)
 VIR_ENUM_DECL(virDomainNet)
diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
index 58e12c0..d85bb4e 100644
--- a/src/conf/secret_conf.c
+++ b/src/conf/secret_conf.c
@@ -1,7 +1,7 @@
 /*
  * secret_conf.c: internal secret XML handling
  *
- * Copyright (C) 2009, 2011, 2013, 2014 Red Hat, Inc.
+ * Copyright (C) 2009-2014 Red Hat, 

Re: [libvirt] [PATCH v4 1/1] migration: add support for migrateURI configuration

2014-05-14 Thread chen.fan.f...@cn.fujitsu.com
Hi all,
   
this series patch has been no response for several days, at opening
discussion at
https://www.redhat.com/archives/libvir-list/2014-April/msg00682.html,
Jiri agreed with my point of view. but does anyone else have an opinion
about this? any suggestion is welcome.

Thanks,
Chen

On Wed, 2014-05-14 at 15:18 +0800, Chen Fan wrote: 
 For now, we set the migration URI via command line '--migrate_uri' or
 construct the URI by looking up the dest host's hostname which could be
 solved by DNS automatically.
 
 But in cases the dest host have two or more NICs to reach, we may need to
 send the migration data over a specific NIC which is different from the
 automatically resloved one for some reason like performance, security, etc.
 thus we must explicitly specify the migrateuri in command line everytime,
 but it is too troublesome if there are many such hosts(and don't forget
 virt-manager).
 
 This patches add a configuration file option on dest host to save the
 default migrate uri which explicitly specify which of this host's
 addresses is used for transferring data, thus user doesn't boring
 to specify it in command line everytime.
 
 Signed-off-by: Chen Fan chen.fan.f...@cn.fujitsu.com
 ---
 
 v3-v4: move up the default uri_in setting to
qemuDomainMigratePrepare3Params()
 
  src/qemu/qemu.conf | 6 +-
  src/qemu/qemu_conf.c   | 1 +
  src/qemu/qemu_conf.h   | 1 +
  src/qemu/qemu_driver.c | 2 +-
  4 files changed, 8 insertions(+), 2 deletions(-)
 
 diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
 index f0e802f..6b443d0 100644
 --- a/src/qemu/qemu.conf
 +++ b/src/qemu/qemu.conf
 @@ -449,7 +449,11 @@
  #
  #seccomp_sandbox = 1
  
 -
 +# Override the migration URI for specifying one of host's IP addresses
 +# to transfer the migration data stream.
 +# Defaults to hostname, both IPv4 and IPv6 addresses are accepted.
 +#
 +#migrate_uri = tcp://192.168.0.1
  
  # Override the listen address for all incoming migrations. Defaults to
  # 0.0.0.0, or :: if both host and qemu are capable of IPv6.
 diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
 index 198ee2f..43361dc 100644
 --- a/src/qemu/qemu_conf.c
 +++ b/src/qemu/qemu_conf.c
 @@ -574,6 +574,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr 
 cfg,
  
  GET_VALUE_LONG(seccomp_sandbox, cfg-seccompSandbox);
  
 +GET_VALUE_STR(migrate_uri, cfg-migrateUri);
  GET_VALUE_STR(migration_address, cfg-migrationAddress);
  
  ret = 0;
 diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
 index a36ea63..f99c56e 100644
 --- a/src/qemu/qemu_conf.h
 +++ b/src/qemu/qemu_conf.h
 @@ -163,6 +163,7 @@ struct _virQEMUDriverConfig {
  
  int seccompSandbox;
  
 +char *migrateUri;
  /* The default for -incoming */
  char *migrationAddress;
  int migrationPortMin;
 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
 index fca1a91..56c24b5 100644
 --- a/src/qemu/qemu_driver.c
 +++ b/src/qemu/qemu_driver.c
 @@ -10888,7 +10888,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
  virDomainDefPtr def = NULL;
  const char *dom_xml = NULL;
  const char *dname = NULL;
 -const char *uri_in = NULL;
 +const char *uri_in = cfg-migrateUri;
  const char *listenAddress = cfg-migrationAddress;
  char *origname = NULL;
  int ret = -1;


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list